Agency Class
The Agency class orchestrates a collection of Agent instances based on entry points and communication flows.Note:CommunicationFlowEntryis a type alias defined inagency_swarm.agency.corethat accepts(Agent, Agent)tuples,AgentFlowchains, or those accompanied by a custom SendMessage tool class.
Key Attributes
agents(dict[str, Agent]): Dictionary mapping agent names to their instancesentry_points(list[Agent]): Agents designated as entry points for external interactionthread_manager(ThreadManager): Manager responsible for handling conversation threadsevent_stream_merger(EventStreamMerger): Aggregates streaming events from concurrent agent runspersistence_hooks(PersistenceHooks | None): Optional hooks for loading/saving thread stateshared_instructions(str | None): Instructions prepended to every agent’s system promptshared_tools(list[Tool] | None): Tool instances or BaseTool classes shared with all agentsshared_tools_folder(str | None): Path to folder containing shared tool filesshared_files_folder(str | None): Path to folder of files shared via a common vector storeshared_mcp_servers(list[Any] | None): MCP server instances attached to all agentsuser_context(dict[str, Any]): Shared user-defined context accessible within MasterContextsend_message_tool_class(type | None): Fallback SendMessage tool when no flow-specific tool is set
Key Methods
Agent Class
The Agent class extends the baseagents.Agent with capabilities for multi-agent collaboration within an Agency.
Key Attributes
files_folder(str | Path | None): Local folder for file management and vector storestools_folder(str | Path | None): Directory for automatic tool discovery and loadingschemas_folder(str | Path | None): Folder scanned for OpenAPI schemas to auto-generate toolsapi_headers/api_params(dict): Per-schema metadata applied when generating toolsdescription(str | None): Agent role description for dynamic send_message toolsinclude_search_results(bool): Whether FileSearchTool responses include citation contextvalidation_attempts(int): Retry count for output guardrail enforcementthrow_input_guardrail_error(bool): Controls input guardrail mode—False for friendly (guidance as assistant), True for strict (raises exceptions)handoff_reminder(str | None): Custom reminder appended to handoff promptstool_concurrency_manager(ToolConcurrencyManager): Coordinates concurrent tool execution