openrouterteam/agent-skills
Overview
This skill bootstraps a modular AI agent using the OpenRouter SDK with an extensible hook system and an optional Ink-based terminal UI. It provides a standalone agent core that can run headless, register tools at runtime, and stream items-based responses for robust UI updates. Use it to quickly integrate 300+ models, tool calls, and progressive reasoning into your application.
How this skill works
The agent core wraps the OpenRouter client and exposes a lifecycle and event hooks for messages, streaming items, tool calls, reasoning updates, and errors. Streaming uses an items-based model: UI layers replace items by ID instead of concatenating chunks, enabling accurate partial updates. Tools are defined with zod schemas and can be added at runtime; optional Ink TUI consumes the agent events to render a responsive terminal chat.
When to use it
- Building a headless chatbot or bot service that needs streaming and tool integration.
- Embedding an AI assistant into a terminal app with a polished Ink UI.
- Creating orchestration logic that needs hooks for tool calls, reasoning, and partial outputs.
- Prototyping multi-model workflows using OpenRouter’s unified model access.
- Systems that require replace-by-ID streaming updates for reliable UI rendering.
Best practices
- Keep API keys in environment variables and never commit them to source control.
- Use items-based streaming for UIs to replace items by ID rather than accumulating raw chunks.
- Define tools with zod schemas to validate inputs and outputs and reduce runtime errors.
- Limit step count / maxSteps to avoid runaway tool loops and long reasoning chains.
- Hook into error, thinking, and stream events for clear UX and telemetry.
Example use cases
- A CLI knowledge assistant that calls web search and calculator tools and shows progressive answers in the terminal.
- A Discord bot that routes user inputs to the agent core and streams responses back to chat with incremental updates.
- A backend service that runs headless agent workflows and triggers external APIs via tool calls.
- Rapid prototyping of model behaviors by swapping models through OpenRouter without changing agent logic.
FAQ
No. The Ink TUI is optional. The agent core runs headless and can be integrated into any interface or service.
How do I add custom tools at runtime?
Define tools with the SDK’s tool helper and zod schemas, then call agent.addTool(newTool) to register them while the agent runs.
2 skills
This skill boots a modular AI agent with OpenRouter SDK, hooks, and optional Ink TUI for interactive control.
This skill helps AI agents integrate with OpenRouter TypeScript SDK to callModel with type safety and multi-turn support.