MCPcopy
hub / github.com/2FastLabs/agent-squad

github.com/2FastLabs/agent-squad @typescript_1.1.1 sqlite

repository ↗ · DeepWiki ↗ · release typescript_1.1.1 ↗
1,472 symbols 5,589 edges 211 files 358 documented · 24%
README

Agent Squad

Flexible, lightweight open-source framework for orchestrating multiple AI agents to handle complex conversations.


📦 New Home: Agent Squad has moved! Previously hosted at awslabs/agent-squad, this project is now maintained at 2fastlabs/agent-squad.

Please update your bookmarks, clone URLs, and dependencies accordingly.


GitHub Repo npm PyPI

GitHub stars GitHub forks GitHub watchers

Last Commit Issues Pull Requests

📚 Explore Full Documentation

🔖 Features

  • 🧠 Intelligent intent classification — Dynamically route queries to the most suitable agent based on context and content.
  • 🔤 Dual language support — Fully implemented in both Python and TypeScript.
  • 🌊 Flexible agent responses — Support for both streaming and non-streaming responses from different agents.
  • 📚 Context management — Maintain and utilize conversation context across multiple agents for coherent interactions.
  • 🔧 Extensible architecture — Easily integrate new agents or customize existing ones to fit your specific needs.
  • 🌐 Universal deployment — Run anywhere - from AWS Lambda to your local environment or any cloud platform.
  • 📦 Pre-built agents and classifiers — A variety of ready-to-use agents and multiple classifier implementations available.

What Is Agent Squad ❓

The Agent Squad is a flexible framework for managing multiple AI agents and handling complex conversations. It intelligently routes queries and maintains context across interactions.

The system offers pre-built components for quick deployment, while also allowing easy integration of custom agents and conversation messages storage solutions.

This adaptability makes it suitable for a wide range of applications, from simple chatbots to sophisticated AI systems, accommodating diverse requirements and scaling efficiently.


🏗️ High-level architecture flow diagram

High-level architecture flow diagram

  1. The process begins with user input, which is analyzed by a Classifier.
  2. The Classifier leverages both Agents' Characteristics and Agents' Conversation history to select the most appropriate agent for the task.
  3. Once an agent is selected, it processes the user input.
  4. The orchestrator then saves the conversation, updating the Agents' Conversation history, before delivering the response back to the user.

Introducing SupervisorAgent: Agents Coordination

The Agent Squad now includes a powerful new SupervisorAgent that enables sophisticated team coordination between multiple specialized agents. This new component implements a "agent-as-tools" architecture, allowing a lead agent to coordinate a team of specialized agents in parallel, maintaining context and delivering coherent responses.

SupervisorAgent flow diagram

Key capabilities: - 🤝 Team Coordination - Coordinate multiple specialized agents working together on complex tasks - ⚡ Parallel Processing - Execute multiple agent queries simultaneously - 🧠 Smart Context Management - Maintain conversation history across all team members - 🔄 Dynamic Delegation - Intelligently distribute subtasks to appropriate team members - 🤖 Agent Compatibility - Works with all agent types (Bedrock, Anthropic, Lex, etc.)

The SupervisorAgent can be used in two powerful ways: 1. Direct Usage - Call it directly when you need dedicated team coordination for specific tasks 2. Classifier Integration - Add it as an agent within the classifier to build complex hierarchical systems with multiple specialized teams

Here are just a few examples where this agent can be used: - Customer Support Teams with specialized sub-teams - AI Movie Production Studios - Travel Planning Services - Product Development Teams - Healthcare Coordination Systems

Learn more about SupervisorAgent →

💬 Demo App

In the screen recording below, we demonstrate an extended version of the demo app that uses 6 specialized agents: - Travel Agent: Powered by an Amazon Lex Bot - Weather Agent: Utilizes a Bedrock LLM Agent with a tool to query the open-meteo API - Restaurant Agent: Implemented as an Amazon Bedrock Agent - Math Agent: Utilizes a Bedrock LLM Agent with two tools for executing mathematical operations - Tech Agent: A Bedrock LLM Agent designed to answer questions on technical topics - Health Agent: A Bedrock LLM Agent focused on addressing health-related queries

