Appearance
Migrating to SwarmForge v5
SwarmForge v5 is a major release that makes the swarm graph the single source of routing truth. If you upgrade from v4.x, read this page before deploying.
Upgrade
bash
pip install --upgrade "swarmforge>=5.0.0"If you use the FastAPI transport:
bash
pip install --upgrade "swarmforge[api]>=5.0.0"Breaking changes
1. Declared edges only
The runtime no longer invents routes. These implicit behaviors from v4 are removed:
- automatic return to the calling parent agent
- automatic fallback route back to the entry node
Only edges declared in your graph are routable. If a specialist must return to the entry router or hand off to another specialist, declare that edge in sub_agents or edges.
Migration helper for graphs that relied on implicit return-to-entry behavior:
python
swarm = swarm.with_return_edges()2. Stricter behavior_config validation
Invalid values in SwarmNodeBehaviorConfig now raise a clear ValueError naming the field, bad value, and allowed set. v4 silently reset unknown enum values to defaults.
Validate configs during authoring or tests before deployment.
3. required_variables enforced on every declared route
Handoffs always resolve a declared edge. Missing edges are rejected, and required_variables are checked for every valid transfer.
4. Evaluation path-finding matches runtime reachability
Scenario feasibility no longer assumes an implicit reroute through the entry node. Paths such as billing -> triage -> faq require an explicit billing -> triage edge.
5. Shared constants for runtime identifiers
Import named constants instead of matching raw strings:
python
from swarmforge.swarm import HANDOFF_TOOL_NAME, EVENT_HANDOFF, EVENT_DONESee swarmforge.swarm.constants for the full set.
6. Stricter graph validation
validate_swarm_definition(...) now also rejects:
- duplicate node
idvalues - nodes unreachable from the entry node
Authoring updates
- Generated swarms must declare return edges explicitly. See
META_PROMPT_SWARMinswarmforge.authoring. /generate_edgeis available as a skill for authoring individual handoff edges.- Runtime handoff policy is centralized in
swarmforge.swarm.promptingand references the real entry node name instead of hardcoded"triage".
Suggested migration checklist
- Upgrade to
swarmforge>=5.0.0. - Audit multi-agent graphs for specialists that hand back to entry or cross-specialist without declared edges.
- Run
swarm.with_return_edges()or add explicit return edges where needed. - Re-run evaluation scenarios that assumed implicit reroute via the entry node.
- Replace raw string checks for handoff tool names and stream events with
swarmforge.swarm.constants.