Skip to content

feat: add id to Toolkit#8724

Open
ysolanky wants to merge 1 commit into
mainfrom
add-id-to-toolkits
Open

feat: add id to Toolkit#8724
ysolanky wants to merge 1 commit into
mainfrom
add-id-to-toolkits

Conversation

@ysolanky

@ysolanky ysolanky commented Jul 2, 2026

Copy link
Copy Markdown
Member

Summary

Adds an id field to the base Toolkit class so every toolkit has a stable identifier.

  • New id: Optional[str] = None parameter on Toolkit.__init__.
  • When not provided, id is generated deterministically from name via generate_id_from_name, mirroring how Agent, Team, and Workflow derive their ids.
  • id is included in Toolkit.__repr__.

Because all built-in toolkit subclasses forward **kwargs to super().__init__, id can be set on any toolkit (e.g. Calculator(id="...")) without further changes.

Type of change

  • Bug fix
  • New feature
  • Breaking change
  • Improvement
  • Model update
  • Other:

Checklist

  • Code complies with style guidelines
  • Ran format/validation scripts (./scripts/format.sh and ./scripts/validate.sh)
  • Self-review completed
  • Documentation updated (comments, docstrings)
  • Examples and guides: Relevant cookbook examples have been included or updated (if applicable)
  • Tested in clean environment
  • Tests added/updated (if applicable)

Duplicate and AI-Generated PR Check

  • I have searched existing open pull requests and confirmed that no other PR already addresses this issue
  • If a similar PR exists, I have explained below why this PR is a better approach
  • Check if this PR was entirely AI-generated (by Copilot, Claude Code, Cursor, etc.)

Additional Notes

The id parameter is inserted as the second positional argument (after name). All toolkit subclasses call super().__init__ with keyword arguments, so this ordering does not break any existing call site. Added unit tests covering auto-generated id, explicit id, and id in repr.

Add an id field to the base Toolkit class. When not provided, the id is
generated deterministically from the toolkit name via generate_id_from_name,
mirroring how Agent, Team, and Workflow derive their ids.
@ysolanky ysolanky requested a review from a team as a code owner July 2, 2026 20:50

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

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 automated review suggestions for this pull request.

Reviewed commit: 1365f52971

ℹ️ 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
  • 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 address that feedback".

def __init__(
self,
name: str = "toolkit",
id: Optional[str] = None,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep id keyword-only to preserve positional tools

When existing callers use the old public constructor form Toolkit("math", [add]), the second positional argument now binds to id instead of tools, so the toolkit silently registers no functions and stores the list as its id. This is a backwards-incompatible runtime regression for any positional tools callers; add id after the existing positional parameters or make it keyword-only.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant