Skip to content

feat: opt-in multi-tool-call relay responses - #14

Open
Shifat7 wants to merge 1 commit into
clutchpbcfo:mainfrom
Shifat7:pr-07-multi-tool-calls
Open

Shifat7 wants to merge 1 commit into
clutchpbcfo:mainfrom
Shifat7:pr-07-multi-tool-calls

Conversation

@Shifat7

@Shifat7 Shifat7 commented Aug 22, 2026

Copy link
Copy Markdown

What changed

Allows Hyperagent to request multiple independent Codex tool calls in one response, cutting one full Hyperagent round-trip per call down to one:

  • Relay JSON {"type":"function_calls","calls":[{name,arguments},…]} accepted only when enableMultiToolCalls: true (default off).
  • Every call validated against forwarded function tools; any unavailable name → whole response degrades to a plain final answer naming the tool. No partial execution.
  • Exceeding maxToolCallsPerResponse (default 3) → safe final answer with the counts.
  • Valid multi-calls render as multiple Responses function_call items with deterministic suffixed call_ids (call_x_0, call_x_1…) over SSE and non-streaming JSON; audit outputType becomes function_calls.
  • Disabled path is byte-identical to today: the JSON falls through to the existing plain-text fallback.

Why it saves credits

One Hyperagent request can fan out several local reads/commands instead of burning a thread per tool call.

Testing

npm test: 79 pass, 0 fail (3 pre-existing skips). New tests cover parse/validation/fail-safe paths, inert-when-disabled (incl. legacy two-arg callers), SSE + non-streaming rendering with distinct call ids, and an end-to-end streaming bridge test.

Accept type:function_calls relay output when enableMultiToolCalls is
true: every call is validated against forwarded function tools and the
whole response fails safely to a final answer on any unavailable name
or when maxToolCallsPerResponse is exceeded. Valid multi-calls render
as multiple Responses function_call items with distinct suffixed
call_ids over SSE and non-streaming output.

Default remains disabled; single-tool behaviour is unchanged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant