Results / truncation.structured-output-forced-tool

Structured output through a forced tool cut off at the token limit

A legacy forced structured_output tool stops at max_tokens with an incomplete input object.

Bug class: Truncation not reported as truncation

The provider stopped at the output token limit, but the library reports a normal finish, a generic parse error, or a partial result as success.

Agents accept partial output or retry without raising the limit, and structured pipelines ingest incomplete records.

Requirements

LevelIdCheckRequirementProviders
MUSTno-partial-successno_success_structured_valueA partial object is never returned as a successful result.All
MUSTcause-is-truncationtruncation_is_signalledThe caller can tell that the output stopped at the token limit.All
SHOULDtext-reportedtext_matches_truthThe partial JSON text is available exactly as the provider sent it.All
SHOULDusage-reportedusage_matches_truthToken usage is reported, and matches the provider's counts, even though the result is unusable.All

Fixtures

ProviderTierany-llmlitellmpydantic-aitanstack-aivercel-ai
anthropicdocumented– UNSUPPORTED– UNSUPPORTED~ LOSSY– UNSUPPORTED– UNSUPPORTED