You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Reboot pins pydantic-ai-slim==1.87.0 (reboot/requirements.in), which pins pydantic-graph==1.87.0. pydantic-ai 2.0 is stable and upstream has moved on (latest is 2.43.0). We should upgrade, both to keep up and to pick up fixes we're currently working around.
Why now
pydantic-graph 1.87.0 lets a cancelled agent run surface as anyio.ClosedResourceError instead of asyncio.CancelledError: a tracked task sends its result into a stream the cancelled run has already closed, and only BrokenResourceError is ignored there. A workflow that catches everything except cancellation then keeps running, which made //tests/reboot/examples/agent-wiki:test hang at shutdown. #179 works around it in _agent_run. The fix upstream first ships in pydantic-graph 2.2.0 (no 1.x release has it); once we're on it, the workaround in #179 can be removed.
Picking a target
pydantic-ai / pydantic-graph
ClosedResourceError fix
HTTP client
Anthropic SDK (anthropic extra)
1.87.0 (current) – 1.99.0, 2.0.0 – 2.1.0
no
httpx
0.x
2.2.0 – 2.30.x
yes
httpx
0.x
2.35.0 – 2.43.0
yes
httpx2
>= 1.3
2.2.0 – 2.30.x keeps reboot[anthropic] on anthropic==0.125.0 (per requirements.in / requirements-anthropic.in, Anthropic SDK 1.x rejects the httpx client pydantic-ai hands it before the httpx2 switch).
2.35+ also means moving the anthropic extra to SDK 1.x and httpx2.
A reasonable path is to land 2.30.x first, then take the httpx2 / Anthropic SDK 1.x step separately.
What it takes
Port Reboot's wrapper (reboot/agents/pydantic_ai/, ~2,300 lines) — most of the work.
Of the 50 names it imports from pydantic-ai, against both 2.2.0 and 2.43.0: pydantic_ai.tools.AgentBuiltinTool no longer exists and pydantic_ai.mcp.MCPServer no longer resolves; CompletedStreamedResponse moved from pydantic_ai.models.wrapper to pydantic_ai.models (deprecated in 2.43). pydantic_ai.toolsets.fastmcp wasn't checked with the fastmcp extra installed.
_agent.py mirrors the full signatures of run / iter / run_stream / run_stream_events, and wraps toolsets (_toolset.py) and models (_model.py). V2 is a harness-first redesign around capabilities (see the upgrade guide), so signatures, toolset wrapping and model wrapping all need checking against 2.x, not just imports.
Pins and lock:pydantic-ai-slim (and possibly anthropic) in reboot/requirements.in and reboot/requirements-anthropic.in; regenerate reboot/requirements_lock.txt.
Remove the Agents: raise a cancelled run's ClosedResourceError as a cancellation #179 workaround in reboot/agents/pydantic_ai/_run.py (_raised_while_cancelling and the ClosedResourceError conversion) and its CancellationTestCase tests, or keep the tests asserting a cancelled run raises CancelledError.
Docs and examples: the Python skill references (reboot/plugin/skills/python/references/agent-pydantic-ai.md, agent-tools.md, testing-external-context.md), and examples that use agents (e.g. reboot/examples/agent-wiki, whose uv.lock resolves pydantic-ai-slim).
Dashboard: the static analysis in reboot/dashboard/backend/code_watcher.py recognizes Agent's entry points and tool registration by name (RUN_NAMES, TOOL_REGISTRATION_NAMES, constructor and run arguments); check those still match 2.x, and its test fixture of the agents module in tests/reboot/dashboard/code_watcher_tests.py.
Testing
//tests/reboot/agents/pydantic_ai/...
//tests/reboot/examples/agent-wiki:test and other agent examples
Summary
Reboot pins
pydantic-ai-slim==1.87.0(reboot/requirements.in), which pinspydantic-graph==1.87.0. pydantic-ai 2.0 is stable and upstream has moved on (latest is 2.43.0). We should upgrade, both to keep up and to pick up fixes we're currently working around.Why now
pydantic-graph 1.87.0 lets a cancelled agent run surface as
anyio.ClosedResourceErrorinstead ofasyncio.CancelledError: a tracked task sends its result into a stream the cancelled run has already closed, and onlyBrokenResourceErroris ignored there. A workflow that catches everything except cancellation then keeps running, which made//tests/reboot/examples/agent-wiki:testhang at shutdown. #179 works around it in_agent_run. The fix upstream first ships in pydantic-graph 2.2.0 (no 1.x release has it); once we're on it, the workaround in #179 can be removed.Picking a target
ClosedResourceErrorfixanthropicextra)httpxhttpxhttpx2>= 1.3reboot[anthropic]onanthropic==0.125.0(perrequirements.in/requirements-anthropic.in, Anthropic SDK 1.x rejects thehttpxclient pydantic-ai hands it before thehttpx2switch).anthropicextra to SDK 1.x andhttpx2.A reasonable path is to land 2.30.x first, then take the
httpx2/ Anthropic SDK 1.x step separately.What it takes
reboot/agents/pydantic_ai/, ~2,300 lines) — most of the work.pydantic_ai.tools.AgentBuiltinToolno longer exists andpydantic_ai.mcp.MCPServerno longer resolves;CompletedStreamedResponsemoved frompydantic_ai.models.wrappertopydantic_ai.models(deprecated in 2.43).pydantic_ai.toolsets.fastmcpwasn't checked with thefastmcpextra installed._agent.pymirrors the full signatures ofrun/iter/run_stream/run_stream_events, and wraps toolsets (_toolset.py) and models (_model.py). V2 is a harness-first redesign around capabilities (see the upgrade guide), so signatures, toolset wrapping and model wrapping all need checking against 2.x, not just imports.pydantic-ai-slim(and possiblyanthropic) inreboot/requirements.inandreboot/requirements-anthropic.in; regeneratereboot/requirements_lock.txt.ClosedResourceErroras a cancellation #179 workaround inreboot/agents/pydantic_ai/_run.py(_raised_while_cancellingand theClosedResourceErrorconversion) and itsCancellationTestCasetests, or keep the tests asserting a cancelled run raisesCancelledError.reboot/plugin/skills/python/references/agent-pydantic-ai.md,agent-tools.md,testing-external-context.md), and examples that use agents (e.g.reboot/examples/agent-wiki, whoseuv.lockresolvespydantic-ai-slim).reboot/dashboard/backend/code_watcher.pyrecognizesAgent's entry points and tool registration by name (RUN_NAMES,TOOL_REGISTRATION_NAMES, constructor and run arguments); check those still match 2.x, and its test fixture of the agents module intests/reboot/dashboard/code_watcher_tests.py.Testing
//tests/reboot/agents/pydantic_ai/...//tests/reboot/examples/agent-wiki:testand other agent examples//tests/reboot/dashboard:code_watcher_tests_py