Guide for migrating from Agency Swarm v0.x to v1.x (OpenAI Agents SDK based)
communication_flows
pathways for coordinated multi-agent executionoutput_type
@function_tool
decorator replaces BaseTool
classes for cleaner tool definitionsoutput_guardrails
and input_guardrails
replace the old response_validator
systemagents.Runner
from OpenAI Agents SDK for more controlThreadManager
and ConversationThread
managed via RunHooks
and shared MasterContext
Agent
class with Assistants API integrationagency_swarm.Agent
extends agents.Agent
, incorporating tools, subagent registration, and file handlingthreads_callbacks
dict → separate load_threads_callback
and save_threads_callback
parametersresponse_format
parameter: Now throws NotImplementedError
- must migrate to Agent-level output_type
response_validator
parameter: Completely removed from Agent class - must migrate to output_guardrails
get_response()
and get_response_stream()
are async and required await
For a concise overview, consult the table below. See the Step-by-Step Migration section for full details.
What you used in v0.x | Still works? | Action required in v1.x |
---|---|---|
get_completion() (sync) | Yes – kept for now | Nothing • Recommended: rename to await get_response() |
get_completion_stream() | No | Replace with await get_response_stream() (async only) |
response_format={...} | No | Delete this arg and set output_type=PydanticModel on the Agent |
response_validator=... | No | Move your logic to output_guardrails / input_guardrails |
threads_callbacks={...} (persistence) | No | Split into load_threads_callback & save_threads_callback and store full histories |
Upgrade your dependencies
Replace response_format
Move response_validator logic
Update streaming & async calls
Update Dependencies
requirements.txt
or pyproject.toml
using the installation commands in the Installation section above.Update Agency Constructor (Persistence)
threads_callbacks
dict → separate load_threads_callback
and save_threads_callback
parametersUpdate Agency Initialization
Update Agent Definitions
Convert Tools
Update Interaction Calls (Optional)
Update response validation
response_validator
parameter is completely removed from Agent class - See Breaking Changes for detailsoutput_guardrails
and input_guardrails
v0.x Method | v1.x Method (Recommended) | Status |
---|---|---|
agency_chart parameter | Positional arguments for entry points + communication_flows parameter | Deprecated but works |
threads_callbacks | load_threads_callback + save_threads_callback | Breaking change |
get_completion() | get_response() (async) | Backward compatible |
get_completion_stream() | get_response_stream() (async) | NotImplementedError |
agency_chart
parameter where standalone agents were entry points and lists defined communication pathscommunication_flows
parameterv0.x Parameter | v1.x Parameter | Notes |
---|---|---|
Individual model params (temperature , top_p , etc.) | model_settings=ModelSettings(...) | Individual params deprecated but still work |
response_validator | output_guardrails , input_guardrails | Completely removed |
examples | Prepended to instructions | Automatic migration with warning |
id , tool_resources | Removed | Use files_folder and upload_file instead |
v0.x | v1.x |
---|---|
BaseTool (Pydantic models) with run() method | @function_tool decorator (recommended) or direct FunctionTool instantiation (advanced) |
BaseTool
is temporarily retained for backward compatibility during migration.v0.x Pattern | v1.x Pattern |
---|---|
Various SendMessage variants | Automatic send_message tool (request-response) |
Manual handoffs | SDK handoffs parameter on agents (experimental) |
SendMessageQuick
, SendMessageAsyncThreading
, SendMessageSwarm
) are temporarily unavailable in v1.x until we reach feature parity.v0.x Method | v1.x Method |
---|---|
response_format={"type": "json_schema", ...} | output_type=PydanticModel on Agent |
get_completion(response_format=...) | Agent-level output_type configuration |
agency_chart
: Still works but deprecated; migrate to positional arguments and communication_flows
get_completion()
: Maintained as a synchronous wrapper; deprecated in favor of async get_response()
get_completion_stream()
: Not supported - raises NotImplementedError
; use async get_response_stream()
model_settings
BaseTool
: Temporarily retained for gradual migration to @function_tool
/examples
directory contains comprehensive examples demonstrating v1.x features and migration patterns:
two_agent_conversation.py
- Multi-agent communication with automatic thread isolationstreaming.py
- Real-time response streaming with proper event handlingfile_handling.py
- File processing and vision analysis using OpenAI’s built-in capabilitiesfile_search.py
- Vector store creation and FileSearch tool usage with automatic indexingfile_search_persistence.py
- Hosted tool output preservation across conversation turnsmulti_agent_workflow.py
- Complex multi-agent collaboration with validationresponse_validation.py
- Input and output guardrails implementation with tripwire triggerscustom_persistence.py
- Thread isolation and persistence across application restartschat_completion_provider.py
- Custom OpenAI Chat Completions model provider usage