Skip to main content

llm-stream-check

Your agent didn't forget the tool call. Your stream parser threw it away.

We replayed one recorded Gemini response through 21 OpenAI-compatible stream parsers. The response holds two parallel tool calls (get_weather for Taipei and for Kaohsiung), recorded from Google's OpenAI-compatible endpoint, the one Google documents for use with OpenAI client libraries. 16 of the 21 parsers lost something:

  • 8 merged the two calls into one. LiteLLM, OpenAI Agents SDK, AutoGen, CrewAI, LlamaIndex, Strands (both its OpenAI and LiteLLM models) and smolagents on LiteLLM handed back a single get_weather call whose arguments were {"city":"Taipei"}{"city":"Kaohsiung"}. That is not JSON. LlamaIndex also renamed the call get_weatherget_weather. Strands parsed the broken string to {} and handed on one call with no arguments.
  • 1 dropped both. agno ran neither tool.
  • 5 crashed. openai-python's chat.completions.stream(), openai-node, the Vercel AI SDK's @ai-sdk/openai chat model, Haystack and smolagents threw on the missing index.
  • 2 kept the calls but tripled the bill. LangChain and Pydantic AI reported 222 input tokens for a request that used 74, because Gemini repeats the running usage on every chunk and both frameworks add them up.

The cause is one field. OpenAI's stream tags every tool call fragment with an index. Gemini's OpenAI endpoint and Mistral leave it out. Most parsers key their accumulator on that index, so every call lands in slot None (or slot 0) and gets glued to the one before it. Nobody tested with a real response from the provider they claim to support. The agent logs show one tool call, the model gets blamed for "forgetting" the other, and the fix is a few lines in the parser.

It is not only missing indexes. LlamaIndex's OpenAI integration reads only the first tool call in each chunk (utils.py: tc_delta = tool_calls_delta[0]), so a recorded Mistral response with three parallel calls in one chunk comes out as one. AutoGen's Anthropic client reports 699 input tokens for a request Anthropic billed at 1,630, because it never reads the input count Anthropic restates in message_delta when server-side tool search runs.

The same bug was in our own merged work before this: rust-genai#347 dropped every tool call after the first in a chunk.

What it does

llm-stream-check replays 243 recorded provider streams through your framework's own streaming code and fails on anything lost on the way:

loss meaning
dropped_tool_call a call in the stream never reached your code
merged_tool_calls two or more calls came out as one
corrupted_tool_call right number of calls, wrong name or arguments
phantom_tool_call your code got a call the model never made
wrong_tool_call_id the id your next turn must send back is not the one the provider sent
lost_usage / wrong_usage the provider reported token usage and your code got none, or a different number
error the framework raised on a recorded, well-formed provider stream

It fails closed: any loss, any crash, any adapter you asked for that is not installed, exits nonzero. There is no "warn" mode.

