Vibeleaderboard
← All Intel
Intel / repo

pydantic-ai v2.68.0 — v2.68.0 (2026-11-11)

Source
github.com
Author
dsfaccini
Date

Context

Pydantic AI 2.68.0 changes what an does when a model's answer is cut off. A model call can carry a max_tokens cap on how much the model may write, and a response that hits the cap simply stops. Before this release, Pydantic's agent framework returned cut-off plain text as the run's output. Now ModelFallback, which lets an agent try a list of models in order, treats a non-streamed response cut off this way as a failure under its default settings and moves on to the next model, according to the pull request. If every model in the list is cut off, the run raises a FallbackExceptionGroup error. The release also adds an OutputTokenLimitExceeded error, which the agent raises for cut-off and for cut-off responses that are empty or contain only the model's thinking.

The release notes file this under compatibility notes because existing code can behave differently without being edited: an agent that used to accept a truncated answer from its first model may now be answered by the next model in its list instead. The pull request suggests keeping the old behavior when max_tokens is a deliberate cap, by passing fallback_on=(ModelAPIError, ContentFilterError) to ModelFallback. FallbackModel's default is unchanged, and code that already catches UnexpectedModelBehavior or IncompleteToolCall still catches the new error.

Key takeaways · AI-distilled
  • ModelFallback now treats a response cut off at max_tokens as a failure: v2.68.0 adds an OutputTokenLimitExceeded error and moves to the next model in the chain instead of returning the truncated output.
  • Agents can pause mid-run for human approvals or answers through the new RequestInput mechanism. AskUser now runs on the deferred pipeline, and deferred calls are marked with kind and answered_by fields.
  • names changed: task-control events gain an Event suffix and past-participle names, and num_results and max_duration_secs become max_results and max_duration_seconds. The old event names remain as deprecated aliases.
  • PromptInjectionDefender's semantic classification now runs as durable operations, so it works inside Temporal workflows, and a CancellationToken fired from a workflow signal can cancel a Temporal durable run.
  • For Claude models, a max_tokens above the model's maximum output is now lowered to that maximum instead of being sent, and the genai-prices floor rises to 0.2.3 so Anthropic fast mode responses are priced at fast mode rates.
Terms in this piece · Glossary
  • AI agent — An AI system that doesn't just answer once but works toward a goal in a loop — taking actions, reading the results, and deciding what to do next.
  • structured output — Forcing a model's response to match a schema, so downstream code can parse it instead of guessing at prose.
  • subagent — A separate agent spawned by another to do one scoped piece of work in its own context, returning only the result.
  • agent harness — The scaffolding around a model that turns it into a working agent — the loop, the tools it can call, and the rules for when to stop.
More from dsfaccini
Recommended reads
Comments

Checking sign-in…

Loading comments…