Agency Swarm
A reliable multi-agent orchestration framework built on the OpenAI Agents SDK for creating and managing collaborative AI agent swarms.
Evidence shows the framework allows user-defined tools and communication flows, but lacks least-privilege mechanisms or user confirmation steps. Data flow transparency is limited, only described in docs. Sensitive data handling not explicitly addressed. Dependencies have version ranges but no security audit. External effects (e.g., file uploads, API calls) not explicitly restricted. No rollback mechanism. Source attribution partially clear via license and author info. Deductions: missing permission controls, user confirmation, rollback.
Framework internal consistency is good; docs and code examples align. Dependencies have version ranges but availability not verified. Error messages not detailed in docs. Deduction: insufficient error handling documentation.
Targets developers, offers multiple usage scenarios (Web UI, terminal, programmatic). Capability boundaries defined via communication flows, but trigger precision not explicit. Environment compatibility (Python 3.12+, multi-OS) stated. Deductions: trigger precision and boundary documentation insufficient.
Information architecture clear, with install guides, examples, and doc links. Naming stable, version numbers explicit. Known limitations not listed. License MIT, versioning has changelog but not provided. Maintenance responsibility partially clear via authors and contributing guide. Deductions: missing known limitations and changelog.
Output usability high, multiple run modes. Marginal value in multi-agent orchestration, but cost-benefit not quantified. Deduction: cost-benefit not addressed.
Claims in docs (e.g., 92% coverage) not verified in provided files. Cross-source corroboration limited. Facts and inferences not clearly separated. Deductions: claims lack evidence.
- No least-privilege or user confirmation mechanisms; handle sensitive operations with caution.
- Dependencies not security-audited; recommend regular vulnerability checks.
- Claims like 92% coverage not verified in provided files; independently verify.
What does this agent do, and when should you use it?
Agency Swarm is an open-source framework for building multi-agent applications. It extends the OpenAI Agents SDK to provide specialized features for creating, orchestrating, and managing collaborative swarms of AI agents. Inspired by real-world organizational structures, the framework allows users to define agents with roles such as CEO and Developer. Key features include customizable agent roles, full control over prompts and instructions, type-safe tools using Pydantic models, orchestrated agent communication through directional flows, flexible state persistence via callbacks, and a production-ready focus. Installation is via pip and requires Python 3.12+ and an OpenAI API key. The framework offers a Web UI, terminal UI, and programmatic interfaces.
Agency Swarm enables you to define agents with specific roles (e.g., CEO, Developer) and orchestrate their interactions via directional communication flows. It provides a @function_tool decorator and BaseTool class for defining type-safe tools, and supports converting OpenAPI schemas into tools via ToolFactory. Agents communicate using a send_message tool, with flows managed by the Agency object. It includes callbacks for saving and loading thread history for persistence, and offers copilot_demo(), tui(), and async get_response() methods for interaction. It is built on the OpenAI Agents SDK and uses the Responses API, with support for other model providers via LiteLLM.
- Build a multi-agent system with roles like CEO and Developer to handle software development tasks.
- Create a virtual assistant agent that handles client communication and delegates tasks to specialized agents.
- Automatically generate tools from OpenAPI schemas to integrate with public APIs seamlessly.
- Persist conversation state across sessions using save/load thread callbacks for long-running interactions.
- Prototype and test multi-agent workflows using the Web UI (
copilot_demo) or terminal UI (tui).
What are this agent's strengths and limitations?
- Seamless integration with the OpenAI Agents SDK and Responses API.
- Type-safe tools via Pydantic field descriptions enhance reliability.
- Explicit directional communication flows give clear control over agent interactions.
- Support for session persistence via callbacks adds flexibility for long-running tasks.
- Primary model backend is OpenAI; other providers need extra configuration.
- Requires Python 3.12+, which may restrict use on older systems.
- Strong reliance on OpenAI, with adaptation needed for other providers.
- Adds an abstraction layer over the native OpenAI SDK, increasing complexity.
How do you install or deploy this agent?
Install via pip install -U agency-swarm. Requires Python 3.12+ and an OpenAI API key (set via environment variable OPENAI_API_KEY or a .env file).
How do you use this agent?
- Set
OPENAI_API_KEYin a.envfile. 2. Define tools using the@function_tooldecorator or aBaseToolsubclass. 3. CreateAgentinstances with name, description, instructions, tools, and model. 4. Create anAgencywith a CEO as the entry point and define communication flows (e.g.,ceo > dev). 5. Run viaagency.copilot_demo(),agency.tui(), or asyncawait agency.get_response("...").
FAQ
How does Agency Swarm differ from using the OpenAI Agents SDK directly?
Can I use this framework with models other than OpenAI?
Can conversation history be persisted?
load_threads_callback and save_threads_callback to the Agency, you can save and load conversation threads across sessions.