Understanding agencies in Agency Swarm.
Agent
instances based on a defined structure. It provides enhanced thread management, persistence hooks, and improved communication patterns between agents.Agency
class:Name | Parameter | Description |
---|---|---|
Entry Points | *entry_points_args | Positional arguments representing Agent instances that serve as entry points for external interaction. These agents can be directly messaged by users. |
Communication Flows (optional) | communication_flows | List of (sender, receiver) tuples defining allowed agent-to-agent message paths. Example: [(ceo, dev), (ceo, va)] . Default: None |
Name (optional) | name | A name for the agency instance. Default: None |
Shared Instructions (optional) | shared_instructions | Instructions prepended to all agents’ system prompts. Default: None |
Send Message Tool Class (optional) | send_message_tool_class | Custom SendMessage tool class to use for all agents that don’t have their own send_message_tool_class set. Enables enhanced inter-agent communication patterns. Default: None |
Load Threads Callback (optional) | load_threads_callback | A callable to load conversation threads for persistence. Default: None |
Save Threads Callback (optional) | save_threads_callback | A callable to save conversation threads for persistence. Default: None |
User Context (optional) | user_context | Initial shared context accessible to all agents during runs. Default: None |
agency_chart
- Use positional entry points and communication_flows
insteadshared_files
- Shared file handling is not currently implementedasync_mode
- Asynchronous execution is handled by the underlying SDKsettings_path
& settings_callbacks
- Responses SDK is now stateless, so agency settings are no longer needed.threads_callbacks
- Use load_threads_callback
and save_threads_callback
directlytemperature
, top_p
, etc.) - Set these on individual Agent instances