This came unexpected!
@OpenAI released Swarm, a lightweight library for building multi-agent systems. Swarm provides a stateless abstraction to manage interactions and handoffs between multiple agents and does not use the Assistants API. đ€
How it works:
1ïžâŁ Define Agents, each with its own instructions, role (e.g., "Sales Agent"), and available functions (will be converted to JSON structures).
2ïžâŁ Define logic for transferring control to another agent based on conversation flow or specific criteria within agent functions. This handoff is achieved by simply returning the next agent to call within the function.
3ïžâŁ Context Variables provide initial context and update them throughout the conversation to maintain state and share information between agents.
4ïžâŁÂ Client run() initiate and manage the multi-agent conversation. It needs an initial agent, user messages, and context and returns a response containing updated messages, context variables, and the last active agent.
Insights:
đ Swarm manages a loop of agent interactions, function calls, and potential handoffs.
đ§© Agents encapsulate instructions, available functions (tools), and handoff logic.
đ The framework is stateless between calls, offering transparency and fine-grained control.
đ ïž Swarm supports direct Python function calling within agents.
đ Context variables enable state management across agent interactions.
đ Agent handoffs allow for dynamic switching between specialized agents.
đĄ Streaming responses are supported for real-time interaction.
đ§Ș The framework is experimental. Maybe to collect feedback?
đ§ Flexible and works with any OpenAI client, e.g., Hugging Face TGI or vLLM-hosted models.