agent-squad-python

Build async multi-agent orchestration apps in Python with the agent-squad framework.

7.8k|738|Updated Jul 23, 2024
One-click install
npx skills add https://github.com/2FastLabs/agent-squad --skill agent-squad-python
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: agent-squad-python
Source: https://github.com/2FastLabs/agent-squad/tree/main/python
Command: npx skills add https://github.com/2FastLabs/agent-squad --skill agent-squad-python

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Building applications that route user queries across multiple specialized AI agents requires wiring together classifiers, agents, storage, and tools correctly. This Skill gives an AI assistant the mental model, real API signatures, task recipes, and gotchas needed to write correct agent-squad Python code on the first attempt.

Core Features & Use Cases

  • Orchestration Guidance: Covers the AgentSquad orchestrator, route_request entry point, streaming vs non-streaming responses, and classifier-based routing with Bedrock, Anthropic, or OpenAI classifiers.
  • Agent Patterns: Explains when to use BedrockLLMAgent, AnthropicAgent, OpenAIAgent, SupervisorAgent for team coordination, GroundedAgent for anti-hallucination answers, and ChainAgent for sequential pipelines.
  • Storage, Retrievers, and Tools: Documents InMemoryChatStorage, DynamoDbChatStorage, SqlChatStorage, Amazon Knowledge Bases and Dakera retrievers, plus AgentTools and MCPToolProvider for tool use.
  • Use Case: Ask your assistant to build a customer-support bot that routes billing questions to one agent and technical questions to another, with DynamoDB-backed conversation history, and it will produce correct async Python code using the right extras and options.

Quick Start

Ask your assistant to read python/SKILL.md and then write an agent-squad Python app with two BedrockLLMAgent agents routed by a BedrockClassifier.

Frequently Asked Questions about agent-squad-python

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I route user queries to multiple AI agents in Python?

Create an AgentSquad orchestrator, register agents with add_agent, and await route_request with user_input, user_id, and session_id. A classifier such as BedrockClassifier selects the best agent based on each agent's name and description.

How do I install agent-squad for Python with Anthropic or OpenAI support?

Install optional extras with pip: agent-squad[anthropic] for AnthropicAgent and AnthropicClassifier, agent-squad[openai] for OpenAI equivalents, or agent-squad[all] for everything except strands-agents. The core package alone includes no LLM runtime.

Does agent-squad Python support streaming responses?

Yes. Agents like BedrockLLMAgent support streaming, and you must pass stream_response=True to route_request. Then response.output is an async generator of AgentStreamResponse chunks; always branch on response.streaming before consuming output.

Why does AgentSquad raise ValueError when I create it without a classifier?

The Python orchestrator requires a classifier at construction time. It defaults to BedrockClassifier only if boto3 is installed; otherwise you must pass a classifier explicitly, such as AnthropicClassifier or OpenAIClassifier.

How do I connect MCP tool servers to an agent-squad agent?

Install agent-squad[mcp], then await MCPToolProvider.create with stdio or SSE server configs and pass the provider as the agent's tool_config. Call await provider.disconnect() when finished to close server connections.

When should I use GroundedAgent instead of a regular LLM agent?

Use GroundedAgent when answers must not drift from tool data, such as prices or balances. A gatherer LLM calls tools while an isolated presenter LLM writes the reply only from curated facts, never seeing chat history.