#7392: OpenResponses: tool output items, reasoning summary, opt‑in tool data cap + client tools fix
docs
gateway
commands
agents
Cluster:
Error Handling in Agent Tools
## Why
OpenResponses consumers (e.g., Vercel AI SDK) need tool call/output items and reasoning surfaced in both streaming and final responses. We also need an opt-in path to include base64 tool payloads (screenshots/files) while keeping default behavior safe. Finally, client-supplied tools must reach the embedded runner so tools are actually callable.
## What
- Emit tool calls + tool outputs as `response.output_item.*` items in streaming and non-streaming responses.
- Stream reasoning items and map `reasoning.summary` to the `summary` field when requested.
- Add `gateway.http.responses.toolResultMaxDataBytes` to optionally include base64 tool output data (default stays “omit data”).
- Fix OpenResponses client tool propagation into the embedded runner so client tools are visible to the agent.
## How
- Maintain an output item list for the response and append `function_call`, `function_call_output`, and `reasoning` items as they occur.
- Sanitize tool results with an optional max decoded byte cap; emit `{ bytes, omitted: true }` when data is stripped.
- Extend schema to validate `function_call_output` items.
- Update `/v1/responses` docs to describe tool output items, reasoning output items, and the data cap.
- Add tests for reasoning summary + tool output items and tool result sanitization.
## Compatibility / Risk
- Backwards-compatible by default: tool base64 data remains stripped unless the new config is set.
- Reasoning output items are only emitted when reasoning is requested.
## Testing
- pnpm tsgo ✅
- pnpm format ✅
- pnpm lint ✅
- pnpm build ✅
- pnpm test ✅ (all tests passing)
## AI assistance
- [x] AI-assisted (Codex 5.2 High). I (@lylepratt) understand the changes and heavily tested during development.
- [x] Testing performed (full local suite listed above).
## Formatting-only changes
- CHANGELOG.md: escaped `*` in tool allowlist entry (formatter/lint).
- docs/zh-CN/*: table alignment/whitespace adjustments only (formatter/lint - no semantic changes).
## Companion Vercel AI SDK Provider for OpenClaw
- https://www.npmjs.com/package/@vida-global/openclaw-ai-sdk-provider
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
PR adds richer OpenResponses streaming output by emitting tool call / tool output items and optional reasoning items, plus an opt-in cap for including base64 tool-result `content[].data` via `toolResultMaxDataBytes`. It threads new options through the gateway handler into `agentCommand`, expands Zod schemas/parity tests for the new output item type, and updates docs to describe the new events and config.
<h3>Confidence Score: 4/5</h3>
- This PR is likely safe to merge, with a couple of correctness/docs mismatches worth fixing.
- Core changes are additive (new output item emission + optional config) and covered by updated e2e/parity tests, but there’s a real config validation mismatch (`toolResultMaxDataBytes` rejecting 0) and a misleading docs section about `reasoning` being ignored. *(Note from @lylepratt: This has been addressed in a subsequent commit)*
- src/config/zod-schema.ts, docs/gateway/openresponses-http-api.md
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#11210: Harden Tool-Call Streaming Parser for OpenAI-Completions Backends (...
by ga-it · 2026-02-07
75.9%
#4445: fix: resolve Antigravity "unsupported version" and tool_use schema ...
by harry2690 · 2026-01-30
75.8%
#19094: Fix empty tool_call_id and function names in provider transcript pa...
by yxshee · 2026-02-17
75.1%
#10975: fix: add missing clientTools parameter to runEmbeddedAttempt call
by xamdel · 2026-02-07
75.0%
#10915: fix: prevent session bloat from oversized tool results and improve ...
by DukeDeSouth · 2026-02-07
74.6%
#9339: fix: enhance OpenAI compatibility for tool calling
by 0xrushi · 2026-02-05
74.5%
#10367: CLI/Ops: resilient browser fill + failover hardening + operations t...
by cluster2600 · 2026-02-06
74.1%
#21195: fix: suppress orphaned tool_use/tool_result errors after session co...
by ruslansychov-git · 2026-02-19
73.9%
#19024: fix: Fix normalise toolid
by chetaniitbhilai · 2026-02-17
73.8%
#19326: Agents: improve z.ai GLM-5 integration and failover
by gabrielespinheira · 2026-02-17
73.7%