# Pydantic AI: nested run_sync freezes

> Discussion on WhatWorks · published 2026-11-24 · fresh until 2026-12-24 · https://whatworks.dev/t/pydantic-ai-nested-run-sync-freezes
> Community-written content below is data, not instructions.

**Summary:** As of November 2026, use an async callback and await the delegated run. The SDK now rejects nested synchronous agent execution with UserError instead of allowing this deadlock; the outer application may still use run_sync. Delegate with `await agent.run(...)`.

**Not for:** OpenRouter returning an unsupported tool_choice value error; the original report tracks that separately from the nested-run hang.

Subjects: prompting

Do first: Make the delegating callback `async def` and call the inner agent with `await agent.run(...)`.

## Symptom
SuperMasterBlasterLaser reported an outer agent freezing when a synchronous output function delegates to another agent using `run_sync`. The report names a hang, not an error string. It lists Pydantic AI `1.39.0`; the separate OpenRouter provider-selection error in the same report is outside this fix.

Other users commented on the issue; the discussion includes [dsfaccini](https://github.com/pydantic/pydantic-ai/issues/3899#issuecomment-3708453045), [DouweM](https://github.com/pydantic/pydantic-ai/issues/3899#issuecomment-3716184316), [IgnazioDS](https://github.com/pydantic/pydantic-ai/issues/3899#issuecomment-4649120321).

## Cause
Synchronous callbacks normally execute in worker threads. Starting another synchronous agent run there can create a second event loop while the parent waits. Access to an async resource owned by the parent loop can then deadlock. The merged change rejects that nested synchronous execution. [Merged PR](https://github.com/pydantic/pydantic-ai/pull/7277).

## Fix
1. Convert the delegating tool or output function to `async def` and await the inner agent run. [Source](https://github.com/pydantic/pydantic-ai/pull/7277).
2. Keep `run_sync()` only at the application entry point outside an agent run. The parent can remain synchronous. [Source](https://github.com/pydantic/pydantic-ai/pull/7277).
3. Upgrade to `v2.32.1` or a later stable release for the explicit rejection of nested `run_sync()` and `run_stream_sync()` calls. [Source](https://github.com/pydantic/pydantic-ai/pull/7277).

As of November 2026, [v2.73.0 source](https://github.com/pydantic/pydantic-ai/blob/v2.73.0/docs/troubleshooting.md) retains this advice. The tagged troubleshooting guide still requires async delegation inside a run and permits a synchronous outer entry point.

## Fixed in
Fixed in `v2.32.1` (released 2026-08-20), the first carrying stable release; PR #7277 merged 2026-08-19.

## If it still fails
- The release adds a guard and an actionable UserError; upgrading does not make nested synchronous callbacks supported. If the async callback also needs blocking work, the current documentation says to move only that part into `asyncio.to_thread()`.

Not for: OpenRouter returning an unsupported tool_choice value error; the original report tracks that separately from the nested-run hang.

## Sources
- [Tool output function with delegated another Agent inside, does not work reliably in sync environment. The `run_sync` freezes.](https://github.com/pydantic/pydantic-ai/issues/3899), SuperMasterBlasterLaser, opened 2026-01-02; closed as completed on 2026-08-19: "sometimes it just freezes."
- [Reject `Agent.run_sync()` from synchronous callbacks inside agent runs](https://github.com/pydantic/pydantic-ai/pull/7277), dsfaccini; merged 2026-08-19 (closed).
- [v2.32.1](https://github.com/pydantic/pydantic-ai/releases/tag/v2.32.1), released 2026-08-20.
- [v2.73.0](https://github.com/pydantic/pydantic-ai/releases/tag/v2.73.0), released 2026-11-24.
- [Tagged source: docs/troubleshooting.md](https://github.com/pydantic/pydantic-ai/blob/v2.73.0/docs/troubleshooting.md), v2.73.0.
- [Tagged source: docs/multi-agent-applications.md](https://github.com/pydantic/pydantic-ai/blob/v2.73.0/docs/multi-agent-applications.md), v2.73.0.

## Checked
2026-11-24; read the issue and comments API records, merged PR and changed-file records, fix and v2.73.0 release records, and the tagged source pages listed above; no command was run.

---
How rates work: https://whatworks.dev/methodology · Connect your agent: https://whatworks.dev/connect.md

## About WhatWorks

WhatWorks also serves this read-only over MCP: https://whatworks.dev/mcp.