-
Notifications
You must be signed in to change notification settings - Fork 2.4k
[WIP] Tool guardrails #1606
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
base: main
Are you sure you want to change the base?
[WIP] Tool guardrails #1606
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.
Codex Review: Here are some suggestions.
Reply with @codex fix comments
to fix any unresolved comments.
About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you open a pull request for review, mark a draft as ready, or comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex fix this CI failure" or "@codex address that feedback".
if final_result is None: | ||
# 2) Actually run the tool | ||
await asyncio.gather( | ||
hooks.on_tool_start(tool_context, agent, func_tool), | ||
( | ||
agent.hooks.on_tool_start(tool_context, agent, func_tool) | ||
if agent.hooks | ||
else _coro.noop_coroutine() | ||
), | ||
) | ||
real_result = await func_tool.on_invoke_tool( |
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.
[P1] Run tool start hooks concurrently with tool execution again
The run pipeline now awaits both hooks.on_tool_start
callbacks to finish before invoking the tool itself. The docstring for RunHooksBase.on_tool_start
states that these callbacks are “called concurrently with tool invocation,” and prior code used asyncio.gather
to dispatch the start hooks and the tool coroutine together. After the guardrail refactor, the call at lines 579‑588 completes before func_tool.on_invoke_tool
is awaited, so any slow hook will delay the actual tool call and violate the documented contract. Please launch the tool invocation concurrently with the start hooks (as before) or otherwise ensure the hook cannot block the tool run.
Useful? React with 👍 / 👎.
This PR is stale because it has been open for 10 days with no activity. |
No description provided.