~ LOSSY

pydantic-ai 2.61.0

truncation.tool-call-args-stream · openai-chat

Back to results · Scenario

Requirements

IdLevelStatusEvidence
no-complete-partial-callMUSTSATISFIEDoutcome=raised; error signalled
cause-is-truncationMUSTNOT_OBSERVABLEfinish.value="length" (raw: ModelResponse.finish_reason); truth.finish="length"; error.category="validation"; structured.returned_as_success=false

What the provider sent

Finish
length
Raw finish
length
Text
null
Tool calls
[
  {
    "arguments": null,
    "arguments_parsed_ok": false,
    "arguments_raw": "{\"title\":\"Weekend Pottery Workshop\",\"",
    "id": "call_DkXNh5JdHW4s54IKfPr4dP1U",
    "name": "create_event"
  }
]
Usage
{
  "alternatives": {},
  "cached_input": null,
  "input": null,
  "output": null,
  "raw": null,
  "reasoning": null,
  "total": null
}
Stream completed
true
Error
null
Wire excerpt
status: 200
content-type: text/event-stream; charset=utf-8
body (sse):
data: {"id":"chatcmpl-EXmWbuEH1m1F3czcaV6FIXqLd54H7","object":"chat.completion.chunk","created":1791720061,"model":"gpt-6-luna","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_DkXNh5JdHW4s54IKfPr4dP1U","type":"function","function":{"name":"create_event","arguments":""}}],"refusal":null},"finish_reason":null}],"obfuscation":"AoLyAol"}


data: {"id":"chatcmpl-EXmWbuEH1m1F3czcaV6FIXqLd54H7","object":"chat.completion.chunk","created":1791720061,"model":"gpt-6-luna","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"obfuscation":"q3"}


data: {"id":"chatcmpl-EXmWbuEH1m1F3czcaV6FIXqLd54H7","object":"chat.completion.chunk","created":1791720061,"model":"gpt-6-luna","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"title"}}]},"finish_reason":null}],"obfuscation":""}


data: {"id":"chatcmpl-EXmWbuEH1m1F3czcaV6FIXqLd54H7","object":"chat.completion.chunk","created":1791720061,"model":"gpt-6-luna","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"obfuscation":""}


data: {"id":"chatcmpl-EXmWbuEH1m1F3czcaV6FIXqLd54H7","object":"chat.completion.chunk","created":1791720061,"model":"gpt-6-luna","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Weekend"}}]},"finish_reason":null}],"obfuscation":"MHeTX929pznvFG"}


data: {"id":"chatcmpl-EXmWbuEH1m1F3czcaV6FIXqLd54H7","object":"chat.completion.chunk","created":1791720061,"model":"gpt-6-luna","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" Pot"}}]},"finish_reason":null}],"obfuscation":"X"}


data: {"id":"chatcmpl-EXmWbuEH1m1F3czcaV6FIXqLd54H7","object":"chat.completion.chunk","created":1791720061,"model":"gpt-6-luna","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"tery"}}]},"finish_reason":null}],"obfuscation":"v"}


data: {"id":"chatcmpl-EXmWbuEH1m1F3czcaV6FIXqLd54H7","object":"chat.completion.chunk","created":1791720061,"model":"gpt-6-luna","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" Workshop"}}]},"finish_reason":null}],"obfuscation":"eBxdZFJ0AQaC"}


data: {"id":"chatcmpl-EXmWbuEH1m1F3czcaV6FIXqLd54H7","object":"chat.completion.chunk","created":1791720061,"model":"gpt-6-luna","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\",\""}}]},"finish_reason":null}],"obfuscation":""}


