
Create Agent
Bootstrap a standalone TypeScript agent on OpenRouter with hooks, item-based streaming, tools, and optional Ink TUI or HTTP/Discord hosts.
Overview
Create-agent is an agent skill for the Build phase that bootstraps a modular OpenRouter TypeScript agent with hooks, streaming items, tools, and optional Ink TUI integrations.
Install
npx skills add https://github.com/openrouterteam/agent-skills --skill create-agentWhat is this skill?
- Standalone Agent class with EventEmitter hooks separate from optional Ink terminal UI
- OpenRouter TypeScript SDK with 300+ models and dynamic Models API discovery
- Items-based streaming model for reasoning/thinking and efficient UI state updates
- Zod-based tool definitions, multi-turn conversations, and reference paths for HTTP server and Discord bots
- Documented skill metadata v1.1.0 (January 2026) with official OpenRouter SDK and Ink references
- 300+ language models via OpenRouter
- Skill guide version 1.1.0 (January 2026)
Adoption & trust: 2.6k installs on skills.sh; 28 GitHub stars; 3/3 security scanners passed (skills.sh audits).
What problem does it solve?
You want a real agent architecture on OpenRouter—not scattered fetch calls—with streaming, tools, and a clear path to HTTP or Discord hosts.
Who is it for?
TypeScript solo builders starting an OpenRouter-powered agent, CLI copilot, or lightweight bot with streaming UX.
Skip if: No-code chat widgets, Python-only stacks, or teams that only need a single prompt with no tools or multi-turn state.
When should I use this skill?
Bootstrap a modular AI agent with OpenRouter SDK, extensible hooks, and optional Ink TUI.
What do I get? / Deliverables
You get a documented modular layout (core agent, hooks, SDK usage) ready to extend with your tools and deployment surface.
- Modular agent project structure
- Hook-extensible Agent core
- Optional Ink TUI or HTTP/Discord integration sketch
Recommended Skills
Journey fit
Agent cores and SDK wiring happen while you are building the product’s AI layer, before ship-time hardening. create-agent targets modular agent-tooling: OpenRouter SDK, Zod tools, streaming items—not generic CRUD backend work.
How it compares
Opinionated OpenRouter agent bootstrap—not a hosted agent platform or generic LangChain tutorial.
Common Questions / FAQ
Who is create-agent for?
Developers building custom agents with the OpenRouter TypeScript SDK who want hooks, tools, and optional terminal UI separated cleanly.
When should I use create-agent?
In Build (agent-tooling) when scaffolding a new agent repo, adding Ink TUI, or wiring HTTP/Discord entrypoints before Ship testing and Operate monitoring.
Is create-agent safe to install?
The skill describes network calls to model APIs and example servers; review Security Audits on this page and never embed API keys in generated code.
SKILL.md
READMESKILL.md - Create Agent
{ "version": "1.1.0", "organization": "OpenRouter Inc", "date": "January 2026", "abstract": "Complete guide for building modular AI agents with the OpenRouter TypeScript SDK. Features a standalone Agent class with EventEmitter-based hooks for extensibility, items-based streaming model for efficient UI state management, optional Ink TUI for interactive terminal interfaces, and examples for HTTP server and Discord integrations. Includes Zod-based tool definitions, streaming responses with support for reasoning/thinking items, multi-turn conversations, and dynamic model discovery via the OpenRouter Models API.", "references": [ "https://openrouter.ai/docs/sdks/typescript", "https://openrouter.ai/docs/sdks/typescript/call-model/working-with-items", "https://openrouter.ai/docs/api-reference", "https://openrouter.ai/api/v1/models", "https://github.com/vadimdemedes/ink" ] } --- name: create-agent description: Bootstrap a modular AI agent with OpenRouter SDK, extensible hooks, and optional Ink TUI metadata: version: 0.0.0 homepage: https://openrouter.ai --- # Build a Modular AI Agent with OpenRouter This skill helps you create a **modular AI agent** with: - **Standalone Agent Core** - Runs independently, extensible via hooks - **OpenRouter SDK** - Unified access to 300+ language models - **Optional Ink TUI** - Beautiful terminal UI (separate from agent logic) ## Architecture ``` ┌─────────────────────────────────────────────────────┐ │ Your Application │ ├─────────────────────────────────────────────────────┤ │ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │ │ │ Ink TUI │ │ HTTP API │ │ Discord │ │ │ └──────┬──────┘ └──────┬──────┘ └──────┬──────┘ │ │ │ │ │ │ │ └────────────────┼────────────────┘ │ │ ▼ │ │ ┌───────────────────────┐ │ │ │ Agent Core │ │ │ │ (hooks & lifecycle) │ │ │ └───────────┬───────────┘ │ │ ▼ │ │ ┌───────────────────────┐ │ │ │ OpenRouter SDK │ │ │ └───────────────────────┘ │ └─────────────────────────────────────────────────────┘ ``` ## Prerequisites Get an OpenRouter API key at: https://openrouter.ai/settings/keys ⚠️ **Security:** Never commit API keys. Use environment variables. ## Project Setup ### Step 1: Initialize Project ```bash mkdir my-agent && cd my-agent npm init -y npm pkg set type="module" ``` ### Step 2: Install Dependencies ```bash npm install @openrouter/sdk zod eventemitter3 npm install ink react # Optional: only for TUI npm install -D typescript @types/react tsx ``` ### Step 3: Create tsconfig.json ```json { "compilerOptions": { "target": "ES2022", "module": "NodeNext", "moduleResolution": "NodeNext", "jsx": "react-jsx", "strict": true, "esModuleInterop": true, "skipLibCheck": true, "outDir": "dist" }, "include": ["src"] } ``` ### Step 4: Add Scripts to package.json ```json { "scripts": { "start": "tsx src/cli.tsx", "start:headless": "tsx src/headless.ts", "dev": "tsx watch src/cli.tsx" } } ``` ## File Structure ```bash src/ ├── agent.ts # Standalone agent core with hooks ├── tools.ts # Tool definitions ├── cli.tsx # Ink TUI (optional interface) └── headless.ts # Headless usage example ``` ## Step 1: Agent Core with Hooks Create `src/agent.ts` - the standalone agent that can run anywhere: ```typescript import { OpenRouter, tool, stepCountIs } from '@openrouter/sdk'; import type { Tool, StopCondition, StreamableOutputItem } from '@openrouter/sdk'; import { EventEmitter } from 'eventemitter3'; import { z } from 'zod'; // Message types export