Skip to content

Commit 54cc849

Browse files
google-genai-botcopybara-github
authored andcommitted
feat: Add metadata field to ADK BaseTool
PiperOrigin-RevId: 791790030
1 parent e73d71d commit 54cc849

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

src/google/adk/runners.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ class Runner:
7171
plugin_manager: The plugin manager for the runner.
7272
session_service: The session service for the runner.
7373
memory_service: The memory service for the runner.
74+
credential_service: The credential service for the runner.
7475
"""
7576

7677
app_name: str
@@ -104,9 +105,11 @@ def __init__(
104105
Args:
105106
app_name: The application name of the runner.
106107
agent: The root agent to run.
108+
plugins: A list of plugins for the runner.
107109
artifact_service: The artifact service for the runner.
108110
session_service: The session service for the runner.
109111
memory_service: The memory service for the runner.
112+
credential_service: The credential service for the runner.
110113
"""
111114
self.app_name = app_name
112115
self.agent = agent

src/google/adk/tools/base_tool.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,27 @@ class BaseTool(ABC):
5656
"""Whether the tool is a long running operation, which typically returns a
5757
resource id first and finishes the operation later."""
5858

59-
def __init__(self, *, name, description, is_long_running: bool = False):
59+
custom_metadata: Optional[dict[str, Any]] = None
60+
"""The custom metadata of the BaseTool.
61+
62+
An optional key-value pair for storing and retrieving tool-specific metadata,
63+
such as tool manifests, etc.
64+
65+
NOTE: the entire dict must be JSON serializable.
66+
"""
67+
68+
def __init__(
69+
self,
70+
*,
71+
name,
72+
description,
73+
is_long_running: bool = False,
74+
custom_metadata: Optional[dict[str, Any]] = None,
75+
):
6076
self.name = name
6177
self.description = description
6278
self.is_long_running = is_long_running
79+
self.custom_metadata = custom_metadata
6380

6481
def _get_declaration(self) -> Optional[types.FunctionDeclaration]:
6582
"""Gets the OpenAPI specification of this tool in the form of a FunctionDeclaration.

0 commit comments

Comments
 (0)