Release Info
| Item | Value |
|---|---|
| Framework | Pydantic AI |
| Version | v2.70.0 |
| Previous version | v2.69.0 |
| Release date | 2026-11-17 |
| Release Notes | v2.70.0 |
| GitHub | pydantic/pydantic-ai |
| Stars | 21.3k |
Why this release matters
The headline here isn't a feature — it's two advisories the project itself labeled high severity. Both the "strip ANSI escape sequences" and the "find JWTs to redact" logic in pydantic-ai-harness use patterns whose runtime is quadratic in the length of the input. Whenever an attacker can influence what a tool returns — a shell command, a file read, a fetched page, an MCP server — a few hundred kilobytes of crafted text is enough to stall the event loop for tens of seconds to minutes, and every other request and agent run sharing that process stalls with it. For any team that wires an agent up to a tool whose output an attacker can influence, this isn't an optional upgrade — it's an incident waiting to happen. On the feature side, the release continues last version's direction: giving agents inside the harness more ways to manage each other's output and failures.
Key changes
- ReDoS in ToolOutputLimits' ANSI stripping (GHSA-m4cr-m4qc-9hh3, high): when
strip_ansi=True, the pattern used to strip ANSI escape sequences runs in quadratic time → a few hundred kilobytes of tool output packed with unterminated escape sequences can stall the event loop for tens of seconds to minutes, affecting any app that setsstrip_ansitoTrue(formerly namedOverflowingToolOutput) on tool output an attacker can influence - ReDoS in secret redaction's jwt pattern (GHSA-5m5q-5qj4-gx9h, high): the
jwtpattern enabled by default inredact_secrets/secret_data()backtracks in quadratic time → because this guard runs synchronously on the event loop, a few hundred kilobytes of crafted text (a user prompt or tool-returned content) is enough to stall the whole process - ToolSearch: a new tool selector that defers loading tool definitions until they're actually needed (pre-search deferral) → you don't have to stuff every tool's schema into context up front when there are many tools
- PruneToolResults: lets the model replace a tool result it just received with its own summary → old tool output in a long conversation doesn't have to keep occupying context
- StreamGuardrail: screens streamed text, thinking, and tool-call parts before the caller sees them → a guardrail doesn't have to wait for the whole response to finish before it can step in
- SubAgent(on_model_error=): lets a sub-agent choose to retry or return separately when it hits a model error, independent of
on_failure→ a sub-agent's error handling no longer has to be tied to the overall failure logic
The diagram below shows the attack chain: a string hidden in tool output triggers the quadratic-time scan, and other agent runs' requests get stalled along with it.
- The attacker sends input with an unterminated escape sequence or a JWT-like string to a tool
- The tool passes this content straight back to the harness
- The harness scans it with a quadratic-time regex; the event loop stalls
- Another agent run sends a new request at the same time
- That request times out without a response
- The original tool caller finally gets a response, tens of seconds later
Simplified illustration; the actual stall duration depends on input size and server load
Breaking Changes
There are no renames or signature changes this release, but a few compatibility notes make existing behavior stricter:
OpenAIChatModelnow raisesModelRequestRejectedErroroutright if tool definitions are still sent while reasoning is on for GPT-6 models, instead of silently sending them and letting the model decide- Affected: code that still passes tools when calling GPT-6 reasoning models
GroqModelnow raisesUserErrorwhenNativeOutputis used together with function tools- Affected: code that mixes
NativeOutputand function tools on Groq
- Affected: code that mixes
- OpenRouter's
qwen/qwen3.8-flashnow falls back to'auto'or raisesModelRequestRejectedErrorwhentool_choiceis forced while reasoning is on (the model itself rejects forced tool choice while reasoning)- Affected: code that forces
tool_choicefor that model
- Affected: code that forces
Migration Guide
Upgrading from 2.69.x to 2.70.0
pip install --upgrade pydantic-ai==2.70.0 pydantic-ai-harness==0.70.0
Both advisories keep default behavior unchanged, but upgrading right away is strongly recommended:
# 1. If you set strip_ansi=True (formerly OverflowingToolOutput)
# Temporary mitigation before upgrading: leave it at the default, False
ToolOutputLimits(strip_ansi=False)
# 2. If you use redact_secrets() or secret_data() and rely on the default jwt pattern
# Temporary mitigation before upgrading: name the patterns you need explicitly, excluding jwt
secret_data(only=["aws_key", "api_key"]) # jwt not included
Both mitigations are only for before you upgrade. The real fix is upgrading pydantic-ai-harness to 0.70.0 or later. One more thing to note: the harness on Pydantic AI v1 is stuck at 0.4.0 and can't be upgraded further — you need to move to Pydantic AI v2 first to get this fix.
Compared to other frameworks
The same week, CrewAI 1.15.42 bumped its soupsieve dependency to fix CVE-2026-126190, while Pydantic AI's bug this release is in its own harness code. Put together, these point to a trend: agent framework security advisories are no longer just "a dependency has a hole" pass-through problems — more and more are bugs in the framework's own code for handling inherently untrusted input, like LLM and tool output. That echoes the observation in Agno v3.2.1 and last release's Pydantic AI v2.69.0 article: competition between frameworks has extended into the execution environment layer, and how secure that layer is has started to become one of the things worth watching.
Today's takeaway
I used to think of ReDoS as just a performance bug from a poorly written regex, one that at worst slows down a single request. Seeing the project issue two separate high-severity GHSA advisories for two string-processing functions — stripping ANSI, finding JWTs — made it clear: the content an agent harness processes is content an attacker can influence, and string-cleanup logic that looks harmless is itself part of the attack surface. And because it runs on the event loop, one trigger doesn't stall one request — it stalls every agent run sharing that process.
References
- Pydantic AI v2.70.0 Release Notes
- GHSA-m4cr-m4qc-9hh3: Harness ToolOutputLimits ANSI stripping ReDoS
- GHSA-5m5q-5qj4-gx9h: Harness JWT redaction ReDoS
- pydantic/pydantic-ai on GitHub
- Full Changelog: v2.69.0...v2.70.0
- PR #13139: ToolSearch tools selector
- PR #13634: PruneToolResults
- PR #13667: StreamGuardrail
- PR #13738: SubAgent(on_model_error=)
- CrewAI 1.15.42 Release Notes
- Framework Update: Pydantic AI v2.69.0 (previous version: sandbox backends and Peers)