data: {"id":"chatcmpl-EXmWbuEH1m1F3czcaV6FIXqLd54H7","object":"chat.completion.chunk","created":1791720061,"model":"gpt-6-luna","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"length"}],"obfuscation":"ppOIfIY"}


data: [DONE]

What the library reported

Outcome
raised
Finish
{
  "raw": "length",
  "source": "ModelResponse.finish_reason",
  "surface": "raw",
  "value": "length"
}
Text
Value
null
Surface
absent
Tool calls
[
  {
    "arguments": {
      "INVALID_JSON": "{\"title\":\"Weekend Pottery Workshop\",\""
    },
    "arguments_parsed_ok": true,
    "arguments_raw": "{\"INVALID_JSON\":\"{\\\"title\\\":\\\"Weekend Pottery Workshop\\\",\\\"\"}",
    "id": "call_DkXNh5JdHW4s54IKfPr4dP1U",
    "name": "create_event"
  }
]
Usage
{
  "cached_input": 0,
  "input": 0,
  "output": 0,
  "reasoning": 0,
  "surface": {
    "cached_input": "raw",
    "input": "raw",
    "output": "raw",
    "reasoning": "raw",
    "total": "raw"
  },
  "total": 0
}
Stream
{
  "chunks_seen": 12,
  "completed": false,
  "used": true
}
Error
Type
pydantic_ai.exceptions.UnexpectedModelBehavior
Message
Tool 'create_event' exceeded max retries count of 0. Consider raising the retry limit, or see the docs on tool retries: https://pydantic.dev/docs/ai/tools-toolsets/tools-advanced/#tool-retries
Category
validation
Retry after
null
Stack top
pydantic_ai/tool_manager.py:523
Unsupported reason
null
Full observation JSON
{
  "elapsed_ms": 218.79828162491322,
  "error": {
    "category": "validation",
    "message": "Tool 'create_event' exceeded max retries count of 0. Consider raising the retry limit, or see the docs on tool retries: https://pydantic.dev/docs/ai/tools-toolsets/tools-advanced/#tool-retries",
    "retry_after": null,
    "stack_top": "pydantic_ai/tool_manager.py:523",
    "type": "pydantic_ai.exceptions.UnexpectedModelBehavior"
  },
  "finish": {
    "raw": "length",
    "source": "ModelResponse.finish_reason",
    "surface": "raw",
    "value": "length"
  },
  "format": "wiretruth.observation/v1",
  "library": {
    "api": "Agent.run_stream_events",
    "language": "python",
    "name": "pydantic-ai",
    "version": "2.61.0"
  },
  "notes": [],
  "outcome": "raised",
  "stream": {
    "chunks_seen": 12,
    "completed": false,
    "used": true
  },
  "structured": {
    "attempted": false,
    "returned_as_success": false,
    "value": null
  },
  "text": {
    "surface": "absent",
    "value": null
  },
  "tool_calls": [
    {
      "arguments": {
        "INVALID_JSON": "{\"title\":\"Weekend Pottery Workshop\",\""
      },
      "arguments_parsed_ok": true,
      "arguments_raw": "{\"INVALID_JSON\":\"{\\\"title\\\":\\\"Weekend Pottery Workshop\\\",\\\"\"}",
      "id": "call_DkXNh5JdHW4s54IKfPr4dP1U",
      "name": "create_event"
    }
  ],
  "unsupported_reason": null,
  "usage": {
    "cached_input": 0,
    "input": 0,
    "output": 0,
    "reasoning": 0,
    "surface": {
      "cached_input": "raw",
      "input": "raw",
      "output": "raw",
      "reasoning": "raw",
      "total": "raw"
    },
    "total": 0
  }
}

Fixture

recorded openai-chat/truncation.tool-call-args-stream

ProvenanceValue
Recorded at2026-10-11T12:01:01Z
Requested modelgpt-6-luna
Returned modelgpt-6-luna
CI runhttps://github.com/kartsan03/wiretruth/actions/runs/38137650119

Reproduce

wiretruth serve openai-chat/truncation.tool-call-args-stream

Plain-library snippet from the shim manifest.

OpenAIChatModel(model, provider=OpenAIProvider(base_url=WIRETRUTH_BASE_URL_OPENAI_CHAT, api_key=WIRETRUTH_API_KEY))

Upstream

reported Issue

Fixed in: not specified

Reported in a comment on the token-limit issue: https://github.com/pydantic/pydantic-ai/issues/12399#issuecomment-6780480981. Tool-call arguments cut off at the limit fail validation and end in the per-tool retry limit (UnexpectedModelBehavior: Tool 'create_event' exceeded max retries count of 0), not in IncompleteToolCall; reproduced on 2.61.0 and 2.66.0 with an ExternalToolset.

History

VersionGrade
2.61.0~ LOSSY
2.56.0~ LOSSY