Skip to content
Skillpedia
Agents7.8k Β· #12832

agent-squad-typescript

What it does

This guide helps the AI write a Node.js or TypeScript app that uses the agent-squad package to run several AI agents. It is for developers building AI assistants on a server.

When to use it

  • βœ“When I want to build a team of AI agents, where each one handles a different topic.
  • βœ“When I need a chain of AI steps, where each step passes its result to the next.
  • βœ“When my AI answers must draw on my own documents or a knowledge base.

Skill link

https://github.com/2FastLabs/agent-squad/blob/main/typescript/SKILL.md

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/2FastLabs/agent-squad/blob/main/typescript/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute β†’

Example of what to ask your AI

β€œI want to set up a TypeScript app where several AI agents answer different kinds of questions. How should I start?”

5 new skills a week. 1 minute to read.

How it works

It tells the AI which parts of the package to use, such as the orchestrator, agents, routing and storage, and what to avoid. The exact code details come from the package itself.

Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

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

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:

import { AgentSquad, BedrockLLMAgent, BedrockClassifier } from 'agent-squad';

const orchestrator = new AgentSquad({
  classifier: new BedrockClassifier(),   // default when omitted
  // storage: new DynamoDbChatStorage(...),
  // config: { LOG_AGENT_CHAT: true, MAX_MESSAGE_PAIRS_PER_AGENT: 50 },
});

orchestrator.addAgent(new BedrockLLMAgent({
  name: 'Tech Support',
  description: 'Handles technical questions about software and hardware',
  streaming: true,
}));

const response = await orchestrator.routeRequest(
  userInput,
  userId,
  sessionId,
  additionalParams   // optional Record<string, any>
);

if (response.streaming) {
  // response.output is an AccumulatorTransform (Node.js Transform)
  for await (const chunk of response.output) {
    process.stdout.write(chunk);
  }
} else {
  // response.output is a string
  console.log(response.output);
  // response.thinking? is set when the agent used extended thinking
}

// response.metadata: { agentId, agentName, userId, sessionId, userInput, additionalParams }

routeRequest never throws β€” it catches all errors and returns them as a non-streaming AgentResponse with the error string in output (configurable via GENERAL_ROUTING_ERROR_MSG_MESSAGE).

The pieces

Orchestrator: AgentSquad

new AgentSquad(options?: OrchestratorOptions)

Key OrchestratorOptions fields:

Field Default Notes
classifier new BedrockClassifier() Any Classifier subclass
storage new InMemoryChatStorage() Any ChatStorage subclass
defaultAgent undefined Used when classifier returns no match and USE_DEFAULT_AGENT_IF_NONE_IDENTIFIED is true
config.USE_DEFAULT_AGENT_IF_NONE_IDENTIFIED true Fall back to defaultAgent or return NO_SELECTED_AGENT_MESSAGE
config.MAX_MESSAGE_PAIRS_PER_AGENT 100 Per-agent history cap (pairs = user+assistant)
config.MAX_RETRIES 3 Classifier retries on bad XML response
config.LOG_AGENT_CHAT false

Useful methods: addAgent(agent), setDefaultAgent(agent), getDefaultAgent(), getAllAgents(), analyzeAgentOverlap(), classifyRequest(...), `agentProcess

FAQ

Where can the agent data be stored?

The package supports in-memory storage, DynamoDB and SQL databases, so you choose the one that fits.

How is the package installed?

The guide uses the standard npm install command for the agent-squad package, and optional extras are added only when needed.

Can agents use MCP tools?

Yes, an MCP tool provider lets the agents use tools from outside servers.

Details

Original description by the author

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).

repo: 2FastLabs/agent-squad

Popularity

GitHub stars
7.8k
Ranking position
#12832
License
Apache-2.0
Updated
10/8/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills