~ LOSSY

pydantic-ai 2.61.0

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

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
max_output_tokens
Text
null
Tool calls
[
  {
    "arguments": null,
    "arguments_parsed_ok": false,
    "arguments_raw": "{\"title\":\"Weekend Pottery Workshop\",\"",
    "id": "call_t7e3IgxCdjXlMbNHlOwncu0f",
    "name": "create_event"
  }
]
Usage
{
  "alternatives": {},
  "cached_input": 0,
  "input": 100,
  "output": 20,
  "raw": {
    "input_tokens": 100,
    "input_tokens_details": {
      "cache_write_tokens": 0,
      "cached_tokens": 0
    },
    "output_tokens": 20,
    "output_tokens_details": {
      "reasoning_tokens": 0
    },
    "total_tokens": 120
  },
  "reasoning": 0,
  "total": 120
}
Stream completed
true
Error
null
Wire excerpt
status: 200
content-type: text/event-stream; charset=utf-8
body (sse):
event: response.created
data: {"type":"response.created","response":{"id":"resp_0f94ad531e05a9b5006acbfc0552a887d1bc1a7a17e28a6ef8","object":"response","created_at":1791753221,"status":"in_progress","access_programs":null,"background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":20,"max_tool_calls":null,"model":"gpt-6-luna","moderation":null,"output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":"24h","reasoning":{"context":"all_turns","effort":"none","mode":"standard","summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"required","tool_usage":{"image_gen":{"input_tokens":0,"input_tokens_details":{"image_tokens":0,"text_tokens":0},"output_tokens":0,"output_tokens_details":{"image_tokens":0,"text_tokens":0},"total_tokens":0},"web_search":{"num_requests":0}},"tools":[{"type":"function","description":"Create a calendar event.","name":"create_event","output_schema":null,"parameters":{"type":"object","properties":{"title":{"type":"string"},"date":{"type":"string","description":"YYYY-MM-DD"},"city":{"type":"string"},"attendees":{"type":"array","items":{"type":"string"}}},"required":["title","date","city","attendees"],"additionalProperties":false},"strict":true}],"top_logprobs":0,"top_p":0.98,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0}


event: response.in_progress
data: {"type":"response.in_progress","response":{"id":"resp_0f94ad531e05a9b5006acbfc0552a887d1bc1a7a17e28a6ef8","object":"response","created_at":1791753221,"status":"in_progress","access_programs":null,"background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":20,"max_tool_calls":null,"model":"gpt-6-luna","moderation":null,"output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":"24h","reasoning":{"context":"all_turns","effort":"none","mode":"standard","summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"required","tool_usage":{"image_gen":{"input_tokens":0,"input_tokens_details":{"image_tokens":0,"text_tokens":0},"output_tokens":0,"output_tokens_details":{"image_tokens":0,"text_tokens":0},"total_tokens":0},"web_search":{"num_requests":0}},"tools":[{"type":"function","description":"Create a calendar event.","name":"create_event","output_schema":null,"parameters":{"type":"object","properties":{"title":{"type":"string"},"date":{"type":"string","description":"YYYY-MM-DD"},"city":{"type":"string"},"attendees":{"type":"array","items":{"type":"string"}}},"required":["title","date","city","attendees"],"additionalProperties":false},"strict":true}],"top_logprobs":0,"top_p":0.98,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1}


event: response.output_item.added
data: {"type":"response.output_item.added","item":{"id":"fc_0f94ad531e05a9b5006acbfc05e44487d18438296bb239e452","type":"function_call","status":"in_progress","arguments":"","call_id":"call_t7e3IgxCdjXlMbNHlOwncu0f","name":"create_event"},"output_index":0,"sequence_number":2}


event: response.function_call_arguments.delta
data: {"type":"response.function_call_arguments.delta","delta":"{\"","item_id":"fc_0f94ad531e05a9b5006acbfc05e44487d18438296bb239e452","obfuscation":"mF7zLxjMgZ2UrJ","output_index":0,"sequence_number":3}


event: response.function_call_arguments.delta
data: {"type":"response.function_call_arguments.delta","delta":"title","item_id":"fc_0f94ad531e05a9b5006acbfc05e44487d18438296bb239e452","obfuscation":"nhATtcGaku5","output_index":0,"sequence_number":4}


event: response.function_call_arguments.delta
data: {"type":"response.function_call_arguments.delta","delta":"\":\"","item_id":"fc_0f94ad531e05a9b5006acbfc05e44487d18438296bb239e452","obfuscation":"3RsJm5VvtGrcT","output_index":0,"sequence_number":5}


event: response.function_call_arguments.delta
data: {"type":"response.function_call_arguments.delta","delta":"Weekend","item_id":"fc_0f94ad531e05a9b5006acbfc05e44487d18438296bb239e452","obfuscation":"HfQBM2nb7","output_index":0,"sequence_number":6}


event: response.function_call_arguments.delta
data: {"type":"response.function_call_arguments.delta","delta":" Pot","item_id":"fc_0f94ad531e05a9b5006acbfc05e44487d18438296bb239e452","obfuscation":"vQWyaXuAbQrt","output_index":0,"sequence_number":7}


event: response.function_call_arguments.delta
data: {"type":"response.function_call_arguments.delta","delta":"tery","item_id":"fc_0f94ad531e05a9b5006acbfc05e44487d18438296bb239e452","obfuscation":"DBsq51gd6TkJ","output_index":0,"sequence_number":8}


event: response.function_call_arguments.delta
data: {"type":"response.function_call_arguments.delta","delta":" Workshop","item_id":"fc_0f94ad531e05a9b5006acbfc05e44487d18438296bb239e452","obfuscation":"V07Ih0q","output_index":0,"sequence_number":9}


event: response.function_call_arguments.delta
data: {"type":"response.function_call_arguments.delta","delta":"\",\"","item_id":"fc_0f94ad531e05a9b5006acbfc05e44487d18438296bb239e452","obfuscation":"9GeuTYnt4PSbC","output_index":0,"sequence_number":10}


event: response.function_call_arguments.done
data: {"type":"response.function_call_arguments.done","arguments":"{\"title\":\"Weekend Pottery Workshop\",\"","item_id":"fc_0f94ad531e05a9b5006acbfc05e44487d18438296bb239e452","output_index":0,"sequence_number":11}


event: response.output_item.done
data: {"type":"response.output_item.done","item":{"id":"fc_0f94ad531e05a9b5006acbfc05e44487d18438296bb239e452","type":"function_call","status":"incomplete","arguments":"{\"title\":\"Weekend Pottery Workshop\",\"","call_id":"call_t7e3IgxCdjXlMbNHlOwncu0f","name":"create_event"},"output_index":0,"sequence_number":12}


event: response.incomplete
data: {"type":"response.incomplete","response":{"id":"resp_0f94ad531e05a9b5006acbfc0552a887d1bc1a7a17e28a6ef8","object":"response","created_at":1791753221,"status":"incomplete","access_programs":null,"background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":{"reason":"max_output_tokens"},"instructions":null,"max_output_tokens":20,"max_tool_calls":null,"model":"gpt-6-luna","moderation":null,"output":[{"id":"fc_0f94ad531e05a9b5006acbfc05e44487d18438296bb239e452","type":"function_call","status":"incomplete","arguments":"{\"title\":\"Weekend Pottery Workshop\",\"","call_id":"call_t7e3IgxCdjXlMbNHlOwncu0f","name":"create_event"}],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":"24h","reasoning":{"context":"all_turns","effort":"none","mode":"standard","summary":null},"safety_identifier":null,"service_tier":"default","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"required","tool_usage":{"image_gen":{"input_tokens":0,"input_tokens_details":{"image_tokens":0,"text_tokens":0},"output_tokens":0,"output_tokens_details":{"image_tokens":0,"text_tokens":0},"total_tokens":0},"web_search":{"num_requests":0}},"tools":[{"type":"function","description":"Create a calendar event.","name":"create_event","output_schema":null,"parameters":{"type":"object","properties":{"title":{"type":"string"},"date":{"type":"string","description":"YYYY-MM-DD"},"city":{"type":"string"},"attendees":{"type":"array","items":{"type":"string"}}},"required":["title","date","city","attendees"],"additionalProperties":false},"strict":true}],"top_logprobs":0,"top_p":0.98,"truncation":"disabled","usage":{"input_tokens":100,"input_tokens_details":{"cache_write_tokens":0,"cached_tokens":0},"output_tokens":20,"output_tokens_details":{"reasoning_tokens":0},"total_tokens":120},"user":null,"metadata":{}},"sequence_number":13}

What the library reported

Outcome
raised
Finish
{
  "raw": "max_output_tokens",
  "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_t7e3IgxCdjXlMbNHlOwncu0f",
    "name": "create_event"
  }
]
Usage
{
  "cached_input": 0,
  "input": 100,
  "output": 20,
  "reasoning": 0,
  "surface": {
    "cached_input": "raw",
    "input": "raw",
    "output": "raw",
    "reasoning": "raw",
    "total": "raw"
  },
  "total": 120
}
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": 409.5917036756873,
  "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": "max_output_tokens",
    "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_t7e3IgxCdjXlMbNHlOwncu0f",
      "name": "create_event"
    }
  ],
  "unsupported_reason": null,
  "usage": {
    "cached_input": 0,
    "input": 100,
    "output": 20,
    "reasoning": 0,
    "surface": {
      "cached_input": "raw",
      "input": "raw",
      "output": "raw",
      "reasoning": "raw",
      "total": "raw"
    },
    "total": 120
  }
}

Fixture

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

ProvenanceValue
Recorded at2026-10-11T21:13:41Z
Requested modelgpt-6-luna
Returned modelgpt-6-luna
CI runhttps://github.com/kartsan03/wiretruth/actions/runs/38175457862

Reproduce

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

Plain-library snippet from the shim manifest.

OpenAIResponsesModel(model, provider=OpenAIProvider(base_url=WIRETRUTH_BASE_URL_OPENAI_RESPONSES, 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