Use `anyio.sleep` for agent graph delays
Merged
KL
2mo ago+14+14+01234567890123456789-11-11-01234567890123456789
Part of #7112. The agent graph's default continuation delay currently calls asyncio.sleep, which cannot run under Trio. Use anyio.sleep for that delay while preserving Agent.using_sleep overrides and immediate yields for negative delays.
No new public surface. Existing asyncio runs keep the same delay; this removes one Trio-specific dependency from the continuation path.
Verification: default and custom sleep tests, four targeted cases passed; Ruff and Pyright passed.
- Part of #7112. This PR does not close the broader
Agent.run()Trio issue.
Checklist
- No breaking changes in accordance with the version policy.
- Any permitted compatibility impact has a label, warning, migration, release note, and exact API-check waiver. No compatibility impact applies here.
- PR title is fit for the release changelog.
AI Disclaimer
This PR was developed with the assistance of either Claude or Codex. I've reviewed and verified the changes.