SKILL.md--- name: agent-squad-typescript description: >- Use when building or modifying a Node.js / TypeScript app that uses the agent-squad npm package — multi-agent orchestration: orchestrator, agents (all built-in types + GroundedAgent), classifier routing (Bedrock / Anthropic / OpenAI), storage (in-memory / DynamoDB / SQL), retrievers (Amazon KB / Dakera), and tools (AgentTools + MCPToolProvider). --- # agent-squad TypeScript — assistant guide Node.js / TypeScript multi-agent orchestration framework (npm package `agent-squad`). All public symbols are exported from a single barrel `typescript/src/index.ts`. This file is guidance and a map — **not an API reference**. Read exact signatures from `typescript/src/` and worked recipes from `docs/src/content/docs/`; this file tells you *what to use, when, and what to watch out for*. ## When to use what - **One assistant** → a single `Agent` subclass + `AgentSquad` with no routing. Or skip the orchestrator entirely and call `agent.processRequest(...)` directly. - **Several specialists** → multiple agents registered with `orchestrator.addAgent(agent)`, a classifier routes each turn. - **Answers must not drift from data** (prices, balances, live lookups) → `GroundedAgent`: a gatherer LLM calls tools, an isolated presenter LLM speaks only from the curated results. - **Fixed pipeline** → `ChainAgent`: each agent's output is the next agent's input. - **One lead LLM coordinating a team** → `SupervisorAgent`: the lead calls sub-agents as tools. - **External tools via MCP** → `MCPToolProvider` (async factory pattern, optional peer dep). - **RAG context** → attach a `Retriever` to any agent that supports `retriever?` in its options. ## How to install ```bash npm install agent-squad ``` Optional peer dependencies — install only what you use: | Package | Used by | |---|---| | `@aws-sdk/client-bedrock-runtime` | `BedrockLLMAgent`, `BedrockClassifier` (already a hard dep in current releases) | | `@anthropic-ai/sdk` | `AnthropicAgent`, `AnthropicClassifier` (already a hard dep) | | `openai` | `OpenAIAgent`, `OpenAIClassifier` (already a hard dep) | | `@modelcontextprotocol/sdk` | `MCPToolProvider` — lazy `await import()` at connect time | | `@dakera-ai/dakera` | `DakeraRetriever` — lazy `require()` at construction time | `@modelcontextprotocol/sdk` and `@dakera-ai/dakera` are the only two true optional peer deps; everything else ships as a hard dependency at the moment. ## How a turn works `routeRequest` is the single entry point. It classifies the input, dispatches to the selected agent, saves the exchange, and returns an `AgentResponse`. The response is either a plain string or a Node.js `Transform` stream: ```typescript import { AgentSquad, BedrockLLMAgent, BedrockClassifier } from 'agent-squad'; const orchestrator = new AgentSquad({ classifier: new BedrockClassifier(), // default when omitted // storage: new DynamoDbChat