Release Info
| Item | Value |
|---|---|
| Framework | Pydantic AI |
| Version | v2.77.0 |
| Previous version | v2.76.0 |
| Released | 2026-11-27 |
| Release Notes | v2.77.0 |
| GitHub | pydantic/pydantic-ai |
| Stars | 21.4k |
Why This Version Matters
Yesterday's release (2.76.0) changed how result.conversation behaves under a history-trimming capability, but the application layer still had no visibility into when compaction actually happened or what it did — a capability like SummarizingCompaction decided on its own whether and how much to summarize, and you just had to accept the result. This release opens that up: a new compact_history() capability hook and RunContext.request_compaction() let your own code demand a compaction right now, instead of waiting for a capability to decide the history has gotten long enough. The matching CompactionStartEvent/CompactionEndEvent make compaction visible in the event stream, so you can surface a status in the UI or just log when it happened.
The same release also shores up durability on the infrastructure side: ConversationStore gains SQLite, Postgres and MongoDB backends (it used to lean on in-memory storage or whatever you wired up yourself), and the default FallbackCompaction chain now recovers automatically from UnexpectedModelBehavior instead of letting a failed summarization take down the whole run. Separately, SubAgents tightens how it loads sub-agent definition files from disk — files in directories below operator authority no longer get read in as trusted instructions, which closes off a real gap for anyone pointing a sub-agent at someone else's repository.
Simplified — only the affected compaction-trigger path is shown. A run that never calls request_compaction and has no compact_history hook behaves as before.
Key Changes
compact_history()hook +request_compaction(): a capability can implement acompact_history()hook, andRunContextgainsrequest_compaction()so your own code can demand a compaction → no more waiting for a built-in capability to decide history is "long enough"; trigger it at a point you actually know about, like right after a tool call or when entering a new phaseCompactionStartEvent/CompactionEndEvent: only emitted when something callsrequest_compaction()or acompact_historyhook exists, so an existing run's stream is unaffected → surface a "cleaning up history" status in the UI, or just log when compaction happened- Three new
ConversationStorebackends: SQLite, Postgres, MongoDB → the store used to lean on in-memory storage or a custom integration; now the framework ships database-backed conversation storage out of the box SubAgentstightens disk-definition loading: sub-agent definition files in a directory belowoperatorauthority — such as an entire workspace atauthority='none'— are no longer loaded; they're skipped with a warning instead. Aworking_directory=delegate's workspace authority is lowered to whatever the parent grants that directory → avoids treating a file in someone else's repository as a trusted sub-agent instructionFallbackCompactionauto-recovery: the defaultFallbackCompactionchain now recovers fromUnexpectedModelBehaviorautomatically instead of letting a failed compaction abort the whole run → one more layer of durability, where a compaction failure no longer means a task failurethinking_summary: Claude models on Anthropic and Bedrock can now return readable, summarized thinking instead of an empty thinking block (viaanthropic_thinking_display/bedrock_thinking_displaysettingthinking.display: 'summarized') → another option if you want to see the model's reasoning without the raw thinking stream, though it can add latency before the first text token
Breaking Changes
There's no standalone "Breaking Changes" section this time, but a few items under the official " Compatibility Notes" change existing code's behavior directly:
- Pax's session store is renamed:
SqliteConversationStore/ConversationConflict(inpydantic_ai_harness.step_persistence.conversations) becomeSqliteSessionStore/SessionConflict- Impact: the old names still import, but now raise
HarnessDeprecationWarning; a setup that turns warnings into errors will fail outright
- Impact: the old names still import, but now raise
Skills(...)'s default behavior changes: a missing or unreadable skill library or skill is now skipped with a warning by default instead of failing the whole run- Impact: to keep the old "a missing directory fails the run" behavior, pass
missing_directories='error'explicitly;SkipReasongains a new value, so code doing an exhaustive match over it stops type-checking
- Impact: to keep the old "a missing directory fails the run" behavior, pass
SubAgentsno longer loads sub-agent definition files from directories belowoperatorauthority- Impact: any setup relying on "every file in the workspace gets read as a sub-agent definition" now has those files skipped with a warning; directories you still want read need an entry in
path_authority
- Impact: any setup relying on "every file in the workspace gets read as a sub-agent definition" now has those files skipped with a warning; directories you still want read need an entry in
- Carried over from 2.76.0 as a reminder: with a history-trimming capability in place,
result.conversationnow re-summarizes the full history on every run instead of carrying forward just the last summary
Migration Guide
Upgrading from 2.76.x to 2.77.0
pip install --upgrade pydantic-ai==2.77.0
# Before: importing the old names from pydantic_ai_harness.step_persistence.conversations
from pydantic_ai_harness.step_persistence.conversations import (
SqliteConversationStore,
ConversationConflict,
)
# After: use the new names (the old ones still work, but raise HarnessDeprecationWarning)
from pydantic_ai_harness.step_persistence.conversations import (
SqliteSessionStore,
SessionConflict,
)
# Before: a missing skill directory was expected to make Skills(...) fail outright
skills = Skills(libraries=[missing_library_path]) # 2.76.x and earlier: raises
# After: the default is now to skip and warn; opt back into the old behavior explicitly
skills = Skills(libraries=[missing_library_path]) # 2.77.0: skips with a warning
skills = Skills(libraries=[missing_library_path], missing_directories="error") # old behavior
# New capability: trigger a compaction yourself, without waiting for a capability to decide
async def my_tool(ctx: RunContext[...]) -> str:
await ctx.request_compaction()
return "compaction requested"
Everything else — the new ConversationStore backends, thinking_summary, FallbackCompaction's auto-recovery — is additive and doesn't affect existing code unless you opt in.
Comparison With Other Frameworks
Turning compaction into a first-class, hookable, event-emitting mechanism is still something only Pydantic AI is doing — LangGraph's memory/checkpoint updates have stayed focused on stacking features at the storage layer itself, and CrewAI's recent releases are still mostly bug fixes and small features on individual tools. Pydantic AI's last two releases — 2.76.0's hot-swappable realtime tools, and this release's compaction hook — show a consistent direction: behavior that used to be fixed at connection setup, or decided silently by a capability with no visibility for the developer, keeps getting pulled apart into interfaces you can intervene in and observe at runtime.
Today's Takeaway
I used to assume compaction was the capability's own business — whichever capability you picked, you accepted its timing and its summarization style, and the developer just got handed the result. Seeing request_compaction() and a matching start/end event pair made it clear that compaction timing is itself a kind of runtime state an application can decide on, not a hidden implementation detail buried inside the framework. It's the same move as UpdateTools from yesterday, really — taking behavior that used to be bolted to a lifecycle (a connection, a capability) and pulling it out into its own controllable interface.
References
- Pydantic AI v2.77.0 Release Notes
- Full Changelog: v2.76.0...v2.77.0
- pydantic/pydantic-ai GitHub
- PR #11454: compact_history() hook and request_compaction()
- PR #10473: ConversationStore gains SQLite/Postgres/MongoDB backends; Pax session store renamed
- PR #11839: SubAgents tightens disk-definition loading authority
- PR #12655: FallbackCompaction auto-recovers from UnexpectedModelBehavior
- PR #11084: thinking_summary (readable, summarized thinking on Anthropic/Bedrock)
- PR #10524: Skills skips missing/unreadable skill libraries by default
- Pydantic AI v2.76.0 update (previous release: mid-session tool updates)