← Back to PRs

#7392: OpenResponses: tool output items, reasoning summary, opt‑in tool data cap + client tools fix

by lylepratt open 2026-02-02 19:33 View on GitHub →
docs gateway commands agents
## 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