Skip to content

add id to tools #4653

Merged
theomonnom merged 2 commits intomainfrom
theo/add-tool-ids
Jan 30, 2026
Merged

add id to tools #4653
theomonnom merged 2 commits intomainfrom
theo/add-tool-ids

Conversation

@theomonnom
Copy link
Member

@theomonnom theomonnom commented Jan 29, 2026

Summary by CodeRabbit

  • New Features

    • Tools and toolsets now expose stable unique identifiers for improved management and event/context handling.
  • Chores

    • Initialization across plugins and providers updated to assign explicit IDs and harmonize serialization of tool data.
  • Tests

    • Test fixtures updated to reflect identifier-based construction and toolset IDs.

✏️ Tip: You can customize this high-level summary in your review settings.

@chenghao-mou chenghao-mou requested a review from a team January 29, 2026 18:09
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 29, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

Tool identity was formalized: the base Tool now requires an id property; ProviderTool, Toolset, and function-based tools propagate and expose IDs. Multiple provider plugin tool classes were updated to initialize explicit IDs; tests adjusted to construct tools/toolsets with ids.

Changes

Cohort / File(s) Summary
Core Tool Framework
livekit-agents/livekit/agents/llm/tool_context.py
Added abstract id property to Tool; ProviderTool and Toolset now accept/store id; _BaseFunctionTool exposes id; function-tool wiring updated to propagate tool names/ids.
Agent Beta Tool
livekit-agents/livekit/agents/beta/tools/end_call.py
EndCallTool now passes explicit id="end_call" to its superclass constructor.
Google Plugin Tools
livekit-plugins/livekit-plugins-google/livekit/plugins/google/tools.py
Several dataclasses now call super().__init__(id=...) via __init__/__post_init__ to set gemini_* ids; FileSearch gains file_search_store_names: list[str].
OpenAI Plugin Tools
livekit-plugins/livekit-plugins-openai/livekit/plugins/openai/tools.py
Removed slots=True from several dataclasses; added __post_init__ to set openai_* ids; FileSearch gets vector_store_ids (default empty list); CodeInterpreter.container default set to None.
xAI Plugin Tools
livekit-plugins/livekit-plugins-xai/livekit/plugins/xai/tools.py
Removed slots=True; added __post_init__ to set xai_* ids; FileSearch.to_dict now includes vector_store_ids and conditionally max_num_results.
Tests / Mocks
tests/test_tools.py
Updated DummyProviderTool to accept id and call super().__init__(id=...); added __init__ to MockToolset1/MockToolset2 to set toolset ids.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • add id to tools  #4653 — Adds explicit id handling across Tool hierarchy and updates tool constructors (closely related code-level changes).
  • move xAI tools to separate file #4624 — Modifies xAI plugin tool classes (WebSearch/XSearch/FileSearch) with dataclass and initialization changes (overlaps with xAI updates here).

Suggested reviewers

  • davidzhao
  • toubatbrian

Poem

🐰 I hop through code with nimble feet,
Giving every tool a name that's neat.
From gemini to openai's light,
xAI joins the labeled sight,
IDs snug, the system sings delight! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 2.38% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the core objective: introducing an id property to tools throughout the codebase.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch theo/add-tool-ids

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d31b847 and 5c944c5.

📒 Files selected for processing (2)
  • livekit-agents/livekit/agents/llm/tool_context.py
  • tests/test_tools.py

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

Tip

🧪 Unit Test Generation v2 is now available!

We have significantly improved our unit test generation capabilities.

To enable: Add this to your .coderabbit.yaml configuration:

reviews:
  finishing_touches:
    unit_tests:
      enabled: true

Try it out by using the @coderabbitai generate unit tests command on your code files or under ✨ Finishing Touches on the walkthrough!

Have feedback? Share your thoughts on our Discord thread!


Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@toubatbrian toubatbrian left a comment

Choose a reason for hiding this comment

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

I accidentally used my personal account to approve ^ 🥲

@theomonnom theomonnom merged commit 02bd7e4 into main Jan 30, 2026
15 of 17 checks passed
@theomonnom theomonnom deleted the theo/add-tool-ids branch January 30, 2026 00:09
@theomonnom
Copy link
Member Author

Thanks!

zach-iee pushed a commit to sendbird/livekit-agents that referenced this pull request Feb 2, 2026
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.

3 participants