mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-21 16:18:55 +00:00
fix(delegation): budget subagent summaries against parent context headroom
Batch delegation returned each subagent's full final_response verbatim into the parent's context. A fan-out of N children could dump 60k+ tokens at once, blowing the parent's context window and — on rate-limited providers — triggering a compression/429 death spiral (429 misread as context-too-large -> window step-down -> retry loop -> conversation dies). Cap each summary against the parent's *remaining* context headroom split across the batch (not a magic char count). When trimming, mirror the web_extract convention: spill the full text to cache/delegation (mounted into remote backends via credential_files._CACHE_DIRS) and return a head+tail window (75/25, line-snapped) plus a footer with the exact read_file offset to page the omitted middle. Both the subagent's opening AND its closing (outcomes / files-changed / issues, which live at the end) survive in-context, and nothing is lost — the parent can read_file the full version on any backend. delegation.max_summary_chars (default 24000) is a static ceiling layered on top as belt-and-suspenders for models that ignore 'be concise'; 0 disables it. Child prompt tightened to lead with outcomes / bullets. Co-authored-by: rc-int <rcint@klaith.com>
This commit is contained in:
parent
3b2bb30c5d
commit
35a0803a3b
5 changed files with 341 additions and 2 deletions
|
|
@ -2087,6 +2087,22 @@ DEFAULT_CONFIG = {
|
|||
"inherit_mcp_toolsets": True,
|
||||
"max_iterations": 50, # per-subagent iteration cap (each subagent gets its own budget,
|
||||
# independent of the parent's max_iterations)
|
||||
# Subagent summaries return to the parent's context verbatim. A batch
|
||||
# fan-out (N children) returns N summaries at once, which can exceed
|
||||
# the parent's context window and trigger a compression/429 death
|
||||
# spiral. delegate_task sizes each summary against the parent's
|
||||
# remaining context headroom (split across the batch); when it must
|
||||
# trim, the full text is spilled to ~/.hermes/cache/delegation/
|
||||
# (mounted into remote backends) and the in-context summary becomes a
|
||||
# head+tail window plus a footer with the exact read_file offset to
|
||||
# page the omitted middle — the same convention web_extract uses for
|
||||
# large pages. Nothing is lost. max_summary_chars is a hard per-summary
|
||||
# character ceiling layered on top of that dynamic budget
|
||||
# (belt-and-suspenders for models that ignore the "be concise"
|
||||
# instruction). 0 disables the hard ceiling; the dynamic headroom
|
||||
# budget still applies.
|
||||
"max_summary_chars": 24000,
|
||||
|
||||
"child_timeout_seconds": 0, # optional wall-clock cap per child agent. 0 (default)
|
||||
# = no timeout: children fail only from real errors
|
||||
# (API, tools, iteration budget), never a delegation
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue