We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5608a0d commit 2345c4cCopy full SHA for 2345c4c
pydantic_ai_slim/pydantic_ai/agent.py
@@ -1792,9 +1792,11 @@ async def __aenter__(self) -> Self:
1792
"""
1793
async with self._enter_lock:
1794
if self._entered_count == 0:
1795
- self._exit_stack = AsyncExitStack()
1796
- toolset = self._get_toolset()
1797
- await self._exit_stack.enter_async_context(toolset)
+ async with AsyncExitStack() as exit_stack:
+ toolset = self._get_toolset()
+ await exit_stack.enter_async_context(toolset)
1798
+
1799
+ self._exit_stack = exit_stack.pop_all()
1800
self._entered_count += 1
1801
return self
1802
0 commit comments