~ LOSSY

pydantic-ai 2.61.0

truncation.structured-output · openai-responses

Back to results · Scenario

Requirements

IdLevelStatusEvidence
no-partial-successMUSTSATISFIEDstructured.attempted=true; structured.returned_as_success=false
cause-is-truncationMUSTNOT_OBSERVABLEfinish.value="length" (raw: ModelResponse.finish_reason); truth.finish="length"; error.category="parse"; structured.returned_as_success=false
text-reportedSHOULDNOT_OBSERVABLEtext.value="{\"islands\":[{\"name\":\"Κρήτη\",\"sea\":\"Κρητικό Πέ" (raw); truth.text="{\"islands\":[{\"name\":\"Κρήτη\",\"sea\":\"Κρητικό Πέ"
usage-reportedSHOULDNOT_OBSERVABLEusage.input=68 (raw); truth.usage.input=68; usage.output=24 (raw); truth.usage.output=24

Notes

  • shim: retries: 1 (2 model requests)

What the provider sent

Finish
length
Raw finish
max_output_tokens
Text
{"islands":[{"name":"Κρήτη","sea":"Κρητικό Πέ
Tool calls
[]
Usage
{
  "alternatives": {},
  "cached_input": 0,
  "input": 68,
  "output": 24,
  "raw": {
    "input_tokens": 68,
    "input_tokens_details": {
      "cache_write_tokens": 0,
      "cached_tokens": 0
    },
    "output_tokens": 24,
    "output_tokens_details": {
      "reasoning_tokens": 0
    },
    "total_tokens": 92
  },
  "reasoning": 0,
  "total": 92
}
Stream completed
null
Error
null
Wire excerpt
status: 200
content-type: application/json
body (json):
{
  "id": "resp_04ca3cce672b80e9006acbfbfeef9c87d1b371f55d49b29248",
  "object": "response",
  "created_at": 1791753214,
  "status": "incomplete",
  "access_programs": null,
  "background": false,
  "billing": {
    "payer": "developer"
  },
  "completed_at": null,
  "error": null,
  "frequency_penalty": 0.0,
  "incomplete_details": {
    "reason": "max_output_tokens"
  },
  "instructions": null,
  "max_output_tokens": 24,
  "max_tool_calls": null,
  "model": "gpt-6-luna",
  "moderation": null,
  "output": [
    {
      "id": "msg_04ca3cce672b80e9006acbfbffd3a087d1882b5ea5d91c9c0b",
      "type": "message",
      "status": "incomplete",
      "content": [
        {
          "type": "output_text",
          "annotations": [],
          "logprobs": [],
          "text": "{\"islands\":[{\"name\":\"Κρήτη\",\"sea\":\"Κρητικό Πέ"
        }
      ],
      "phase": "final_answer",
      "role": "assistant"
    }
  ],
  "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": "json_schema",
      "description": null,
      "name": "output",
      "schema": {
        "type": "object",
        "properties": {
          "islands": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "sea": {
                  "type": "string"
                }
              },
              "required": [
                "name",
                "sea"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "islands"
        ],
        "additionalProperties": false
      },
      "strict": true
    },
    "verbosity": "medium"
  },
  "tool_choice": "auto",
  "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": [],
  "top_logprobs": 0,
  "top_p": 0.98,
  "truncation": "disabled",
  "usage": {
    "input_tokens": 68,
    "input_tokens_details": {
      "cache_write_tokens": 0,
      "cached_tokens": 0
    },
    "output_tokens": 24,
    "output_tokens_details": {
      "reasoning_tokens": 0
    },
    "total_tokens": 92
  },
  "user": null,
  "metadata": {}
}

What the library reported

Outcome
raised
Finish
{
  "raw": "max_output_tokens",
  "source": "ModelResponse.finish_reason",
  "surface": "raw",
  "value": "length"
}
Text
Value
{"islands":[{"name":"Κρήτη","sea":"Κρητικό Πέ
Surface
raw
Tool calls
[]
Usage
{
  "cached_input": 0,
  "input": 68,
  "output": 24,
  "reasoning": 0,
  "surface": {
    "cached_input": "raw",
    "input": "raw",
    "output": "raw",
    "reasoning": "raw",
    "total": "raw"
  },
  "total": 92
}
Stream
{
  "chunks_seen": null,
  "completed": null,
  "used": false
}
Error
Type
pydantic_ai.exceptions.UnexpectedModelBehavior
Message
Exceeded maximum output retries (1)
Category
parse
Retry after
null
Stack top
pydantic_ai/_agent_graph.py:472
Unsupported reason
null
Full observation JSON
{
  "elapsed_ms": 302.3099461570382,
  "error": {
    "category": "parse",
    "message": "Exceeded maximum output retries (1)",
    "retry_after": null,
    "stack_top": "pydantic_ai/_agent_graph.py:472",
    "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",
    "language": "python",
    "name": "pydantic-ai",
    "version": "2.61.0"
  },
  "notes": [
    "retries: 1 (2 model requests)"
  ],
  "outcome": "raised",
  "stream": {
    "chunks_seen": null,
    "completed": null,
    "used": false
  },
  "structured": {
    "attempted": true,
    "returned_as_success": false,
    "value": null
  },
  "text": {
    "surface": "raw",
    "value": "{\"islands\":[{\"name\":\"Κρήτη\",\"sea\":\"Κρητικό Πέ"
  },
  "tool_calls": [],
  "unsupported_reason": null,
  "usage": {
    "cached_input": 0,
    "input": 68,
    "output": 24,
    "reasoning": 0,
    "surface": {
      "cached_input": "raw",
      "input": "raw",
      "output": "raw",
      "reasoning": "raw",
      "total": "raw"
    },
    "total": 92
  }
}

Fixture

recorded openai-responses/truncation.structured-output

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

Reproduce

wiretruth serve openai-responses/truncation.structured-output

Plain-library snippet from the shim manifest.

OpenAIResponsesModel(model, provider=OpenAIProvider(base_url=WIRETRUTH_BASE_URL_OPENAI_RESPONSES, api_key=WIRETRUTH_API_KEY))

Upstream

confirmed Issue · PR

Fixed in: not specified

Existing upstream issue, opened by a maintainer, not by wiretruth. Cut-off structured output is retried, then fails with UnexpectedModelBehavior('Exceeded maximum output retries'); the length finish is only in the captured messages. https://github.com/pydantic/pydantic-ai/pull/12406, merged after 2.66.0 and not in a release yet, raises right away with a message naming the token limit; https://github.com/pydantic/pydantic-ai/pull/12407 (open) adds the typed OutputTokenLimitExceeded.

History

VersionGrade
2.61.0~ LOSSY
2.56.0~ LOSSY