0.5.0
What's Changed
Core Improvements
- Reworked core Swarm API to be fully stateless for better composability
- Added type-safe structured outputs with Pydantic model support
- Implemented new events for managing agent flow (activate, begin, complete, response)
- Added TypeVar type checking trick for Pydantic bound generics
- Introduced parse response method for handling partial/full agent responses
Developer Experience
- Added chat components built on top of Swarm and SwarmTeam
- Simplified field names and event model naming for consistency
- Improved type safety around response formats
- Added new examples showcasing chat and team chat functionality
- Enhanced documentation with stateless architecture examples
Breaking Changes
- Swarm is now fully stateless - state management moved to Chat components
- SwarmTeam redesigned to be stateless with streaming API support
- Event handling requires using new event types
- get_result renamed to get_return_value for ReturnableAsyncGenerator
Migration Notes
# Before - Stateful Swarm
swarm = Swarm()
swarm.add_message(Message(role="user", content="Hello"))
result = await swarm.execute(agent)
# After - Stateless Swarm with Chat
chat = LiteChat()
stream = chat.send_message("Hello", agent=agent)
result = await stream.get_return_value()
# Before - Stateful SwarmTeam
team = SwarmTeam(swarm=swarm, members=members, task_definitions=task_definitions)
session = await team.create_session()
result = await session.execute_plan(plan)
# After - Stateless SwarmTeam with Chat
team_chat = LiteTeamChat(swarm=swarm, members=members, task_definitions=task_definitions)
stream = team_chat.send_message("Create a web app")
result = await stream.get_return_value()
Removed
- Obsolete MessageStore, ContextManager, EventHandler components
- Redundant unwrap utils and ambiguous messages file
- Deprecated types and components
- Session management from chat components
Contributors
Thanks to:
Full Changelog: 0.4.0...0.5.0