-
Notifications
You must be signed in to change notification settings - Fork 2k
Add tool call parameters for on_tool_start
hook
#253
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?
Conversation
@yanmxa thanks for doing this work, very useful! |
fccd3fa
to
656f211
Compare
much needed feature! |
I learned that if you use Example: result = Runner.run_streamed(
agent,
input,
)
async for event in result.stream_events():
if event.type == "run_item_stream_event":
if event.name == "tool_called":
print(
f"-- Tool {event.item.raw_item.name} was called with args: {event.item.raw_item.arguments} "
)
elif event.name == "reasoning_item_created":
summary = event.item.raw_item.summary
# there’s at least one summary part
# o-series models will send this every response, it is sometimes blank
if summary:
text = summary[0].text
print(f"-- Reasoning item created: {text}")
print("--")
elif event.name == "message_output_created":
print(event.item.raw_item.content[0].text)
else:
pass # Ignore other event types |
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.
Apologies for missing this PR. It looks good, but is a breaking change. We could certainly make a breaking change but I'd like to avoid it unless absolutely necessary. Another option could be to add a new method for the args. Thoughts on which would be better?
Thanks @rm-openai! I tend to favor the breaking change approach because:
The community feedback shows this is needed. A clean break now might be better than API fragmentation. What do you think? |
- Fix import sorting in multiple files - Remove duplicate ResponseComputerToolCall import - Organize imports according to ruff rules 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Function tools should use tool_context (ToolContext) - Computer/shell tools use context_wrapper (RunContextWrapper) - This maintains consistency with original codebase 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Remove .vscode/ directory and all IDE-specific configuration - These files should not be included in the repository 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Resolve: #252