Every stream is a real recording, never a hand-written fixture. They come from cassettes and fixtures in public repos (Pydantic AI's VCR cassettes, the Vercel AI SDK's recorded chunk fixtures, openai-python's and anthropic-sdk-python's streaming snapshots, Simon Willison's llm-gemini and llm-anthropic cassettes), each kept byte for byte with a permalink to the file at a pinned commit. Fixtures whose names or ids show they were typed by hand (msg_1, toolu_1, "spliced", "malformed") are excluded. Files that hold several responses of one multi-step run are split back into one stream per response.

protocol streams shapes covered
OpenAI Chat Completions 38 parallel calls, arguments split mid-JSON, empty deltas, usage-only final chunk, calls with no index, several calls in one chunk, name and arguments in one chunk; OpenAI, Mistral, Groq, DeepSeek, xAI, Alibaba, Moonshot, OpenRouter, Gemini's OpenAI endpoint
OpenAI Responses 26 split arguments, reasoning items before the call (output index gaps); OpenAI, Azure, Bedrock, LM Studio, DeepSeek, the ChatGPT Codex backend
Anthropic Messages 169 parallel tool_use, split input_json_delta, empty deltas, ping, thinking blocks, tool blocks after text (index gaps), calls with no input, server tool search mixed with client tools
Gemini streamGenerateContent 10 calls across chunks, usage-only final chunk, thought signatures, calls with no arguments

Use it

pip install llm-stream-check
llm-stream-check adapters          # which frameworks it found in this environment
llm-stream-check run               # replay the corpus through every installed one; exit 1 on any loss
llm-stream-check run --adapter langchain-openai --json report.json

run starts a local replay server, points each framework's base URL at it and reads back only the framework's public result fields. No API key, no network, no model calls.

For a stack in another language, serve the corpus and check what your code produced:

llm-stream-check serve --port 8765 &
node harness/js/run.mjs http://127.0.0.1:8765 observed.jsonl   # Vercel AI SDK, openai-node, anthropic-sdk-typescript, LangChain.js
llm-stream-check check observed.jsonl --json report.json

In CI, run it in the environment your agent ships with. A framework upgrade that starts merging calls fails the build instead of showing up as an agent that "sometimes forgets".

Results

48 adapters across 22 projects (Python and JavaScript), 3,804 stream replays. Full table and every loss with its recording: docs/results.md. How to rebuild the environments: docs/matrix.md.

Clean on every recorded stream they speak: the official Anthropic SDKs (Python and TypeScript), google-genai, Pydantic AI on Anthropic, Gemini and Responses, Google ADK, Microsoft Agent Framework, LlamaIndex on Anthropic and Gemini, Haystack on Anthropic and Gemini, Strands on Anthropic and Gemini, llm with llm-anthropic, the Vercel AI SDK on Anthropic, Gemini and Responses.

Fixes for the losses above are going upstream as pull requests, each with the recorded stream as its test.

Adapters

Run llm-stream-check adapters for the list. Each adapter drives the framework's documented streaming entry point (for example ChatOpenAI.stream() summed chunk by chunk, litellm.stream_chunk_builder(), OpenAIChatCompletionsModel.stream_response()) and records what the framework returned. Frameworks that only expose tool calls by running them (agno) are driven as real agents, and the run records which tools the agent actually executed. To add one, write run(case, base_url) -> Observed in src/llm_stream_check/adapters/ and register it.

Rebuilding the corpus

tools/build_corpus.py rebuilds the corpus from sparse clones of the source repositories and pins each case to the commit it came from. The reference parser (llm_stream_check.reference) follows each provider's documented wire format; the test suite checks that it reproduces every stored expectation, and the reference adapter replays the whole corpus over HTTP with zero losses.

License

MIT. The recorded streams keep the licenses of the repositories they come from (MIT and Apache-2.0); each case links its source.

Metadata

Release files for llm-stream-check 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for llm-stream-check 0.1.0
File Size Uploaded Provenance Actions
llm_stream_check-0.1.0.tar.gz 212.0 kB With provenance Details for llm_stream_check-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for llm-stream-check 0.1.0
File Interpreter ABI Platform Actions
llm_stream_check-0.1.0-py3-none-any.whl Python 3 none any Details for llm_stream_check-0.1.0-py3-none-any.whl

Total release size: 700.7 kB

Release files / llm_stream_check-0.1.0.tar.gz

Download URL llm_stream_check-0.1.0.tar.gz
Size 212.0 kB
Tags Source
SHA-256 checksum
How to use checksums
d40a339966f4b3922db4ad3bf8287b6732102037367b8970d4b5cb81127529a3
BLAKE2b-256 checksum
How to use checksums
26c6e4eef6d91949e2e3d2c0d5b49b2dfcdafbd138eb69731dfb4365b5833556
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

Release files / llm_stream_check-0.1.0-py3-none-any.whl

Download URL llm_stream_check-0.1.0-py3-none-any.whl
Size 488.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4d900213c49714a05857a5c541e0b92174c5615ac1eeb2ec440108bb8f7e2d70
BLAKE2b-256 checksum
How to use checksums
2321902ac5ecd903c87271c0e05db52e5aaec58cb1e76cbc663dbec0c8ffb36c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

Security for llm-stream-check 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for llm_stream_check-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page