Repository navigation
Description
Summary
inference-gateway/cli#1465 (closes inference-gateway/cli#1456) lets the main agent message a headless subagent at runtime. The CLI page documents subagents as interactive-first with SendSubagentInput as a tmux-only tool, and the headless flag list does not know the new flag. Document the new behaviour and correct the defaults the page states.
User-facing changes to document:
infer headless --keep-alive: after the task, eachrun_agent_inputframe read on stdin runs as a further turn in the same session, every finished turn is reported as onesubagent_turnline on stdout (the--result-fileJSON shape plus"type": "subagent_turn"anddone), and stdin EOF ends the run.--format textand--serveare rejected with it. The Agent tool spawns its async headless subagents this way.- Headless subagent lifecycle: one
[Subagent Completed: <label>]note per finished turn ([Subagent Failed: <label>]for a turn that errored), the subagent stays alive idle untiltools.agent.idle_timeoutseconds pass and it is closed with one[Subagent Closed: <label>]note,0disables the auto-close. There is no[Subagent Idle]warning for headless subagents.CloseSubagentstops an idle or running one. An idle subagent does not keep a headless parent alive. SendSubagentInputworks for both modes:textis the message, run as the subagent's next turn (queued if it is mid-turn) with a new completion note when it ends.keysandsubmit=falsedrive an interactive pane's TUI and fail for a headless subagent.tools.agent.wait: trueis unchanged: a blocking subagent returns its first turn and is not kept alive.- Run stats in the completion note cover every turn of the subagent session.
- The
--servedescription on the page says "one run peruser_message". The frame isrun_agent_input(the headless help text in the CLI was fixed in the same PR).
Affected pages (cli.md):
- "Local Subagents (Agent tool)": the result modes, execution surfaces and "Done signal and idle auto-close" subsections, the config block comment on
idle_timeout, and theidle_timeoutparagraph. The page stateswait: trueandmode: interactiveas the shipped defaults. The CLI'sDefaultConfig()shipswait: falseandmode: headless, so align the defaults while editing. - "Headless Agent Stream Output" flag list and the "Serve worker" row of the command table: add
--keep-alive, fixuser_messagetorun_agent_input. - The
--result-fileparagraph: the Agent tool now uses it only for interactive (tmux pane) subagents.
Source of truth in the CLI repo: docs/subagents.md (new "Headless Subagents" section), docs/commands-reference.md (--keep-alive), docs/configuration-reference.md (tools.agent.wait, tools.agent.idle_timeout), docs/tools-reference.md (tool table), and the SendSubagentInput, Agent and CloseSubagent tool manifests under internal/tools/.
Example to add under the headless flags:
infer headless --keep-alive --session-id sub-1 "Review the auth module" <<'FRAMES'
{"type":"run_agent_input","input":{"messages":[{"id":"m2","role":"user","content":"Also cover the token refresh path"}]}}
FRAMESEach turn prints a line like:
{"type":"subagent_turn","final_assistant":"...","success":true,"session_id":"sub-1","done":true,"stats":{"tools_succeeded":3,"tools_failed":0,"input_tokens":1200,"output_tokens":80}}Source PR: inference-gateway/cli#1465
Source issue: inference-gateway/cli#1456
Acceptance Criteria
- cli.md documents
infer headless --keep-alive, thesubagent_turnline and the rejected flag combinations, with the example above. - The Local Subagents section describes the headless keep-alive lifecycle (per-turn completion notes, idle close with
tools.agent.idle_timeout,CloseSubagent) and statesSendSubagentInputworks for both modes withkeysandsubmit=falseinteractive-only. - The stated defaults match the CLI:
tools.agent.wait: falseandtools.agent.mode: headless. -
--serveis described as one run perrun_agent_inputframe, and the--result-fileparagraph names interactive subagents only. - The page links back to feat(tools): let the main agent message a headless subagent at runtime cli#1465.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
edenreich commentedon Oct 1, 2026
@claude can you document this?
inference-gateway-maintainer commentedon Oct 1, 2026
Claude finished @edenreich's task in 6m 57s —— View job •
docs/issue-894-20261001-2239Documented headless keep-alive subagents
subagents.md,commands-reference.md,configuration-reference.md,ag-ui-output.md,tools-reference.md,config/config.goon the PR branch)infer headless --keep-alive+subagent_turnline + rejected flag combinations, with the exampleCloseSubagent,SendSubagentInputboth modes)wait: false,mode: headless, plusmax_parallel: 10)--servetorun_agent_inputand scope--result-fileto interactive subagentslint:md,format:check,buildall passWhat changed in
cli.md#### Keeping the session alive (--keep-alive)run_agent_inputframes on stdin, thesubagent_turnstdout line, stdin EOF ending the run,--format text/--serverejected, plus the heredoc example from the issue#### Headless keep-alive lifecycle[Subagent Completed]note per finished turn ([Subagent Failed]on error),SendSubagentInputfollow-ups queued mid-turn, idle close viaidle_timeoutwith no[Subagent Idle]warning,CloseSubagent, idle subagent does not keep a headless parent alive;SendSubagentInputworks in both modes withkeys/submit: falseinteractive-onlymode: headless,wait: false,max_parallel: 10- verified againstDefaultConfig()in the CLI'sconfig/config.go, not just the docs--result-file--keep-alive--serverun_agent_inputframe - also fixed the staleuser_messagein the example, the stdin-frames table and the shutdown paragraph so the section is self-consistentDone signal and idle auto-closerenamed to... (interactive panes), inbound link updatedTwo things worth flagging
AGENTS.mdforbids referencing GitHub issues or PRs in doc content. I put the link in the PR body instead of incli.md- say the word if you want it in the page anyway.user_message. That is the daemon binding, a different surface, so I did not touch it.Create a PR - already opened as #895.
| Branch | PR #895
feat(tools): let the main agent message a headless subagent at runtime (
inference-gateway-releaser commentedon Oct 4, 2026
🎉 This issue has been resolved in version 0.9.21 🎉
The release is available on GitHub release
Your semantic-release bot 📦🚀