Repository navigation
feat(streaming): expose builtin tool start chunks to stream consumers - #1133
Merged
mikehostetler merged 2 commits intoOct 22, 2026
Merged
Conversation
The Responses API emits a `builtin_tool_started` meta chunk when a
server-side builtin call (e.g. `web_search_call`) is added to the output,
but StreamServer dropped it after recording OTel timing. Consumers only
saw the finished call, so there was no way to show that a web search was
in flight.
Keep the chunk on the public stream as
`builtin_tool_started: %{id, name, index}` — the counterpart of the
existing finished builtin `:tool_call` chunk. The internal
`started_at_unix_nano` timestamp is still stripped, and the key stays out
of the merged stream metadata.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The OpenAI Responses API decoder emits a
builtin_tool_startedmeta chunk when a server-side builtin call (for exampleweb_search_call) is added to the output.StreamServerused it only to record OTel builtin-tool timing, then dropped it from the public stream. Consumers saw the call only when it finished, so they had no way to show that a web search was in progress.This keeps the chunk on the public stream as:
It's the counterpart of the existing finished builtin
:tool_callchunk, which carries the samemetadata.id.started_at_unix_nanotimestamp is still stripped before the chunk reaches consumers.builtin_tool_startedstays out of the merged stream metadata returned byawait_metadata/2.builtin_tool_timingis unchanged.guides/openai.mdnow documents the chunk next to the existing builtin tool call notes.Type of Change
Breaking Changes
None intended. Streams that use OpenAI Responses builtin tools now include one extra
:metachunk per builtin call. Consumers that match only on:content,:thinking, or:tool_callchunks are unaffected. A consumer that treats every:metachunk as usage or finish metadata will now also see this one.Testing
mix test):REQ_LLM_FIXTURES_MODE=replay mix test, 5345 tests, 0 failures, 11 skippedmix quality): format,compile --warnings-as-errors,credo --strict, dialyzer (0 errors)test/req_llm/stream_server/telemetry_test.exsnow asserts that the public start chunk carries onlyid/name/index, and thatbuiltin_tool_starteddoesn't leak into the merged metadata. The test also still checks the existing builtin timing behavior.Checklist
CHANGELOG.md(it is auto-generated by git_ops)Related Issues
None.
🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need.