✓ PASS
pydantic-ai 2.61.0
truncation.text-stream · anthropic
Requirements
| Id | Level | Status | Evidence |
|---|---|---|---|
| cause-is-truncation | MUST | SATISFIED | finish.value="length" (primary: ModelResponse.finish_reason); truth.finish="length"; error.category=null; structured.returned_as_success=false |
| text-reported | SHOULD | SATISFIED | text.value="Octopuses change colour by" (primary); truth.text="Octopuses change colour by" |
| usage-reported | SHOULD | SATISFIED | usage.output=16 (primary); truth.usage.output=16 |
What the provider sent
- Finish
- length
- Raw finish
- max_tokens
- Text
- Octopuses change colour by
- Tool calls
[]
- Usage
{ "alternatives": {}, "cached_input": null, "input": 25, "output": 16, "raw": { "input_tokens": 25, "output_tokens": 16, "output_tokens_details": { "thinking_tokens": 8 } }, "reasoning": 8, "total": 41 }- Stream completed
true
- Error
null
Wire excerpt
status: 200
content-type: text/event-stream
body (sse):
event: message_start
data: {"type": "message_start", "message": {"id": "msg_01Aq9w938a90dw8q", "type": "message", "role": "assistant", "content": [], "model": "claude-sonnet-5-5", "stop_reason": null, "stop_sequence": null, "usage": {"input_tokens": 25, "output_tokens": 1}}}
event: content_block_start
data: {"type": "content_block_start", "index": 0, "content_block": {"type": "thinking", "thinking": "", "signature": ""}}
event: ping
data: {"type": "ping"}
event: content_block_delta
data: {"type": "content_block_delta", "index": 0, "delta": {"type": "thinking_delta", "thinking": ""}}
event: content_block_delta
data: {"type": "content_block_delta", "index": 0, "delta": {"type": "signature_delta", "signature": "EqQBCgIYAhIM1gbcDa9GJwZA2b3hGgxBdjrkzLoky3dl1pkiMOYds..."}}
event: content_block_stop
data: {"type": "content_block_stop", "index": 0}
event: content_block_start
data: {"type": "content_block_start", "index": 1, "content_block": {"type": "text", "text": ""}}
event: content_block_delta
data: {"type": "content_block_delta", "index": 1, "delta": {"type": "text_delta", "text": "Octopuses "}}
event: content_block_delta
data: {"type": "content_block_delta", "index": 1, "delta": {"type": "text_delta", "text": "change colour by"}}
event: content_block_stop
data: {"type": "content_block_stop", "index": 1}
event: message_delta
data: {"type":"message_delta","delta":{"stop_reason":"max_tokens","stop_sequence":null},"usage":{"output_tokens":16,"output_tokens_details":{"thinking_tokens":8}}}
event: message_stop
data: {"type": "message_stop"}
What the library reported
- Outcome
- returned
- Finish
{ "raw": "max_tokens", "source": "ModelResponse.finish_reason", "surface": "primary", "value": "length" }- Text
- Value
- Octopuses change colour by
- Surface
- primary
- Tool calls
[]
- Usage
{ "cached_input": 0, "input": 25, "output": 16, "reasoning": 8, "surface": { "cached_input": "primary", "input": "primary", "output": "primary", "reasoning": "primary", "total": "primary" }, "total": 41 }- Stream
{ "chunks_seen": 9, "completed": true, "used": true }- Error
null
- Unsupported reason
null
Full observation JSON
{
"elapsed_ms": 236.96659784764051,
"error": null,
"finish": {
"raw": "max_tokens",
"source": "ModelResponse.finish_reason",
"surface": "primary",
"value": "length"
},
"format": "wiretruth.observation/v1",
"library": {
"api": "Agent.run_stream_events",
"language": "python",
"name": "pydantic-ai",
"version": "2.61.0"
},
"notes": [],
"outcome": "returned",
"stream": {
"chunks_seen": 9,
"completed": true,
"used": true
},
"structured": {
"attempted": false,
"returned_as_success": false,
"value": null
},
"text": {
"surface": "primary",
"value": "Octopuses change colour by"
},
"tool_calls": [],
"unsupported_reason": null,
"usage": {
"cached_input": 0,
"input": 25,
"output": 16,
"reasoning": 8,
"surface": {
"cached_input": "primary",
"input": "primary",
"output": "primary",
"reasoning": "primary",
"total": "primary"
},
"total": 41
}
}Fixture
documented anthropic/truncation.text-stream
| Provenance | Value |
|---|---|
| Source | https://platform.claude.com/docs/en/build-with-claude/streaming#streaming-request-with-thinking |
| Notes | Documented shapes, not a recording. Message envelope and stop fields follow handling-stop-reasons; content blocks follow thinking/streaming and handle-tool-calls. Model changed to claude-sonnet-5-5; IDs and scenario text are filled in. Token counts are illustrative, filled in to include thinking within the requested output limit, not measured. ASSUMED composition: omitted thinking followed by a short text prefix at max_tokens; the docs do not show this exact small-budget response. Thinking is empty and the signature placeholder is copied literally from streaming#thinking-delta. SSE names, JSON shapes, field order and spaced text/thinking events follow streaming examples; the compact message_delta follows Streaming request with tool use. Fragment boundaries and counts are filled in. Signature placeholder is copied literally from the signature_delta example; empty thinking_delta follows the documented omitted display flow. The output_tokens_details.thinking_tokens breakdown follows thinking-steering.md (https://platform.claude.com/docs/en/build-with-claude/thinking-steering-and-cost#pricing); the thinking count of 8 is filled in, not measured. It appears only in the final message_delta usage. |
Reproduce
wiretruth serve anthropic/truncation.text-streamPlain-library snippet from the shim manifest.
AnthropicModel(model, provider=AnthropicProvider(base_url=WIRETRUTH_BASE_URL_ANTHROPIC, api_key=WIRETRUTH_API_KEY)); host rootUpstream
No matching upstream report.
History
| Version | Grade |
|---|---|
| 2.61.0 | ✓ PASS |
| 2.56.0 | ✓ PASS |