File tree Expand file tree Collapse file tree 1 file changed +4
-0
lines changed
pydantic_ai_slim/pydantic_ai Expand file tree Collapse file tree 1 file changed +4
-0
lines changed Original file line number Diff line number Diff line change @@ -1788,6 +1788,7 @@ def is_end_node(
1788
1788
return isinstance (node , End )
1789
1789
1790
1790
async def __aenter__ (self ) -> Self :
1791
+ """Enter the agent. This will start all [`MCPServerStdio`s][pydantic_ai.mcp.MCPServerStdio] registered with the agent so they can be used in a run."""
1791
1792
if self ._running_count == 0 :
1792
1793
self ._exit_stack = AsyncExitStack ()
1793
1794
await self ._exit_stack .enter_async_context (self ._toolset )
@@ -1828,6 +1829,9 @@ async def run_mcp_servers(
1828
1829
) -> AsyncIterator [None ]:
1829
1830
"""Run [`MCPServerStdio`s][pydantic_ai.mcp.MCPServerStdio] so they can be used by the agent.
1830
1831
1832
+ Deprecated: use [`async with agent`][pydantic_ai.agent.Agent.__aenter__] instead.
1833
+ If you need to set a sampling model on all MCP servers, use [`agent.set_mcp_sampling_model(...)`][pydantic_ai.agent.Agent.set_mcp_sampling_model].
1834
+
1831
1835
Returns: a context manager to start and shutdown the servers.
1832
1836
"""
1833
1837
try :
You can’t perform that action at this time.
0 commit comments