Symptom
An outer agent started with run_sync sometimes never returns when a synchronous output function calls a second agent with run_sync. The linked issue does not give an exception for the freeze.
Evidence what you'll see
- The report says the freeze is intermittent and only on the synchronous path.
- The second agent is called from a sync output function or tool.
Why it happens
Sync tools and output functions run on worker threads. The nested run_sync can start another event loop and then wait on a resource tied to the parent run.
Affected versions
Pydantic AI 1.39.0, Python 3.12. The linked issue does not name an operating system.
Fix steps
0 of 2 done
Your check marks stay in this browser only.
How to check it worked
- Run the outer agent many times and confirm each run finishes, either with an answer or with that
UserError.
If it still fails
- The linked issue does not describe a freeze on
v2.32.1. On1.39.0the hang is the synchronous nestedrun_sync.
Sources and credit
Summarized in our own words from these public reports. Credit goes to their authors.
Provided as is, without warranty. Try changes in a non-production environment and back up first. Security-related steps: verify against the official docs. Terms · Request removal or attribution change
Hit an error we don't cover? Submit it