--- name: agent-orchestration description: How to use the agent registry, leases, and orchestrator for multi-agent workflows tags: [agents, orchestration, delegation, leases] category: system --- ## Steps 1. **Agent Registry:** - agent-list — list all registered agents (ID, type, capabilities, status) - agent-register — register a new agent (capabilities: comma-separated like "code,research") - agent-unregister — remove an agent - agent-status — detailed status including uptime, task history 2. **Leases (time-bound contracts):** - lease-create — create a lease with watchdog timer - lease-list — show active leases with remaining TTL - lease-revoke — terminate a lease early - lease-renew — extend a lease 3. **Orchestrator (spawn, delegate, kill):** - orchestrator-spawn — spawn a new agent automatically (registers + creates lease) - orchestrator-kill — kill an agent (revokes lease + unregisters) - orchestrate — list all active agents with their orchestrator state - orchestrator-purge — kill all idle/expired agents - orchestrator-status — full system status: active, idle, dead agents 4. **AI tool integration:** - AI tools list_agents, delegate_task, spawn_agent are available in the AI system prompt - The AI can auto-spawn worker agents for sub-tasks - Each agent gets its own VFS workspace at /agents// 5. **When to use:** - User needs parallel task execution → orchestrator-spawn coder + researcher - Time-bound automation → lease-create with short TTL - System cleanup → orchestrator-purge to kill stale agents