fix(hermes): delegate through Hermes' public subagent lifecycle instead of nested delegate_task (#803)

agency_agents_delegate previously nested delegate_task through ctx.dispatch_tool(), which returns error JSON as a string instead of raising — so the router reported delegated: true with {"error": "delegate_task requires a parent agent context."} and never delegated (#802, #838). It now launches the specialist through ctx.subagent_lifecycle (upstream hermes-agent PR #72501): bounded wait, cooperative cancel on timeout, honest delegated: false + fallback prompt on launch/terminal failure, 32,000-char context cap, toolsets option removed. Kept in scripts/build-hermes-plugin.py so regeneration preserves it; six behavior tests in scripts/test-hermes-plugin.py.

Verified live in an isolated Hermes git-main (v0.21.0) box on local Qwen: main plugin -> delegated: true with the error string in 0.01 s; this plugin -> real child session, real result.

Fixes #802. Fixes #838.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
wnwhermes
2026-09-05 12:32:07 -05:00
committed by GitHub
co-authored by Claude Fable 5.1
parent af128a9288
commit 80b338fea8
3 changed files with 263 additions and 23 deletions
+2 -2
View File
@@ -14,7 +14,7 @@ Generated agent count: 273
- `agency_agents_search` — find matching specialists by query/division.
- `agency_agents_inspect` — inspect one specialist's metadata or full body.
- `agency_agents_load` — compose one specialist prompt for the current task.
- `agency_agents_delegate` — delegate through Hermes `delegate_task` when available.
- `agency_agents_delegate` — delegate through Hermes' public subagent lifecycle.
Each tool is registered with Hermes' complete function-tool schema, including
its name, description, and JSON `parameters`. The available arguments are:
@@ -24,7 +24,7 @@ its name, description, and JSON `parameters`. The available arguments are:
| `agency_agents_search` | `query` (required), optional `division` and `limit` |
| `agency_agents_inspect` | `agent` or `slug`, optional `include_body` |
| `agency_agents_load` | `agent` or `slug`, optional `task` |
| `agency_agents_delegate` | `agent` or `slug`, `task` (required), optional `toolsets` |
| `agency_agents_delegate` | `agent` or `slug`, `task` (required) |
A normal flow is: search by capability, take a returned `slug`, then inspect,
load, or delegate to that specialist. You can ask Hermes to do this in natural