Watch as the system seamlessly switches context between diverse topics, from booking flights to checking weather, solving math problems, and providing health information. Notice how the appropriate agent is selected for each query, maintaining coherence even with brief follow-up inputs.

The demo highlights the system's ability to handle complex, multi-turn conversations while preserving context and leveraging specialized agents across various domains.

🎯 Examples & Quick Start

Get hands-on experience with the Agent Squad through our diverse set of examples:

  • Demo Applications:
  • Streamlit Global Demo: A single Streamlit application showcasing multiple demos, including:
    • AI Movie Production Studio
    • AI Travel Planner
  • Chat Demo App:
    • Explore multiple specialized agents handling various domains like travel, weather, math, and health
  • E-commerce Support Simulator: Experience AI-powered customer support with:
    • Automated response generation for common queries
    • Intelligent routing of complex issues to human support
    • Real-time chat and email-style communication
    • Human-in-the-loop interactions for complex cases
  • Sample Projects: Explore our example implementations in the examples folder:
  • chat-demo-app: Web-based chat interface with multiple specialized agents
  • ecommerce-support-simulator: AI-powered customer support system
  • chat-chainlit-app: Chat application built with Chainlit
  • fast-api-streaming: FastAPI implementation with streaming support
  • text-2-structured-output: Natural Language to Structured Data
  • bedrock-inline-agents: Bedrock Inline Agents sample
  • bedrock-prompt-routing: Bedrock Prompt Routing sample code

Examples are available in both Python and TypeScript. Check out our documentation for comprehensive guides on setting up and using the Agent Squad framework!

📚 Deep Dives: Stories, Blogs & Podcasts

Discover creative implementations and diverse applications of the Agent Squad:

This article demonstrates how to build a multilingual chatbot using the Agent Squad framework. The article explains how to use an Amazon Lex bot as an agent, along with 2 other new agents to make it work in many languages with just a few lines of code.

This article demonstrates how to build an AI-driven multi-agent system for automated e-commerce customer email support. It covers the architecture and setup of specialized AI agents using the Agent Squad framework, integrating automated processing with human-in-the-loop oversight. The guide explores email ingestion, intelligent routing, automated response generation, and human verification, providing a comprehensive approach to balancing AI efficiency with human expertise in customer support.

This article demonstrates how to build an AI customer call center. It covers the architecture and setup of specialized AI agents using the Agent Squad framework interacting with voice via Amazon Connect and Amazon Lex.

Learn how to scale Amazon Bedrock Agents beyond knowledge base limitations using the Agent Squad framework and InvokeInlineAgent API. This article demonstrates dynamic agent creation and knowledge base selection for enterprise-scale AI applications.

Learn how to enhance Amazon Bedrock Flows with conversation memory and multi-flow orchestration using the Agent Squad framework. This guide shows how to overcome Bedrock Flows' limitations to build more sophisticated AI workflows with persistent memory and intelligent routing between flows.

🎙️ Podcast Discussions

  • 🇫🇷 Podcast (French): L'orchestrateur multi-agents : Un orchestrateur open source pour vos agents IA
  • Platforms:

  • 🇬🇧 Podcast (English): An Orchestrator for Your AI Agents

  • Platforms:

TypeScript Version

Installation

🔄 multi-agent-orchestrator becomes agent-squad

npm install agent-squad

Usage

The following example demonstrates how to use the Agent Squad with two different types of agents: a Bedrock LLM Agent with Converse API support and a Lex Bot Agent. This showcases the flexibility of the system in integrating various AI services.

```typescript import { AgentSquad, BedrockLLMAgent, LexBotAgent } from "agent-squad";

const orchestrator = new AgentSquad();

// Add a Bedrock LLM Agent with Converse API support orchestrator.addAgent( new BedrockLLMAgent({ name: "Tech Agent", description: "Specializes in technology areas including software development, hardware, AI, cybersecurity, blockchain, cloud computing, emerging tech innovations, and pricing/costs related to technology products and services.", streaming: true }) );

// Add a Lex Bot Agent for handling travel-related queries orchestrator.addAgent( new LexBotAgent({ name: "Travel Agent", description: "Helps users book and manage their flight reservations", botId: process.env.LEX_BOT_ID, botAliasId: process.env.LEX_BOT_ALIAS_ID, localeId: "en_US", }) );

// Example usage const response = await orchestrator.routeRequest( "I want to book a flight", 'user123', 'session456' );

// Handle the response (streaming or non-streaming) if (response.streaming == true) { console.log("\n** RESPONSE STREAMING ** \n"); // Send metadata immediately console.log(> Agent ID: ${response.metadata.agentId}); console.log(`> Agent

Extension points exported contracts — how you extend this code

ToolOutputCurator (Interface)
(no doc) [7 implementers]
typescript/src/agents/groundedAgent.ts
ToolCall (Interface)
(no doc)
typescript/tests/agents/groundedAgent.test.ts
UserInterfaceProps (Interface)
(no doc)
examples/chat-demo-app/lib/user-interface-stack.ts
Message (Interface)
(no doc)
examples/ecommerce-support-simulator/resources/ui/src/types.ts
InputData (Interface)
(no doc)
examples/local-demo/tools/weather_tool.ts
SdkClient (Interface)
* Minimal interface for an AWS SDK v3 client. * * @internal
typescript/src/common/src/types/awsSdk.ts
KnowledgeBaseStorageConfigurationProps (Interface)
(no doc)
examples/chat-demo-app/lib/knowledge-base-construct.ts
HumanAgentOptions (Interface)
(no doc)
examples/ecommerce-support-simulator/lambda/customerMessage/agents.ts

Core symbols most depended-on inside this repo

log
called by 105
examples/ecommerce-support-simulator/lambda/customerMessage/sqsLogger.ts
error
called by 54
examples/ecommerce-support-simulator/lambda/customerMessage/sqsLogger.ts
error
called by 49
python/src/agent_squad/utils/logger.py
info
called by 40
examples/ecommerce-support-simulator/lambda/customerMessage/sqsLogger.ts
info
called by 37
typescript/src/utils/logger.ts
error
called by 32
typescript/src/utils/logger.ts
saveChatMessage
called by 29
typescript/src/storage/sqlChatStorage.ts
add_agent
called by 27
python/src/agent_squad/orchestrator.py

Shape

Method 672
Function 498
Class 224
Interface 52
Route 22
Enum 4

Languages

Python64%
TypeScript36%

Modules by API surface

python/src/tests/agents/test_strands_agent.py40 symbols
python/src/tests/classifiers/test_anthropic_classifier.py38 symbols
python/src/tests/agents/test_bedrock_llm_agent.py34 symbols
python/src/tests/agents/test_anthropic_agent.py33 symbols
python/src/tests/test_orchestrator.py31 symbols
python/src/agent_squad/agents/grounded_agent.py31 symbols
python/src/tests/agents/test_grounded_agent.py29 symbols
typescript/src/agents/groundedAgent.ts27 symbols
python/src/agent_squad/utils/tool.py23 symbols
python/src/tests/agents/test_supervisor_agent.py22 symbols
typescript/src/orchestrator.ts21 symbols
python/src/agent_squad/agents/bedrock_llm_agent.py21 symbols

Dependencies from manifests, versioned

@anthropic-ai/sdk0.51.0 · 1×
@astrojs/check0.9.3 · 1×
@astrojs/mdx3.1.7 · 1×
@astrojs/react3.6.2 · 1×
@astrojs/rss4.0.7 · 1×
@astrojs/sitemap3.1.6 · 1×
@astrojs/starlight0.38.5 · 1×
@astrojs/tailwind5.1.1 · 1×
@aws-amplify/api6.0.51 · 1×
@aws-amplify/ui-react6.5.1 · 1×
@aws-cdk/aws-cognito-identitypool-alpha2.158.0-alpha.0 · 1×
@aws-cdk/aws-lambda1.204.0 · 1×

For agents

$ claude mcp add agent-squad \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact