-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Always enter Toolset context when running agent #2361
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@strawgate Thanks William!
It would be beneficial for my dynamic toolset pr if the agent always entered the toolset context instead of only the first time the context is activated and then we document that the toolset contexts must be reentrant / idempotent as discussed in the #2337 |
24acc2d
to
707d4c3
Compare
I really thought you could pop() context managers off an ExitStack but you can't, so any contexts accumulated into an exitstack can only be exited all at once. So I think instead of entering the agent in This results in the same behavior where it matters for this but is sad because entering the Agent's context felt like a pretty clean way to handle it. Also sorry for the force push... |
@strawgate Thanks William! |
build()
does not enter toolset context #2337Always enter the Agent's context in
.iter
-- this allows us to remove the need for the MCP Toolset to enter its context in get_tools -- which I believe was resulting in startup/shutdown for everyget_tools
call.Using
async with
for MCP is still nice to share an instance of the mcp server across agents runs