feat(FN-1950): add list_agents and delegate_task agent delegation tools

- Add list_agents tool for discovering agents by role, state, or includeEphemeral filter
- Add delegate_task tool for assigning work to a specific agent by ID
- Add comprehensive test coverage for both delegation tools in agent-tools-delegation.test.ts
- Update executor.ts to wire up delegation tools when agentStore is configured
- Document both tools in AGENTS.md and docs/agents.md
This commit is contained in:
Fusion
2026-04-16 13:17:17 -07:00
committed by gsxdsm
parent 18722ae361
commit 222a807dc2
7 changed files with 545 additions and 6 deletions

View File

@@ -296,6 +296,15 @@ Behavior:
- `maxSpawnedAgentsGlobal` (default 20)
- Child sessions terminate when parent task ends
## Agent Delegation
Executor and heartbeat agents can discover and delegate work to other agents using two built-in tools:
- **`list_agents`** — List available agents with optional filters (role, state, includeEphemeral)
- **`delegate_task`** — Create a task and assign it to a specific agent; the task enters `todo` and the agent picks it up on their next heartbeat
Delegation is designed for cross-agent handoff (e.g., an executor handing off to a QA agent). For parallel worktree-based parallelization, use `spawn_agent` instead.
## Heartbeat Monitoring and Trigger Scheduling
Fusion's `HeartbeatTriggerScheduler` supports five trigger types: