chore: Uses pydantic Field for Agent configs, so that the generated AgentConfig.json json schema can carry field description

PiperOrigin-RevId: 797094012
This commit is contained in:
Wei Sun (Jack)
2025-08-19 18:03:47 -07:00
committed by Copybara-Service
parent bb8ebd15f9
commit 5b999ed6fd
7 changed files with 223 additions and 126 deletions
+29 -19
View File
@@ -24,6 +24,7 @@ from typing import Union
from pydantic import BaseModel
from pydantic import ConfigDict
from pydantic import Field
from ..utils.feature_decorator import experimental
from .common_configs import AgentRefConfig
@@ -43,32 +44,41 @@ class BaseAgentConfig(BaseModel):
extra='allow',
)
agent_class: Union[Literal['BaseAgent'], str] = 'BaseAgent'
"""Required. The class of the agent. The value is used to differentiate
among different agent classes."""
agent_class: Union[Literal['BaseAgent'], str] = Field(
default='BaseAgent',
description=(
'Required. The class of the agent. The value is used to differentiate'
' among different agent classes.'
),
)
name: str
"""Required. The name of the agent."""
name: str = Field(description='Required. The name of the agent.')
description: str = ''
"""Optional. The description of the agent."""
description: str = Field(
default='', description='Optional. The description of the agent.'
)
sub_agents: Optional[List[AgentRefConfig]] = None
"""Optional. The sub-agents of the agent."""
sub_agents: Optional[List[AgentRefConfig]] = Field(
default=None, description='Optional. The sub-agents of the agent.'
)
before_agent_callbacks: Optional[List[CodeConfig]] = None
"""Optional. The before_agent_callbacks of the agent.
before_agent_callbacks: Optional[List[CodeConfig]] = Field(
default=None,
description="""\
Optional. The before_agent_callbacks of the agent.
Example:
Example:
```
before_agent_callbacks:
- name: my_library.security_callbacks.before_agent_callback
```
"""
```
before_agent_callbacks:
- name: my_library.security_callbacks.before_agent_callback
```""",
)
after_agent_callbacks: Optional[List[CodeConfig]] = None
"""Optional. The after_agent_callbacks of the agent."""
after_agent_callbacks: Optional[List[CodeConfig]] = Field(
default=None,
description='Optional. The after_agent_callbacks of the agent.',
)
def to_agent_config(
self, custom_agent_config_cls: Type[TBaseAgentConfig]
@@ -409,14 +409,17 @@
}
],
"default": "BaseAgent",
"description": "Required. The class of the agent. The value is used to differentiate among different agent classes.",
"title": "Agent Class"
},
"name": {
"description": "Required. The name of the agent.",
"title": "Name",
"type": "string"
},
"description": {
"default": "",
"description": "Optional. The description of the agent.",
"title": "Description",
"type": "string"
},
@@ -433,6 +436,7 @@
}
],
"default": null,
"description": "Optional. The sub-agents of the agent.",
"title": "Sub Agents"
},
"before_agent_callbacks": {
@@ -448,6 +452,7 @@
}
],
"default": null,
"description": "Optional. The before_agent_callbacks of the agent.\n\nExample:\n\n ```\n before_agent_callbacks:\n - name: my_library.security_callbacks.before_agent_callback\n ```",
"title": "Before Agent Callbacks"
},
"after_agent_callbacks": {
@@ -463,6 +468,7 @@
}
],
"default": null,
"description": "Optional. The after_agent_callbacks of the agent.",
"title": "After Agent Callbacks"
}
},
@@ -2156,7 +2162,7 @@
}
],
"default": null,
"description": "Extra parameters to add to the request body.",
"description": "Extra parameters to add to the request body.\n The structure must match the backend API's request structure.\n - VertexAI backend API docs: https://cloud.google.com/vertex-ai/docs/reference/rest\n - GeminiAPI backend API docs: https://ai.google.dev/api/rest",
"title": "Extrabody"
},
"retryOptions": {
@@ -2349,6 +2355,7 @@
"properties": {
"agent_class": {
"default": "LlmAgent",
"description": "The value is used to uniquely identify the LlmAgent class. If it is empty, it is by default an LlmAgent.",
"enum": [
"LlmAgent",
""
@@ -2357,11 +2364,13 @@
"type": "string"
},
"name": {
"description": "Required. The name of the agent.",
"title": "Name",
"type": "string"
},
"description": {
"default": "",
"description": "Optional. The description of the agent.",
"title": "Description",
"type": "string"
},
@@ -2378,6 +2387,7 @@
}
],
"default": null,
"description": "Optional. The sub-agents of the agent.",
"title": "Sub Agents"
},
"before_agent_callbacks": {
@@ -2393,6 +2403,7 @@
}
],
"default": null,
"description": "Optional. The before_agent_callbacks of the agent.\n\nExample:\n\n ```\n before_agent_callbacks:\n - name: my_library.security_callbacks.before_agent_callback\n ```",
"title": "Before Agent Callbacks"
},
"after_agent_callbacks": {
@@ -2408,6 +2419,7 @@
}
],
"default": null,
"description": "Optional. The after_agent_callbacks of the agent.",
"title": "After Agent Callbacks"
},
"model": {
@@ -2420,9 +2432,11 @@
}
],
"default": null,
"description": "Optional. LlmAgent.model. If not set, the model will be inherited from the ancestor.",
"title": "Model"
},
"instruction": {
"description": "Required. LlmAgent.instruction.",
"title": "Instruction",
"type": "string"
},
@@ -2436,6 +2450,7 @@
}
],
"default": null,
"description": "Optional. LlmAgent.disallow_transfer_to_parent.",
"title": "Disallow Transfer To Parent"
},
"disallow_transfer_to_peers": {
@@ -2448,6 +2463,7 @@
}
],
"default": null,
"description": "Optional. LlmAgent.disallow_transfer_to_peers.",
"title": "Disallow Transfer To Peers"
},
"input_schema": {
@@ -2459,7 +2475,8 @@
"type": "null"
}
],
"default": null
"default": null,
"description": "Optional. LlmAgent.input_schema."
},
"output_schema": {
"anyOf": [
@@ -2470,7 +2487,8 @@
"type": "null"
}
],
"default": null
"default": null,
"description": "Optional. LlmAgent.output_schema."
},
"output_key": {
"anyOf": [
@@ -2482,10 +2500,12 @@
}
],
"default": null,
"description": "Optional. LlmAgent.output_key.",
"title": "Output Key"
},
"include_contents": {
"default": "default",
"description": "Optional. LlmAgent.include_contents.",
"enum": [
"default",
"none"
@@ -2497,7 +2517,7 @@
"anyOf": [
{
"items": {
"$ref": "#/$defs/google__adk__tools__base_tool__ToolConfig"
"$ref": "#/$defs/google__adk__tools__tool_configs__ToolConfig"
},
"type": "array"
},
@@ -2506,6 +2526,7 @@
}
],
"default": null,
"description": "Optional. LlmAgent.tools.\n\nExamples:\n\n For ADK built-in tools in `google.adk.tools` package, they can be referenced\n directly with the name:\n\n ```\n tools:\n - name: google_search\n - name: load_memory\n ```\n\n For user-defined tools, they can be referenced with fully qualified name:\n\n ```\n tools:\n - name: my_library.my_tools.my_tool\n ```\n\n For tools that needs to be created via functions:\n\n ```\n tools:\n - name: my_library.my_tools.create_tool\n args:\n - name: param1\n value: value1\n - name: param2\n value: value2\n ```\n\n For more advanced tools, instead of specifying arguments in config, it's\n recommended to define them in Python files and reference them. E.g.,\n\n ```\n # tools.py\n my_mcp_toolset = MCPToolset(\n connection_params=StdioServerParameters(\n command=\"npx\",\n args=[\"-y\", \"@notionhq/notion-mcp-server\"],\n env={\"OPENAPI_MCP_HEADERS\": NOTION_HEADERS},\n )\n )\n ```\n\n Then, reference the toolset in config:\n\n ```\n tools:\n - name: tools.my_mcp_toolset\n ```",
"title": "Tools"
},
"before_model_callbacks": {
@@ -2521,6 +2542,7 @@
}
],
"default": null,
"description": "Optional. LlmAgent.before_model_callbacks.\n\nExample:\n\n ```\n before_model_callbacks:\n - name: my_library.callbacks.before_model_callback\n ```",
"title": "Before Model Callbacks"
},
"after_model_callbacks": {
@@ -2536,6 +2558,7 @@
}
],
"default": null,
"description": "Optional. LlmAgent.after_model_callbacks.",
"title": "After Model Callbacks"
},
"before_tool_callbacks": {
@@ -2551,6 +2574,7 @@
}
],
"default": null,
"description": "Optional. LlmAgent.before_tool_callbacks.",
"title": "Before Tool Callbacks"
},
"after_tool_callbacks": {
@@ -2566,6 +2590,7 @@
}
],
"default": null,
"description": "Optional. LlmAgent.after_tool_callbacks.",
"title": "After Tool Callbacks"
},
"generate_content_config": {
@@ -2577,7 +2602,8 @@
"type": "null"
}
],
"default": null
"default": null,
"description": "Optional. LlmAgent.generate_content_config."
}
},
"required": [
@@ -2594,15 +2620,18 @@
"agent_class": {
"const": "LoopAgent",
"default": "LoopAgent",
"description": "The value is used to uniquely identify the LoopAgent class.",
"title": "Agent Class",
"type": "string"
},
"name": {
"description": "Required. The name of the agent.",
"title": "Name",
"type": "string"
},
"description": {
"default": "",
"description": "Optional. The description of the agent.",
"title": "Description",
"type": "string"
},
@@ -2619,6 +2648,7 @@
}
],
"default": null,
"description": "Optional. The sub-agents of the agent.",
"title": "Sub Agents"
},
"before_agent_callbacks": {
@@ -2634,6 +2664,7 @@
}
],
"default": null,
"description": "Optional. The before_agent_callbacks of the agent.\n\nExample:\n\n ```\n before_agent_callbacks:\n - name: my_library.security_callbacks.before_agent_callback\n ```",
"title": "Before Agent Callbacks"
},
"after_agent_callbacks": {
@@ -2649,6 +2680,7 @@
}
],
"default": null,
"description": "Optional. The after_agent_callbacks of the agent.",
"title": "After Agent Callbacks"
},
"max_iterations": {
@@ -2661,6 +2693,7 @@
}
],
"default": null,
"description": "Optional. LoopAgent.max_iterations.",
"title": "Max Iterations"
}
},
@@ -2743,15 +2776,18 @@
"agent_class": {
"const": "ParallelAgent",
"default": "ParallelAgent",
"description": "The value is used to uniquely identify the ParallelAgent class.",
"title": "Agent Class",
"type": "string"
},
"name": {
"description": "Required. The name of the agent.",
"title": "Name",
"type": "string"
},
"description": {
"default": "",
"description": "Optional. The description of the agent.",
"title": "Description",
"type": "string"
},
@@ -2768,6 +2804,7 @@
}
],
"default": null,
"description": "Optional. The sub-agents of the agent.",
"title": "Sub Agents"
},
"before_agent_callbacks": {
@@ -2783,6 +2820,7 @@
}
],
"default": null,
"description": "Optional. The before_agent_callbacks of the agent.\n\nExample:\n\n ```\n before_agent_callbacks:\n - name: my_library.security_callbacks.before_agent_callback\n ```",
"title": "Before Agent Callbacks"
},
"after_agent_callbacks": {
@@ -2798,6 +2836,7 @@
}
],
"default": null,
"description": "Optional. The after_agent_callbacks of the agent.",
"title": "After Agent Callbacks"
}
},
@@ -3643,15 +3682,18 @@
"agent_class": {
"const": "SequentialAgent",
"default": "SequentialAgent",
"description": "The value is used to uniquely identify the SequentialAgent class.",
"title": "Agent Class",
"type": "string"
},
"name": {
"description": "Required. The name of the agent.",
"title": "Name",
"type": "string"
},
"description": {
"default": "",
"description": "Optional. The description of the agent.",
"title": "Description",
"type": "string"
},
@@ -3668,6 +3710,7 @@
}
],
"default": null,
"description": "Optional. The sub-agents of the agent.",
"title": "Sub Agents"
},
"before_agent_callbacks": {
@@ -3683,6 +3726,7 @@
}
],
"default": null,
"description": "Optional. The before_agent_callbacks of the agent.\n\nExample:\n\n ```\n before_agent_callbacks:\n - name: my_library.security_callbacks.before_agent_callback\n ```",
"title": "Before Agent Callbacks"
},
"after_agent_callbacks": {
@@ -3698,6 +3742,7 @@
}
],
"default": null,
"description": "Optional. The after_agent_callbacks of the agent.",
"title": "After Agent Callbacks"
}
},
@@ -3889,7 +3934,7 @@
},
"ToolArgsConfig": {
"additionalProperties": true,
"description": "The configuration for tool arguments.\n\nThis config allows arbitrary key-value pairs as tool arguments.",
"description": "Config to host free key-value pairs for the args in ToolConfig.",
"properties": {},
"title": "ToolArgsConfig",
"type": "object"
@@ -4248,11 +4293,12 @@
"title": "VoiceConfig",
"type": "object"
},
"google__adk__tools__base_tool__ToolConfig": {
"google__adk__tools__tool_configs__ToolConfig": {
"additionalProperties": false,
"description": "The configuration for a tool.\n\nThe config supports these types of tools:\n1. ADK built-in tools\n2. User-defined tool instances\n3. User-defined tool classes\n4. User-defined functions that generate tool instances\n5. User-defined function tools\n\nFor examples:\n\n 1. For ADK built-in tool instances or classes in `google.adk.tools` package,\n they can be referenced directly with the `name` and optionally with\n `config`.\n\n ```\n tools:\n - name: google_search\n - name: AgentTool\n config:\n agent: ./another_agent.yaml\n skip_summarization: true\n ```\n\n 2. For user-defined tool instances, the `name` is the fully qualified path\n to the tool instance.\n\n ```\n tools:\n - name: my_package.my_module.my_tool\n ```\n\n 3. For user-defined tool classes (custom tools), the `name` is the fully\n qualified path to the tool class and `config` is the arguments for the tool.\n\n ```\n tools:\n - name: my_package.my_module.my_tool_class\n config:\n my_tool_arg1: value1\n my_tool_arg2: value2\n ```\n\n 4. For user-defined functions that generate tool instances, the `name` is the\n fully qualified path to the function and `config` is passed to the function\n as arguments.\n\n ```\n tools:\n - name: my_package.my_module.my_tool_function\n config:\n my_function_arg1: value1\n my_function_arg2: value2\n ```\n\n The function must have the following signature:\n ```\n def my_function(config: ToolArgsConfig) -> BaseTool:\n ...\n ```\n\n 5. For user-defined function tools, the `name` is the fully qualified path\n to the function.\n\n ```\n tools:\n - name: my_package.my_module.my_function_tool\n ```",
"description": "The configuration for a tool.\n\nThe config supports these types of tools:\n1. ADK built-in tools\n2. User-defined tool instances\n3. User-defined tool classes\n4. User-defined functions that generate tool instances\n5. User-defined function tools\n\nFor examples:\n\n 1. For ADK built-in tool instances or classes in `google.adk.tools` package,\n they can be referenced directly with the `name` and optionally with\n `args`.\n\n ```\n tools:\n - name: google_search\n - name: AgentTool\n args:\n agent: ./another_agent.yaml\n skip_summarization: true\n ```\n\n 2. For user-defined tool instances, the `name` is the fully qualified path\n to the tool instance.\n\n ```\n tools:\n - name: my_package.my_module.my_tool\n ```\n\n 3. For user-defined tool classes (custom tools), the `name` is the fully\n qualified path to the tool class and `args` is the arguments for the tool.\n\n ```\n tools:\n - name: my_package.my_module.my_tool_class\n args:\n my_tool_arg1: value1\n my_tool_arg2: value2\n ```\n\n 4. For user-defined functions that generate tool instances, the `name` is\n the fully qualified path to the function and `args` is passed to the\n function as arguments.\n\n ```\n tools:\n - name: my_package.my_module.my_tool_function\n args:\n my_function_arg1: value1\n my_function_arg2: value2\n ```\n\n The function must have the following signature:\n ```\n def my_function(args: ToolArgsConfig) -> BaseTool:\n ...\n ```\n\n 5. For user-defined function tools, the `name` is the fully qualified path\n to the function.\n\n ```\n tools:\n - name: my_package.my_module.my_function_tool\n ```\n\n If the above use cases don't suffice, users can define a custom tool config\n by extending BaseToolConfig and override from_config() in the custom tool.",
"properties": {
"name": {
"description": "The name of the tool.\n\nFor ADK built-in tools, `name` is the name of the tool, e.g. `google_search`\nor `AgentTool`.\n\nFor user-defined tools, the name is the fully qualified path to the tool, e.g.\n`my_package.my_module.my_tool`.",
"title": "Name",
"type": "string"
},
@@ -4265,7 +4311,8 @@
"type": "null"
}
],
"default": null
"default": null,
"description": "The args for the tool."
}
},
"required": [
+106 -83
View File
@@ -21,6 +21,7 @@ from typing import Optional
from google.genai import types
from pydantic import ConfigDict
from pydantic import Field
from ..tools.tool_configs import ToolConfig
from .base_agent_config import BaseAgentConfig
@@ -36,109 +37,131 @@ class LlmAgentConfig(BaseAgentConfig):
extra='forbid',
)
agent_class: Literal['LlmAgent', ''] = 'LlmAgent'
"""The value is used to uniquely identify the LlmAgent class. If it is
empty, it is by default an LlmAgent."""
agent_class: Literal['LlmAgent', ''] = Field(
default='LlmAgent',
description=(
'The value is used to uniquely identify the LlmAgent class. If it is'
' empty, it is by default an LlmAgent.'
),
)
model: Optional[str] = None
"""Optional. LlmAgent.model. If not set, the model will be inherited from
the ancestor."""
model: Optional[str] = Field(
default=None,
description=(
'Optional. LlmAgent.model. If not set, the model will be inherited'
' from the ancestor.'
),
)
instruction: str
"""Required. LlmAgent.instruction."""
instruction: str = Field(description='Required. LlmAgent.instruction.')
disallow_transfer_to_parent: Optional[bool] = None
"""Optional. LlmAgent.disallow_transfer_to_parent."""
disallow_transfer_to_parent: Optional[bool] = Field(
default=None,
description='Optional. LlmAgent.disallow_transfer_to_parent.',
)
disallow_transfer_to_peers: Optional[bool] = None
"""Optional. LlmAgent.disallow_transfer_to_peers."""
disallow_transfer_to_peers: Optional[bool] = Field(
default=None, description='Optional. LlmAgent.disallow_transfer_to_peers.'
)
input_schema: Optional[CodeConfig] = None
"""Optional. LlmAgent.input_schema."""
input_schema: Optional[CodeConfig] = Field(
default=None, description='Optional. LlmAgent.input_schema.'
)
output_schema: Optional[CodeConfig] = None
"""Optional. LlmAgent.output_schema."""
output_schema: Optional[CodeConfig] = Field(
default=None, description='Optional. LlmAgent.output_schema.'
)
output_key: Optional[str] = None
"""Optional. LlmAgent.output_key."""
output_key: Optional[str] = Field(
default=None, description='Optional. LlmAgent.output_key.'
)
include_contents: Literal['default', 'none'] = 'default'
"""Optional. LlmAgent.include_contents."""
include_contents: Literal['default', 'none'] = Field(
default='default', description='Optional. LlmAgent.include_contents.'
)
tools: Optional[list[ToolConfig]] = None
"""Optional. LlmAgent.tools.
tools: Optional[list[ToolConfig]] = Field(
default=None,
description="""\
Optional. LlmAgent.tools.
Examples:
Examples:
For ADK built-in tools in `google.adk.tools` package, they can be referenced
directly with the name:
```
tools:
- name: google_search
- name: load_memory
```
For user-defined tools, they can be referenced with fully qualified name:
```
tools:
- name: my_library.my_tools.my_tool
```
For tools that needs to be created via functions:
```
tools:
- name: my_library.my_tools.create_tool
args:
- name: param1
value: value1
- name: param2
value: value2
```
For more advanced tools, instead of specifying arguments in config, it's
recommended to define them in Python files and reference them. E.g.,
```
# tools.py
my_mcp_toolset = MCPToolset(
connection_params=StdioServerParameters(
command="npx",
args=["-y", "@notionhq/notion-mcp-server"],
env={"OPENAPI_MCP_HEADERS": NOTION_HEADERS},
)
)
```
Then, reference the toolset in config:
For ADK built-in tools in `google.adk.tools` package, they can be referenced
directly with the name:
```
tools:
- name: tools.my_mcp_toolset
- name: google_search
- name: load_memory
```
"""
before_model_callbacks: Optional[List[CodeConfig]] = None
"""Optional. LlmAgent.before_model_callbacks.
Example:
For user-defined tools, they can be referenced with fully qualified name:
```
before_model_callbacks:
- name: my_library.callbacks.before_model_callback
tools:
- name: my_library.my_tools.my_tool
```
"""
after_model_callbacks: Optional[List[CodeConfig]] = None
"""Optional. LlmAgent.after_model_callbacks."""
For tools that needs to be created via functions:
before_tool_callbacks: Optional[List[CodeConfig]] = None
"""Optional. LlmAgent.before_tool_callbacks."""
```
tools:
- name: my_library.my_tools.create_tool
args:
- name: param1
value: value1
- name: param2
value: value2
```
after_tool_callbacks: Optional[List[CodeConfig]] = None
"""Optional. LlmAgent.after_tool_callbacks."""
For more advanced tools, instead of specifying arguments in config, it's
recommended to define them in Python files and reference them. E.g.,
generate_content_config: Optional[types.GenerateContentConfig] = None
"""Optional. LlmAgent.generate_content_config."""
```
# tools.py
my_mcp_toolset = MCPToolset(
connection_params=StdioServerParameters(
command="npx",
args=["-y", "@notionhq/notion-mcp-server"],
env={"OPENAPI_MCP_HEADERS": NOTION_HEADERS},
)
)
```
Then, reference the toolset in config:
```
tools:
- name: tools.my_mcp_toolset
```""",
)
before_model_callbacks: Optional[List[CodeConfig]] = Field(
default=None,
description="""\
Optional. LlmAgent.before_model_callbacks.
Example:
```
before_model_callbacks:
- name: my_library.callbacks.before_model_callback
```""",
)
after_model_callbacks: Optional[List[CodeConfig]] = Field(
default=None, description='Optional. LlmAgent.after_model_callbacks.'
)
before_tool_callbacks: Optional[List[CodeConfig]] = Field(
default=None, description='Optional. LlmAgent.before_tool_callbacks.'
)
after_tool_callbacks: Optional[List[CodeConfig]] = Field(
default=None, description='Optional. LlmAgent.after_tool_callbacks.'
)
generate_content_config: Optional[types.GenerateContentConfig] = Field(
default=None, description='Optional. LlmAgent.generate_content_config.'
)
+8 -3
View File
@@ -20,6 +20,7 @@ from typing import Literal
from typing import Optional
from pydantic import ConfigDict
from pydantic import Field
from ..utils.feature_decorator import experimental
from .base_agent_config import BaseAgentConfig
@@ -33,7 +34,11 @@ class LoopAgentConfig(BaseAgentConfig):
extra='forbid',
)
agent_class: Literal['LoopAgent'] = 'LoopAgent'
agent_class: Literal['LoopAgent'] = Field(
default='LoopAgent',
description='The value is used to uniquely identify the LoopAgent class.',
)
max_iterations: Optional[int] = None
"""Optional. LoopAgent.max_iterations."""
max_iterations: Optional[int] = Field(
default=None, description='Optional. LoopAgent.max_iterations.'
)
@@ -19,6 +19,7 @@ from __future__ import annotations
from typing import Literal
from pydantic import ConfigDict
from pydantic import Field
from ..utils.feature_decorator import experimental
from .base_agent_config import BaseAgentConfig
@@ -32,4 +33,9 @@ class ParallelAgentConfig(BaseAgentConfig):
extra='forbid',
)
agent_class: Literal['ParallelAgent'] = 'ParallelAgent'
agent_class: Literal['ParallelAgent'] = Field(
default='ParallelAgent',
description=(
'The value is used to uniquely identify the ParallelAgent class.'
),
)
@@ -19,6 +19,7 @@ from __future__ import annotations
from typing import Literal
from pydantic import ConfigDict
from pydantic import Field
from ..agents.base_agent import experimental
from ..agents.base_agent_config import BaseAgentConfig
@@ -32,4 +33,9 @@ class SequentialAgentConfig(BaseAgentConfig):
extra='forbid',
)
agent_class: Literal['SequentialAgent'] = 'SequentialAgent'
agent_class: Literal['SequentialAgent'] = Field(
default='SequentialAgent',
description=(
'The value is used to uniquely identify the SequentialAgent class.'
),
)
+10 -10
View File
@@ -18,6 +18,7 @@ from typing import Optional
from pydantic import BaseModel
from pydantic import ConfigDict
from pydantic import Field
from ..utils.feature_decorator import experimental
@@ -27,7 +28,6 @@ class BaseToolConfig(BaseModel):
"""The base class for all tool configs."""
model_config = ConfigDict(extra="forbid")
"""Forbid extra fields."""
@experimental
@@ -114,15 +114,15 @@ class ToolConfig(BaseModel):
model_config = ConfigDict(extra="forbid")
name: str
"""The name of the tool.
name: str = Field(description="""\
The name of the tool.
For ADK built-in tools, `name` is the name of the tool, e.g. `google_search`
or `AgentTool`.
For ADK built-in tools, `name` is the name of the tool, e.g. `google_search`
or `AgentTool`.
For user-defined tools, the name is the fully qualified path to the tool, e.g.
`my_package.my_module.my_tool`.
"""
For user-defined tools, the name is the fully qualified path to the tool, e.g.
`my_package.my_module.my_tool`.""")
args: Optional[ToolArgsConfig] = None
"""The args for the tool."""
args: Optional[ToolArgsConfig] = Field(
default=None, description="The args for the tool."
)