Multi-Agent Handoff
QitOS supports multi-agent collaboration through Handoff — switching execution between agents. Handoff determines what context the target agent receives.Two Trigger Modes
Tool Mode (Delegation)
Triggered viaDelegateTool, suitable for temporary subtask delegation:
Illustrative fragment (not a standalone program; use the complete example linked on this page).
Decision Mode (Switch)
Triggered viaDecision.handoff(), suitable for formal agent transitions:
Illustrative fragment (not a standalone program; use the complete example linked on this page).
Context Strategies
Context strategies control how the source agent’s conversation history is passed to the target agent:FULL — Pass Everything
Pass the complete conversation history. Suitable when the target agent needs full context. Illustrative fragment (not a standalone program; use the complete example linked on this page).SUMMARY — Compressed (Default)
Compress older history into a summary, keeping the last 3 rounds intact. Prevents context explosion. Illustrative fragment (not a standalone program; use the complete example linked on this page).ISOLATED — Fresh Start
Pass only the system prompt and task description. The target agent starts fresh. Suitable for independent subtask execution. Illustrative fragment (not a standalone program; use the complete example linked on this page).SharedMemory
Multiple agents can share state throughSharedMemoryManager:
Illustrative fragment (not a standalone program; use the complete example linked on this page).
HandoffContext Fine-Grained Control
HandoffContext provides finer control beyond the context strategy:
Illustrative fragment (not a standalone program; use the complete example linked on this page).
Tracing
Handoff events are automatically recorded in the trace:HANDOFF_START— records source agent, target agent, context strategyHANDOFF_END— records target agent confirmation
TracingProvider enabled, handoff creates HandoffSpanData spans:
Illustrative fragment (not a standalone program; use the complete example linked on this page).
