Langsung ke konten
Skillpedia
Agen7.8k ยท #12832

agent-squad-typescript

Fungsinya

Panduan ini membantu AI menulis aplikasi Node.js atau TypeScript yang memakai paket agent-squad untuk menjalankan beberapa agent AI. Panduan ini ditujukan untuk pengembang yang membangun asisten AI di server.

Kapan dipakai

  • โœ“Saat saya ingin membangun tim agent AI, dengan setiap agent menangani topik yang berbeda.
  • โœ“Saat saya membutuhkan rantai langkah AI, dengan setiap langkah meneruskan hasilnya ke langkah berikutnya.
  • โœ“Saat jawaban AI saya harus mengambil dari dokumen atau basis pengetahuan saya sendiri.

Link skill

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

Salin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.

Cara pakai

Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.

Pesan siap tempel

Gunakan skill ini untuk membantu saya: https://github.com/2FastLabs/agent-squad/blob/main/typescript/SKILL.md Baca file SKILL.md di link tersebut dan ikuti instruksinya untuk tugas saya.
Mau AI Anda menemukan skill seperti ini sendiri?Pasang MCP Skillpedia gratis: cukup satu baris, dan AI mencari di antara 15.000+ skill sebelum tiap tugas.Pasang dalam 1 menit โ†’

Contoh permintaan ke AI

โ€œSaya ingin menyiapkan aplikasi TypeScript tempat beberapa agent AI menjawab berbagai jenis pertanyaan. Bagaimana saya harus mulai?โ€

5 skill baru setiap minggu. 1 menit baca.

Cara kerjanya

Panduan ini memberi tahu AI bagian mana dari paket yang harus dipakai, seperti orchestrator, agent, perutean, dan penyimpanan, serta hal yang harus dihindari. Detail kode yang tepat berasal dari paket itu sendiri.

Konten teknis (SKILL.md asli)

Teks asli dari pembuat, dalam bahasa Inggris, langsung dari 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

Pertanyaan umum

Di mana data agent bisa disimpan?

Paket ini mendukung penyimpanan dalam memori, DynamoDB, dan basis data SQL, sehingga Anda bisa memilih yang sesuai.

Bagaimana cara memasang paket ini?

Panduan ini memakai perintah npm install standar untuk paket agent-squad, dan tambahan opsional hanya dipasang jika dibutuhkan.

Apakah agent bisa memakai alat MCP?

Bisa. Penyedia alat MCP memungkinkan agent memakai alat dari server eksternal.

Detail

Deskripsi asli dari pembuat

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

Popularitas

Bintang GitHub
7.8k
Peringkat
#12832
Lisensi
Apache-2.0
Diperbarui
8/10/2026

Apakah skill ini berguna?

0

Masuk untuk memberi suara.

Komentar

  • โ€ฆ

Skill lain dari repositori ini

Skill serupa