Add opt-in id parameter to ToolCall.from_name#349
Merged
jamesbraza merged 1 commit intomainfrom Apr 7, 2026
Merged
Conversation
Matches the existing pattern in `ToolCall.from_tool`, which already accepts an optional `id` kwarg. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR aligns ToolCall.from_name with ToolCall.from_tool by allowing callers to optionally supply a pre-existing/deterministic tool-call ID instead of always auto-generating one.
Changes:
- Add an optional ID argument to
ToolCall.from_name, falling back togenerate_id()when not provided. - Extend tool serialization tests to verify custom IDs propagate through execution and into
ToolResponseMessage.tool_call_id.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/aviary/tools/base.py |
Adds an optional identifier parameter to ToolCall.from_name and uses it when provided. |
tests/test_tools.py |
Adds a subtest ensuring a custom tool-call ID is preserved through tool execution/response. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
id parameter to ToolCall.from_namecall_id parameter to ToolCall.from_name
f2ae15b to
dc5eddd
Compare
call_id parameter to ToolCall.from_nameid parameter to ToolCall.from_name
sidnarayanan
approved these changes
Apr 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ToolCall.from_toolalready accepts an optionalidkwarg, butToolCall.from_namealways auto-generated one. This adds the same opt-in pattern tofrom_namefor callers that need a deterministic or pre-existing tool call ID.🤖 Generated with Claude Code