Submodules¶
google.adk.a2a module¶
google.adk.agents module¶
- pydantic model google.adk.agents.BaseAgent¶
Bases:
BaseNode,ABCBase class for all agents in Agent Development Kit.
Show JSON schema
{ "$defs": { "BaseAgent": { "additionalProperties": false, "description": "Base class for all agents in Agent Development Kit.", "properties": { "name": { "title": "Name", "type": "string" }, "description": { "default": "", "title": "Description", "type": "string" }, "rerun_on_resume": { "default": false, "title": "Rerun On Resume", "type": "boolean" }, "wait_for_output": { "default": false, "title": "Wait For Output", "type": "boolean" }, "retry_config": { "anyOf": [ { "$ref": "#/$defs/RetryConfig" }, { "type": "null" } ], "default": null }, "timeout": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "title": "Timeout" }, "input_schema": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "$ref": "#/$defs/Schema" }, { "type": "null" } ], "default": null, "title": "Input Schema" }, "output_schema": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "$ref": "#/$defs/Schema" }, { "type": "null" } ], "default": null, "title": "Output Schema" }, "state_schema": { "anyOf": [ {}, { "type": "null" } ], "default": null, "title": "State Schema" }, "parent_agent": { "anyOf": [ { "$ref": "#/$defs/BaseAgent" }, { "type": "null" } ], "default": null }, "sub_agents": { "items": { "$ref": "#/$defs/BaseAgent" }, "title": "Sub Agents", "type": "array" }, "before_agent_callback": { "default": null, "title": "Before Agent Callback", "type": "null" }, "after_agent_callback": { "default": null, "title": "After Agent Callback", "type": "null" } }, "required": [ "name" ], "title": "BaseAgent", "type": "object" }, "RetryConfig": { "description": "Configuration for retrying a node.", "properties": { "max_attempts": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Maximum number of attempts, including the original request.\n If 0 or 1, it means no retries. If not specified, default to 5.", "title": "Max Attempts" }, "initial_delay": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Initial delay before the first retry, in fractions of a second. If not specified, default to 1.0 second.", "title": "Initial Delay" }, "max_delay": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Maximum delay between retries, in fractions of a second. If not specified, default to 60.0 seconds.", "title": "Max Delay" }, "backoff_factor": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Multiplier by which the delay increases after each attempt. If not specified, default to 2.0.", "title": "Backoff Factor" }, "jitter": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Randomness factor for the delay. If not specified, default to 1.0. Otherwise use 0.0 to remove randomness.", "title": "Jitter" }, "exceptions": { "anyOf": [ { "items": { "anyOf": [ { "type": "string" }, {} ] }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Exceptions to retry on. Accepts exception class names as\n strings (e.g. ``['ValueError']``) or exception classes directly (e.g.\n ``[ValueError]``). ``None`` means retry on all exceptions.", "title": "Exceptions" } }, "title": "RetryConfig", "type": "object" }, "Schema": { "additionalProperties": false, "description": "Schema is used to define the format of input/output data.\n\nRepresents a select subset of an [OpenAPI 3.0 schema\nobject](https://spec.openapis.org/oas/v3.0.3#schema-object). More fields may\nbe added in the future as needed.", "properties": { "additionalProperties": { "anyOf": [ {}, { "type": "null" } ], "default": null, "description": "Optional. Can either be a boolean or an object; controls the presence of additional properties.", "title": "Additionalproperties" }, "defs": { "anyOf": [ { "additionalProperties": { "$ref": "#/$defs/Schema" }, "type": "object" }, { "type": "null" } ], "default": null, "description": "Optional. A map of definitions for use by `ref` Only allowed at the root of the schema.", "title": "Defs" }, "ref": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. Allows indirect references between schema nodes. The value should be a valid reference to a child of the root `defs`. For example, the following schema defines a reference to a schema node named \"Pet\": type: object properties: pet: ref: #/defs/Pet defs: Pet: type: object properties: name: type: string The value of the \"pet\" property is a reference to the schema node named \"Pet\". See details in https://json-schema.org/understanding-json-schema/structuring", "title": "Ref" }, "anyOf": { "anyOf": [ { "items": { "$ref": "#/$defs/Schema" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Optional. The instance must be valid against any (one or more) of the subschemas listed in `any_of`.", "title": "Anyof" }, "default": { "anyOf": [ {}, { "type": "null" } ], "default": null, "description": "Optional. Default value to use if the field is not specified.", "title": "Default" }, "description": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. Describes the data. The model uses this field to understand the purpose of the schema and how to use it. It is a best practice to provide a clear and descriptive explanation for the schema and its properties here, rather than in the prompt.", "title": "Description" }, "enum": { "anyOf": [ { "items": { "type": "string" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Optional. Possible values of the field. This field can be used to restrict a value to a fixed set of values. To mark a field as an enum, set `format` to `enum` and provide the list of possible values in `enum`. For example: 1. To define directions: `{type:STRING, format:enum, enum:[\"EAST\", \"NORTH\", \"SOUTH\", \"WEST\"]}` 2. To define apartment numbers: `{type:INTEGER, format:enum, enum:[\"101\", \"201\", \"301\"]}`", "title": "Enum" }, "example": { "anyOf": [ {}, { "type": "null" } ], "default": null, "description": "Optional. Example of an instance of this schema.", "title": "Example" }, "format": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. The format of the data. For `NUMBER` type, format can be `float` or `double`. For `INTEGER` type, format can be `int32` or `int64`. For `STRING` type, format can be `email`, `byte`, `date`, `date-time`, `password`, and other formats to further refine the data type.", "title": "Format" }, "items": { "anyOf": [ { "$ref": "#/$defs/Schema" }, { "type": "null" } ], "default": null, "description": "Optional. If type is `ARRAY`, `items` specifies the schema of elements in the array." }, "maxItems": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Optional. If type is `ARRAY`, `max_items` specifies the maximum number of items in an array.", "title": "Maxitems" }, "maxLength": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Optional. If type is `STRING`, `max_length` specifies the maximum length of the string.", "title": "Maxlength" }, "maxProperties": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Optional. If type is `OBJECT`, `max_properties` specifies the maximum number of properties that can be provided.", "title": "Maxproperties" }, "maximum": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Optional. If type is `INTEGER` or `NUMBER`, `maximum` specifies the maximum allowed value.", "title": "Maximum" }, "minItems": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Optional. If type is `ARRAY`, `min_items` specifies the minimum number of items in an array.", "title": "Minitems" }, "minLength": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Optional. If type is `STRING`, `min_length` specifies the minimum length of the string.", "title": "Minlength" }, "minProperties": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Optional. If type is `OBJECT`, `min_properties` specifies the minimum number of properties that can be provided.", "title": "Minproperties" }, "minimum": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Optional. If type is `INTEGER` or `NUMBER`, `minimum` specifies the minimum allowed value.", "title": "Minimum" }, "nullable": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "description": "Optional. Indicates if the value of this field can be null.", "title": "Nullable" }, "pattern": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. If type is `STRING`, `pattern` specifies a regular expression that the string must match.", "title": "Pattern" }, "properties": { "anyOf": [ { "additionalProperties": { "$ref": "#/$defs/Schema" }, "type": "object" }, { "type": "null" } ], "default": null, "description": "Optional. If type is `OBJECT`, `properties` is a map of property names to schema definitions for each property of the object.", "title": "Properties" }, "propertyOrdering": { "anyOf": [ { "items": { "type": "string" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Optional. Order of properties displayed or used where order matters. This is not a standard field in OpenAPI specification, but can be used to control the order of properties.", "title": "Propertyordering" }, "required": { "anyOf": [ { "items": { "type": "string" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Optional. If type is `OBJECT`, `required` lists the names of properties that must be present.", "title": "Required" }, "title": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. Title for the schema.", "title": "Title" }, "type": { "anyOf": [ { "$ref": "#/$defs/Type" }, { "type": "null" } ], "default": null, "description": "Optional. Data type of the schema field." } }, "title": "Schema", "type": "object" }, "Type": { "description": "Data type of the schema field.", "enum": [ "TYPE_UNSPECIFIED", "STRING", "NUMBER", "INTEGER", "BOOLEAN", "ARRAY", "OBJECT", "NULL" ], "title": "Type", "type": "string" } }, "$ref": "#/$defs/BaseAgent" }
- Fields:
after_agent_callback (Callable[[google.adk.agents.context.Context], Awaitable[google.genai.types.Content | None] | google.genai.types.Content | None] | list[Callable[[google.adk.agents.context.Context], Awaitable[google.genai.types.Content | None] | google.genai.types.Content | None]] | None)before_agent_callback (Callable[[google.adk.agents.context.Context], Awaitable[google.genai.types.Content | None] | google.genai.types.Content | None] | list[Callable[[google.adk.agents.context.Context], Awaitable[google.genai.types.Content | None] | google.genai.types.Content | None]] | None)description (str)name (str)parent_agent (google.adk.agents.base_agent.BaseAgent | None)sub_agents (list[google.adk.agents.base_agent.BaseAgent])
- Validators:
_validate_name»namevalidate_name»namevalidate_sub_agents_unique_names»sub_agents
- field after_agent_callback: Optional[AfterAgentCallback] = None¶
Callback or list of callbacks to be invoked after the agent run.
When a list of callbacks is provided, the callbacks will be called in the order they are listed until a callback does not return None.
- Parameters:
callback_context – MUST be named ‘callback_context’ (enforced).
- Returns:
- The content to return to the user.
When the content is present, an additional event with the provided content will be appended to event history as an additional agent response.
- Return type:
Optional[types.Content]
- field before_agent_callback: Optional[BeforeAgentCallback] = None¶
Callback or list of callbacks to be invoked before the agent run.
When a list of callbacks is provided, the callbacks will be called in the order they are listed until a callback does not return None.
- Parameters:
callback_context – MUST be named ‘callback_context’ (enforced).
- Returns:
- The content to return to the user.
When the content is present, the agent run will be skipped and the provided content will be returned to user.
- Return type:
Optional[types.Content]
- field description: str = ''¶
Description about the agent’s capability.
The model uses this to determine whether to delegate control to the agent. One-line description is enough and preferred.
- field name: str [Required]¶
The agent’s name.
Agent name must be a Python identifier and unique within the agent tree. Agent name cannot be “user”, since it’s reserved for end-user’s input.
- Validated by:
_validate_namevalidate_name
- field parent_agent: Optional[BaseAgent] = None¶
The parent agent of this agent.
Note that an agent can ONLY be added as sub-agent once.
If you want to add one agent twice as sub-agent, consider to create two agent instances with identical config, but with different name and add them to the agent tree.
- field sub_agents: list[BaseAgent] [Optional]¶
The sub-agents of this agent.
- Validated by:
validate_sub_agents_unique_names
- config_type¶
alias of
BaseAgentConfig
- classmethod from_config(cls, config, config_abs_path)¶
Creates an agent from a config.
If sub-classes use a custom agent config, override _parse_config to return updated kwargs for the agent constructor.
- Return type:
TypeVar(SelfAgent, bound= BaseAgent)- Parameters:
config – The config to create the agent from.
config_abs_path – The absolute path to the config file that contains the agent config.
- Returns:
The created agent.
- validator validate_name » name¶
- Return type:
str
- validator validate_sub_agents_unique_names » sub_agents¶
Validates that all sub-agents have unique names.
- Return type:
list[BaseAgent]- Parameters:
value – The list of sub-agents to validate.
- Returns:
The validated list of sub-agents.
- clone(update=None)¶
Creates a copy of this agent instance.
- Return type:
TypeVar(SelfAgent, bound= BaseAgent)- Parameters:
update – Optional mapping of new values for the fields of the cloned agent. The keys of the mapping are the names of the fields to be updated, and the values are the new values for those fields. For example: {“name”: “cloned_agent”}
- Returns:
A new agent instance with identical configuration as the original agent except for the fields specified in the update.
- find_agent(name)¶
Finds the agent with the given name in this agent and its descendants.
- Return type:
Optional[BaseAgent]- Parameters:
name – The name of the agent to find.
- Returns:
The agent with the matching name, or None if no such agent is found.
- find_sub_agent(name)¶
Finds the agent with the given name in this agent’s descendants.
- Return type:
Optional[BaseAgent]- Parameters:
name – The name of the agent to find.
- Returns:
The agent with the matching name, or None if no such agent is found.
- model_post_init(_BaseAgent__context)¶
Override this method to perform additional initialization after __init__ and model_construct. This is useful if you want to do some validation that requires the entire model to be initialized.
- Return type:
None
- async run_async(parent_context)¶
Entry method to run an agent via text-based conversation.
- Return type:
AsyncGenerator[Event,None]- Parameters:
parent_context – InvocationContext, the invocation context of the parent agent.
- Yields:
Event – the events generated by the agent.
- async run_live(parent_context)¶
Entry method to run an agent via video/audio-based conversation.
- Return type:
AsyncGenerator[Event,None]- Parameters:
parent_context – InvocationContext, the invocation context of the parent agent.
- Yields:
Event – the events generated by the agent.
- property canonical_after_agent_callbacks: list[Callable[[Context], Awaitable[Content | None] | Content | None]]¶
The resolved self.after_agent_callback field as a list of _SingleAgentCallback.
This method is only for use by Agent Development Kit.
- pydantic model google.adk.agents.BaseAgentConfig¶
Bases:
BaseModelThe config for the YAML schema of a BaseAgent.
Do not use this class directly. It’s the base class for all agent configs.
Show JSON schema
{ "title": "BaseAgentConfig", "description": "The config for the YAML schema of a BaseAgent.\n\nDo not use this class directly. It's the base class for all agent configs.", "type": "object", "properties": { "agent_class": { "anyOf": [ { "const": "BaseAgent", "type": "string" }, { "type": "string" } ], "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" }, "sub_agents": { "anyOf": [ { "items": { "$ref": "#/$defs/AgentRefConfig" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Optional. The sub-agents of the agent.", "title": "Sub Agents" }, "before_agent_callbacks": { "anyOf": [ { "items": { "$ref": "#/$defs/CodeConfig" }, "type": "array" }, { "type": "null" } ], "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": { "anyOf": [ { "items": { "$ref": "#/$defs/CodeConfig" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Optional. The after_agent_callbacks of the agent.", "title": "After Agent Callbacks" } }, "$defs": { "AgentRefConfig": { "additionalProperties": false, "description": "The config for the reference to another agent.", "properties": { "config_path": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Config Path" }, "code": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Code" } }, "title": "AgentRefConfig", "type": "object" }, "CodeConfig": { "additionalProperties": false, "description": "Code reference config for a variable, a function, or a class.\n\nOnly references an object by name. YAML cannot pass constructor args; to\nuse a configured object, build it in Python and reference its FQN here.", "properties": { "name": { "title": "Name", "type": "string" } }, "required": [ "name" ], "title": "CodeConfig", "type": "object" } }, "additionalProperties": true, "deprecated": true, "required": [ "name" ] }
- Fields:
after_agent_callbacks (List[google.adk.agents.common_configs.CodeConfig] | None)agent_class (Literal['BaseAgent'] | str)before_agent_callbacks (List[google.adk.agents.common_configs.CodeConfig] | None)description (str)name (str)sub_agents (List[google.adk.agents.common_configs.AgentRefConfig] | None)
- field after_agent_callbacks: Optional[List[CodeConfig]] = None¶
Optional. The after_agent_callbacks of the agent.
- field agent_class: Union[Literal['BaseAgent'], str] = 'BaseAgent'¶
Required. The class of the agent. The value is used to differentiate among different agent classes.
- field before_agent_callbacks: Optional[List[CodeConfig]] = None¶
Optional. The before_agent_callbacks of the agent.
Example:
- field description: str = ''¶
Optional. The description of the agent.
- field name: str [Required]¶
Required. The name of the agent.
- field sub_agents: Optional[List[AgentRefConfig]] = None¶
Optional. The sub-agents of the agent.
- class google.adk.agents.Context(invocation_context, *, event_actions=None, function_call_id=None, tool_confirmation=None, parent_ctx=None, node=None, node_path=None, run_id='', resume_inputs=None, attempt_count=1, use_as_output=False)¶
Bases:
ReadonlyContextThe context within an agent run.
When used in a workflow, additional fields under the
Workflow-specific fieldssection are available.Initializes the Context.
- Parameters:
invocation_context – The invocation context.
event_actions – The event actions for state and artifact deltas.
function_call_id – The function call id of the current tool call. Required for tool-specific methods like request_credential and request_confirmation.
tool_confirmation – The tool confirmation of the current tool call.
parent_ctx – The parent node’s Context.
node – The current node.
node_path – The path of the current node in the workflow graph. If not provided, it will be derived from parent_ctx and node.
run_id – The execution ID of the current node.
resume_inputs – Inputs for resuming node, keyed by interrupt id.
attempt_count – Number of times this node has been attempted.
use_as_output – If True, this node’s output also represents the parent node’s output.
- property actions: EventActions¶
The event actions for the current context.
- async add_events_to_memory(*, events, custom_metadata=None)¶
Adds an explicit list of events to the memory service.
Uses this callback’s current session identifiers as memory scope.
- Return type:
None- Parameters:
events – Explicit events to add to memory.
custom_metadata – Optional metadata forwarded to the configured memory service. Supported keys are implementation-specific.
- Raises:
ValueError – If memory service is not available.
- async add_memory(*, memories, custom_metadata=None)¶
Adds explicit memory items directly to the memory service.
Uses this callback’s current session identifiers as memory scope.
- Return type:
None- Parameters:
memories – Explicit memory items to add.
custom_metadata – Optional metadata forwarded to the configured memory service. Supported keys are implementation-specific.
- Raises:
ValueError – If memory service is not available.
- async add_session_to_memory()¶
Triggers memory generation for the current session.
This method saves the current session’s events to the memory service, enabling the agent to recall information from past interactions.
- Return type:
None- Raises:
ValueError – If memory service is not available.
Example
```python async def my_after_agent_callback(ctx: Context):
# Save conversation to memory at the end of each interaction await ctx.add_session_to_memory()
- property attempt_count: int¶
Returns the current attempt number (1-based).
- property branch: str | None¶
The branch path of the current invocation context.
- property custom_metadata: dict[str, Any]¶
Returns the custom metadata dictionary.
- property error: Exception | None¶
The exception raised by the node, if any.
- property error_node_path: str¶
The path of the node that failed.
- property event_author: str¶
Author name stamped on events emitted by this node.
Set by the orchestrator to override the default (node name). For example, Workflow sets this to its own name so all child events appear under the workflow’s author.
Empty string means use the node’s own name (default).
- property function_call_id: str | None¶
The function call id of the current tool call.
- async get_artifact_version(filename, version=None)¶
Gets artifact version info.
- Return type:
ArtifactVersion|None- Parameters:
filename – The filename of the artifact.
version – The version of the artifact. If None, the latest version will be returned.
- Returns:
The artifact version info.
- get_auth_response(auth_config)¶
Gets the auth response credential from session state.
This method retrieves an authentication credential that was previously stored in session state after a user completed an OAuth flow or other authentication process.
- Return type:
AuthCredential|None- Parameters:
auth_config – The authentication configuration for the credential.
- Returns:
The auth credential from the auth response, or None if not found.
- get_invocation_context()¶
Returns a copy of the invocation context with the proxy session.
- Return type:
- property interrupt_ids: set[str]¶
Interrupt IDs accumulated during this execution. Read-only.
Set by the framework when the node yields an Event with long_running_tool_ids.
- property isolation_scope: str | None¶
Scope tag inherited from parent or set explicitly via override.
See
Event.isolation_scopefor format.⚠️ DO NOT USE THIS DIRECTLY. Internal mechanism, may change.
- async list_artifacts()¶
Lists the filenames of the artifacts attached to the current session.
- Return type:
list[str]
- async load_artifact(filename, version=None)¶
Loads an artifact attached to the current session.
- Return type:
Part|None- Parameters:
filename – The filename of the artifact.
version – The version of the artifact. If None, the latest version will be returned.
- Returns:
The artifact.
- async load_credential(auth_config)¶
Loads a credential from the credential service.
- Return type:
AuthCredential|None- Parameters:
auth_config – The authentication configuration for the credential.
- Returns:
The loaded credential, or None if not found.
- property node_path: str¶
Returns the path of the current node in the workflow graph.
- property output: Any¶
The node’s result value. Source of truth for node output.
Set once per run. Also set by the framework when the node yields Event(output=X) or yields a raw value. If the value was set via yield, the output Event is already enqueued. If set directly, the framework emits the output Event after _run_impl returns.
Raises ValueError if: - Set a second time (at most one output per execution). - Set when interrupt_ids is non-empty (output and interrupt
are mutually exclusive).
- render_ui_widget(ui_widget)¶
Adds a UI widget to the current event’s actions for the UI to render.
UI widgets provide rendering payload/metadata that the UI Host uses to display rich interactive components (e.g., MCP App iframes) alongside agent responses.
- Return type:
None- Parameters:
ui_widget – A
UiWidgetinstance.
- request_confirmation(*, hint=None, payload=None)¶
Requests confirmation for the current tool call.
This method can only be called in a tool context where function_call_id is set.
- Return type:
None- Parameters:
hint – A hint to the user on how to confirm the tool call.
payload – The payload used to confirm the tool call.
- Raises:
ValueError – If function_call_id is not set.
- request_credential(auth_config)¶
Requests a credential for the current tool call.
This method can only be called in a tool context where function_call_id is set. For callback contexts, use save_credential/load_credential instead.
- Return type:
None- Parameters:
auth_config – The authentication configuration for the credential.
- Raises:
ValueError – If function_call_id is not set.
- property resume_inputs: dict[str, Any]¶
Returns inputs for resuming node, keyed by interrupt id.
- property route: bool | int | str | list[bool | int | str] | None¶
Routing value for conditional edges.
Read by the orchestrator to decide which downstream edge to follow. Can be set independently of output.
- property run_id: str¶
Returns the execution ID of the current node.
- async run_node(node, node_input=None, *, use_as_output=False, run_id=None, use_sub_branch=False, override_branch=None, override_isolation_scope=None, raise_on_wait=False)¶
Executes a node dynamically.
This method allows a node within a workflow to trigger the run of another node (or a callable that can be built into a node) and asynchronously wait for its result. The dynamically executed node becomes a child run of the current node in the workflow.
IMPORTANT: Always
awaitthis method directly. Wrapping it inasyncio.create_task()means the task runs unsupervised — errors are silently swallowed and the task is not cancelled if the parent node is interrupted (e.g. via HITL).- Return type:
Any- Parameters:
node – The node to be executed. This can be a BaseNode instance or a callable that can be built into a node.
node_input – The input data to be passed to the dynamically executed node. Defaults to None.
use_as_output – If True, the dynamic node’s output is used as the calling node’s output. The calling node’s own output event is suppressed to avoid duplication.
run_id – An optional custom run ID for the dynamic node execution. If not provided, a default run ID is generated. Useful for correlating events across runs.
use_sub_branch – If True, the dynamic node will be executed in a sub-branch to isolate its state and events from the main branch.
override_branch – An optional branch to use instead of parent’s branch.
override_isolation_scope – An optional isolation scope to use instead of the parent’s scope.
raise_on_wait – If True, raises NodeInterruptedError when the child node is WAITING instead of returning None.
- Returns:
The output of the dynamically executed node, once it finishes executing.
- async save_artifact(filename, artifact, custom_metadata=None)¶
Saves an artifact and records it as delta for the current session.
- Return type:
int- Parameters:
filename – The filename of the artifact.
artifact – The artifact to save.
custom_metadata – Custom metadata to associate with the artifact.
- Returns:
The version of the artifact.
- async save_credential(auth_config)¶
Saves a credential to the credential service.
- Return type:
None- Parameters:
auth_config – The authentication configuration containing the credential.
- async search_memory(query)¶
Searches the memory of the current user.
- Return type:
SearchMemoryResponse- Parameters:
query – The search query.
- Returns:
The search results from the memory service.
- Raises:
ValueError – If memory service is not available.
- property state: State¶
The delta-aware state of the current session.
For any state change, you can mutate this object directly, e.g. ctx.state[‘foo’] = ‘bar’
- property telemetry_context: TelemetryContext¶
Returns the telemetry context.
- property tool_confirmation: ToolConfirmation | None¶
The tool confirmation of the current tool call.
- pydantic model google.adk.agents.InvocationContext¶
Bases:
BaseModelAn invocation context represents the data of a single invocation of an agent.
- An invocation:
Starts with a user message and ends with a final response.
Can contain one or multiple agent calls.
Is handled by runner.run_async().
An invocation runs an agent until it does not request to transfer to another agent.
- An agent call:
Is handled by agent.run().
Ends when agent.run() ends.
An LLM agent call is an agent with a BaseLLMFlow. An LLM agent call can contain one or multiple steps.
- An LLM agent runs steps in a loop until:
A final response is generated.
The agent transfers to another agent.
The end_invocation is set to true by any callbacks or tools.
- A step:
Calls the LLM only once and yields its response.
Calls the tools and yields their responses if requested.
The summarization of the function response is considered another step, since it is another llm call. A step ends when it’s done calling llm and tools, or if the end_invocation is set to true at any time.
- ```
┌─────────────────────── invocation ──────────────────────────┐ ┌──────────── llm_agent_call_1 ────────────┐ ┌─ agent_call_2 ─┐ ┌──── step_1 ────────┐ ┌───── step_2 ──────┐ [call_llm] [call_tool] [call_llm] [transfer]
Show JSON schema
{ "title": "InvocationContext", "type": "object", "properties": { "artifact_service": { "default": null, "title": "Artifact Service" }, "session_service": { "default": null, "title": "Session Service" }, "memory_service": { "default": null, "title": "Memory Service" }, "credential_service": { "default": null, "title": "Credential Service" }, "context_cache_config": { "default": null, "title": "Context Cache Config" }, "invocation_id": { "title": "Invocation Id", "type": "string" }, "branch": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Branch" }, "isolation_scope": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Isolation Scope" }, "agent": { "anyOf": [ { "$ref": "#/$defs/BaseAgent" }, { "$ref": "#/$defs/BaseNode" }, { "type": "null" } ], "default": null, "title": "Agent" }, "user_content": { "anyOf": [ { "$ref": "#/$defs/Content" }, { "type": "null" } ], "default": null }, "session": { "$ref": "#/$defs/Session" }, "node_path": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Node Path" }, "agent_states": { "additionalProperties": { "additionalProperties": true, "type": "object" }, "title": "Agent States", "type": "object" }, "end_of_agents": { "additionalProperties": { "type": "boolean" }, "title": "End Of Agents", "type": "object" }, "end_invocation": { "default": false, "title": "End Invocation", "type": "boolean" }, "live_request_queue": { "default": null, "title": "Live Request Queue" }, "active_streaming_tools": { "default": null, "title": "Active Streaming Tools" }, "active_non_blocking_tool_tasks": { "default": null, "title": "Active Non Blocking Tool Tasks" }, "transcription_cache": { "anyOf": [ { "items": { "$ref": "#/$defs/TranscriptionEntry" }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Transcription Cache" }, "live_session_resumption_handle": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Live Session Resumption Handle" }, "input_realtime_cache": { "anyOf": [ { "items": { "$ref": "#/$defs/RealtimeCacheEntry" }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Input Realtime Cache" }, "output_realtime_cache": { "anyOf": [ { "items": { "$ref": "#/$defs/RealtimeCacheEntry" }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Output Realtime Cache" }, "run_config": { "default": null, "title": "Run Config" }, "resumability_config": { "anyOf": [ { "$ref": "#/$defs/ResumabilityConfig" }, { "type": "null" } ], "default": null }, "events_compaction_config": { "default": null, "title": "Events Compaction Config" }, "token_compaction_checked": { "default": false, "title": "Token Compaction Checked", "type": "boolean" }, "plugin_manager": { "default": null, "title": "Plugin Manager" }, "canonical_tools_cache": { "default": null, "title": "Canonical Tools Cache" }, "credential_by_key": { "additionalProperties": { "$ref": "#/$defs/AuthCredential" }, "title": "Credential By Key", "type": "object" } }, "$defs": { "AuthCredential": { "additionalProperties": true, "description": "Data class representing an authentication credential.\n\nTo exchange for the actual credential, please use\nCredentialExchanger.exchange_credential().\n\nExamples: API Key Auth\nAuthCredential(\n auth_type=AuthCredentialTypes.API_KEY,\n api_key=\"1234\",\n)\n\nExample: HTTP Auth\nAuthCredential(\n auth_type=AuthCredentialTypes.HTTP,\n http=HttpAuth(\n scheme=\"basic\",\n credentials=HttpCredentials(username=\"user\", password=\"password\"),\n ),\n)\n\nExample: OAuth2 Bearer Token in HTTP Header\nAuthCredential(\n auth_type=AuthCredentialTypes.HTTP,\n http=HttpAuth(\n scheme=\"bearer\",\n credentials=HttpCredentials(token=\"eyAkaknabna....\"),\n ),\n)\n\nExample: OAuth2 Auth with Authorization Code Flow\nAuthCredential(\n auth_type=AuthCredentialTypes.OAUTH2,\n oauth2=OAuth2Auth(\n client_id=\"1234\",\n client_secret=\"secret\",\n ),\n)\n\nExample: OpenID Connect Auth\nAuthCredential(\n auth_type=AuthCredentialTypes.OPEN_ID_CONNECT,\n oauth2=OAuth2Auth(\n client_id=\"1234\",\n client_secret=\"secret\",\n redirect_uri=\"https://example.com\",\n scopes=[\"scope1\", \"scope2\"],\n ),\n)\n\nExample: Auth with resource reference\nAuthCredential(\n auth_type=AuthCredentialTypes.API_KEY,\n resource_ref=\"projects/1234/locations/us-central1/resources/resource1\",\n)", "properties": { "authType": { "$ref": "#/$defs/AuthCredentialTypes" }, "resourceRef": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Resourceref" }, "apiKey": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Apikey" }, "http": { "anyOf": [ { "$ref": "#/$defs/HttpAuth" }, { "type": "null" } ], "default": null }, "serviceAccount": { "anyOf": [ { "$ref": "#/$defs/ServiceAccount" }, { "type": "null" } ], "default": null }, "oauth2": { "anyOf": [ { "$ref": "#/$defs/OAuth2Auth" }, { "type": "null" } ], "default": null } }, "required": [ "authType" ], "title": "AuthCredential", "type": "object" }, "AuthCredentialTypes": { "description": "Represents the type of authentication credential.", "enum": [ "apiKey", "http", "oauth2", "openIdConnect", "serviceAccount" ], "title": "AuthCredentialTypes", "type": "string" }, "BaseAgent": { "additionalProperties": false, "description": "Base class for all agents in Agent Development Kit.", "properties": { "name": { "title": "Name", "type": "string" }, "description": { "default": "", "title": "Description", "type": "string" }, "rerun_on_resume": { "default": false, "title": "Rerun On Resume", "type": "boolean" }, "wait_for_output": { "default": false, "title": "Wait For Output", "type": "boolean" }, "retry_config": { "anyOf": [ { "$ref": "#/$defs/RetryConfig" }, { "type": "null" } ], "default": null }, "timeout": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "title": "Timeout" }, "input_schema": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "$ref": "#/$defs/Schema" }, { "type": "null" } ], "default": null, "title": "Input Schema" }, "output_schema": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "$ref": "#/$defs/Schema" }, { "type": "null" } ], "default": null, "title": "Output Schema" }, "state_schema": { "anyOf": [ {}, { "type": "null" } ], "default": null, "title": "State Schema" }, "parent_agent": { "anyOf": [ { "$ref": "#/$defs/BaseAgent" }, { "type": "null" } ], "default": null }, "sub_agents": { "items": { "$ref": "#/$defs/BaseAgent" }, "title": "Sub Agents", "type": "array" }, "before_agent_callback": { "default": null, "title": "Before Agent Callback", "type": "null" }, "after_agent_callback": { "default": null, "title": "After Agent Callback", "type": "null" } }, "required": [ "name" ], "title": "BaseAgent", "type": "object" }, "BaseNode": { "description": "A base class for all nodes in the workflow graph.", "properties": { "name": { "title": "Name", "type": "string" }, "description": { "default": "", "title": "Description", "type": "string" }, "rerun_on_resume": { "default": false, "title": "Rerun On Resume", "type": "boolean" }, "wait_for_output": { "default": false, "title": "Wait For Output", "type": "boolean" }, "retry_config": { "anyOf": [ { "$ref": "#/$defs/RetryConfig" }, { "type": "null" } ], "default": null }, "timeout": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "title": "Timeout" }, "input_schema": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "$ref": "#/$defs/Schema" }, { "type": "null" } ], "default": null, "title": "Input Schema" }, "output_schema": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "$ref": "#/$defs/Schema" }, { "type": "null" } ], "default": null, "title": "Output Schema" }, "state_schema": { "anyOf": [ {}, { "type": "null" } ], "default": null, "title": "State Schema" } }, "required": [ "name" ], "title": "BaseNode", "type": "object" }, "Blob": { "additionalProperties": false, "description": "A content blob.\n\nA Blob contains data of a specific media type. It is used to represent images,\naudio, and video.", "properties": { "data": { "anyOf": [ { "format": "base64url", "type": "string" }, { "type": "null" } ], "default": null, "description": "Required. The raw bytes of the data.", "title": "Data" }, "displayName": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. The display name of the blob. Used to provide a label or filename to distinguish blobs. This field is only returned in `PromptMessage` for prompt management. It is used in the Gemini calls only when server-side tools (`code_execution`, `google_search`, and `url_context`) are enabled. This field is not supported in Gemini API.", "title": "Displayname" }, "mimeType": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Required. The IANA standard MIME type of the source data.", "title": "Mimetype" } }, "title": "Blob", "type": "object" }, "CacheMetadata": { "additionalProperties": false, "description": "Metadata for context cache associated with LLM responses.\n\nThis class stores cache identification, usage tracking, and lifecycle\ninformation for a particular cache instance. It can be in two states:\n\n1. Active cache state: cache_name is set, all fields populated\n2. Fingerprint-only state: cache_name is None, only fingerprint and\n contents_count are set for prefix matching\n\nToken counts (cached and total) are available in the LlmResponse.usage_metadata\nand should be accessed from there to avoid duplication.\n\nAttributes:\n cache_name: The full resource name of the cached content (e.g.,\n 'projects/123/locations/us-central1/cachedContents/456').\n None when no active cache exists (fingerprint-only state).\n expire_time: Unix timestamp when the cache expires. None when no\n active cache exists.\n fingerprint: Hash of cacheable contents (instruction + tools + contents).\n Always present for prefix matching.\n invocations_used: Number of invocations this cache has been used for.\n None when no active cache exists.\n contents_count: Number of contents. When active cache exists, this is\n the count of cached contents. When no active cache exists, this is\n the count of the cacheable content prefix used for fingerprinting.\n created_at: Unix timestamp when the cache was created. None when\n no active cache exists.", "properties": { "cache_name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Full resource name of the cached content (None if no active cache)", "title": "Cache Name" }, "expire_time": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Unix timestamp when cache expires (None if no active cache)", "title": "Expire Time" }, "fingerprint": { "description": "Hash of cacheable contents used to detect changes", "title": "Fingerprint", "type": "string" }, "invocations_used": { "anyOf": [ { "minimum": 0, "type": "integer" }, { "type": "null" } ], "default": null, "description": "Number of invocations this cache has been used for (None if no active cache)", "title": "Invocations Used" }, "contents_count": { "description": "Number of contents (cached contents when active cache exists, cacheable content prefix when no active cache)", "minimum": 0, "title": "Contents Count", "type": "integer" }, "created_at": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Unix timestamp when cache was created (None if no active cache)", "title": "Created At" } }, "required": [ "fingerprint", "contents_count" ], "title": "CacheMetadata", "type": "object" }, "Citation": { "additionalProperties": false, "description": "A citation for a piece of generatedcontent.\n\nThis data type is not supported in Gemini API.", "properties": { "endIndex": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Output only. The end index of the citation in the content.", "title": "Endindex" }, "license": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Output only. The license of the source of the citation.", "title": "License" }, "publicationDate": { "anyOf": [ { "$ref": "#/$defs/GoogleTypeDate" }, { "type": "null" } ], "default": null, "description": "Output only. The publication date of the source of the citation." }, "startIndex": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Output only. The start index of the citation in the content.", "title": "Startindex" }, "title": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Output only. The title of the source of the citation.", "title": "Title" }, "uri": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Output only. The URI of the source of the citation.", "title": "Uri" } }, "title": "Citation", "type": "object" }, "CitationMetadata": { "additionalProperties": false, "description": "Citation information when the model quotes another source.", "properties": { "citations": { "anyOf": [ { "items": { "$ref": "#/$defs/Citation" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Contains citation information when the model directly quotes, at\n length, from another source. Can include traditional websites and code\n repositories.\n ", "title": "Citations" } }, "title": "CitationMetadata", "type": "object" }, "CodeExecutionResult": { "additionalProperties": false, "description": "Result of executing the ExecutableCode.\n\nGenerated only when the `CodeExecution` tool is used.", "properties": { "outcome": { "anyOf": [ { "$ref": "#/$defs/Outcome" }, { "type": "null" } ], "default": null, "description": "Required. Outcome of the code execution." }, "output": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. Contains stdout when code execution is successful, stderr or other description otherwise.", "title": "Output" }, "id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. The identifier of the `ExecutableCode` part this result is for. Only populated if the corresponding `ExecutableCode` has an id. This field is not supported in Vertex AI.", "title": "Id" } }, "title": "CodeExecutionResult", "type": "object" }, "Content": { "additionalProperties": false, "description": "Contains the multi-part content of a message.", "properties": { "parts": { "anyOf": [ { "items": { "$ref": "#/$defs/Part" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "List of parts that constitute a single message. Each part may have\n a different IANA MIME type.", "title": "Parts" }, "role": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. The producer of the content. Must be either 'user' or 'model'. If not set, the service will default to 'user'.", "title": "Role" } }, "title": "Content", "type": "object" }, "Event": { "description": "Represents an event in a conversation between agents and users.\n\nIt is used to store the content of the conversation, as well as the actions\ntaken by the agents like function calls, etc.", "properties": { "modelVersion": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Modelversion" }, "content": { "anyOf": [ { "$ref": "#/$defs/Content" }, { "type": "null" } ], "default": null }, "groundingMetadata": { "anyOf": [ { "$ref": "#/$defs/GroundingMetadata" }, { "type": "null" } ], "default": null }, "partial": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "title": "Partial" }, "turnComplete": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "title": "Turncomplete" }, "turnCompleteReason": { "anyOf": [ { "$ref": "#/$defs/TurnCompleteReason" }, { "type": "null" } ], "default": null }, "finishReason": { "anyOf": [ { "$ref": "#/$defs/FinishReason" }, { "type": "null" } ], "default": null }, "errorCode": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Errorcode" }, "errorMessage": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Errormessage" }, "interrupted": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "title": "Interrupted" }, "customMetadata": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "type": "null" } ], "default": null, "title": "Custommetadata" }, "usageMetadata": { "anyOf": [ { "$ref": "#/$defs/GenerateContentResponseUsageMetadata" }, { "type": "null" } ], "default": null }, "liveSessionResumptionUpdate": { "anyOf": [ { "$ref": "#/$defs/LiveServerSessionResumptionUpdate" }, { "type": "null" } ], "default": null }, "liveSessionId": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Livesessionid" }, "goAway": { "anyOf": [ { "$ref": "#/$defs/LiveServerGoAway" }, { "type": "null" } ], "default": null }, "voiceActivity": { "anyOf": [ { "$ref": "#/$defs/VoiceActivity" }, { "type": "null" } ], "default": null }, "inputTranscription": { "anyOf": [ { "$ref": "#/$defs/Transcription" }, { "type": "null" } ], "default": null }, "outputTranscription": { "anyOf": [ { "$ref": "#/$defs/Transcription" }, { "type": "null" } ], "default": null }, "avgLogprobs": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "title": "Avglogprobs" }, "logprobsResult": { "anyOf": [ { "$ref": "#/$defs/LogprobsResult" }, { "type": "null" } ], "default": null }, "cacheMetadata": { "anyOf": [ { "$ref": "#/$defs/CacheMetadata" }, { "type": "null" } ], "default": null }, "citationMetadata": { "anyOf": [ { "$ref": "#/$defs/CitationMetadata" }, { "type": "null" } ], "default": null }, "interactionId": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Interactionid" }, "environmentId": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Environmentid" }, "invocationId": { "default": "", "title": "Invocationid", "type": "string" }, "author": { "default": "", "title": "Author", "type": "string" }, "actions": { "$ref": "#/$defs/EventActions" }, "output": { "anyOf": [ {}, { "type": "null" } ], "default": null, "title": "Output" }, "nodeInfo": { "$ref": "#/$defs/NodeInfo" }, "longRunningToolIds": { "anyOf": [ { "items": { "type": "string" }, "type": "array", "uniqueItems": true }, { "type": "null" } ], "default": null, "title": "Longrunningtoolids" }, "branch": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Branch" }, "isolationScope": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Isolationscope" }, "id": { "default": "", "title": "Id", "type": "string" }, "timestamp": { "title": "Timestamp", "type": "number" } }, "title": "Event", "type": "object" }, "EventActions": { "additionalProperties": false, "description": "Represents the actions attached to an event.", "properties": { "skipSummarization": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "title": "Skipsummarization" }, "stateDelta": { "additionalProperties": true, "title": "Statedelta", "type": "object" }, "artifactDelta": { "additionalProperties": { "type": "integer" }, "title": "Artifactdelta", "type": "object" }, "transferToAgent": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Transfertoagent" }, "escalate": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "title": "Escalate" }, "requestedAuthConfigs": { "additionalProperties": true, "title": "Requestedauthconfigs", "type": "object" }, "requestedToolConfirmations": { "additionalProperties": { "$ref": "#/$defs/ToolConfirmation" }, "title": "Requestedtoolconfirmations", "type": "object" }, "compaction": { "anyOf": [ { "$ref": "#/$defs/EventCompaction" }, { "type": "null" } ], "default": null }, "endOfAgent": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "title": "Endofagent" }, "agentState": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "type": "null" } ], "default": null, "title": "Agentstate" }, "rewindBeforeInvocationId": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Rewindbeforeinvocationid" }, "route": { "anyOf": [ { "type": "boolean" }, { "type": "integer" }, { "type": "string" }, { "items": { "anyOf": [ { "type": "boolean" }, { "type": "integer" }, { "type": "string" } ] }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Route" }, "renderUiWidgets": { "anyOf": [ { "items": { "$ref": "#/$defs/UiWidget" }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Renderuiwidgets" }, "setModelResponse": { "anyOf": [ {}, { "type": "null" } ], "default": null, "title": "Setmodelresponse" } }, "title": "EventActions", "type": "object" }, "EventCompaction": { "additionalProperties": false, "description": "The compaction of the events.", "properties": { "startTimestamp": { "title": "Starttimestamp", "type": "number" }, "endTimestamp": { "title": "Endtimestamp", "type": "number" }, "compactedContent": { "$ref": "#/$defs/Content" } }, "required": [ "startTimestamp", "endTimestamp", "compactedContent" ], "title": "EventCompaction", "type": "object" }, "ExecutableCode": { "additionalProperties": false, "description": "Code generated by the model that is meant to be executed, and the result returned to the model.\n\nGenerated when using the `CodeExecution` tool, in which the code will be\nautomatically executed, and a corresponding CodeExecutionResult will also be\ngenerated.", "properties": { "code": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Required. The code to be executed.", "title": "Code" }, "language": { "anyOf": [ { "$ref": "#/$defs/Language" }, { "type": "null" } ], "default": null, "description": "Required. Programming language of the `code`." }, "id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. Unique identifier of the `ExecutableCode` part. The server returns the `CodeExecutionResult` with the matching `id`. This field is not supported in Vertex AI.", "title": "Id" } }, "title": "ExecutableCode", "type": "object" }, "FileData": { "additionalProperties": false, "description": "URI-based data.\n\nA FileData message contains a URI pointing to data of a specific media type.\nIt is used to represent images, audio, and video stored in Google Cloud\nStorage.", "properties": { "displayName": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. The display name of the file. Used to provide a label or filename to distinguish files. This field is only returned in `PromptMessage` for prompt management. It is used in the Gemini calls only when server side tools (`code_execution`, `google_search`, and `url_context`) are enabled. This field is not supported in Gemini API.", "title": "Displayname" }, "fileUri": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Required. The URI of the file in Google Cloud Storage.", "title": "Fileuri" }, "mimeType": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Required. The IANA standard MIME type of the source data.", "title": "Mimetype" } }, "title": "FileData", "type": "object" }, "FinishReason": { "description": "Output only. The reason why the model stopped generating tokens.\n\nIf empty, the model has not stopped generating the tokens.", "enum": [ "FINISH_REASON_UNSPECIFIED", "STOP", "MAX_TOKENS", "SAFETY", "RECITATION", "LANGUAGE", "OTHER", "BLOCKLIST", "PROHIBITED_CONTENT", "SPII", "MALFORMED_FUNCTION_CALL", "IMAGE_SAFETY", "UNEXPECTED_TOOL_CALL", "IMAGE_PROHIBITED_CONTENT", "NO_IMAGE", "IMAGE_RECITATION", "IMAGE_OTHER" ], "title": "FinishReason", "type": "string" }, "FunctionCall": { "additionalProperties": false, "description": "A predicted FunctionCall returned from the model that contains a string representing the FunctionDeclaration.name and a structured JSON object containing the parameters and their values.", "properties": { "id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. The unique id of the function call. If populated, the client to execute the `function_call` and return the response with the matching `id`.", "title": "Id" }, "args": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "type": "null" } ], "default": null, "description": "Optional. The function parameters and values in JSON object format. See FunctionDeclaration.parameters for parameter details.", "title": "Args" }, "name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. The name of the function to call. Matches FunctionDeclaration.name.", "title": "Name" }, "partialArgs": { "anyOf": [ { "items": { "$ref": "#/$defs/PartialArg" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Optional. The partial argument value of the function call. If provided, represents the arguments/fields that are streamed incrementally. This field is not supported in Gemini API.", "title": "Partialargs" }, "willContinue": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "description": "Optional. Whether this is the last part of the FunctionCall. If true, another partial message for the current FunctionCall is expected to follow. This field is not supported in Gemini API.", "title": "Willcontinue" } }, "title": "FunctionCall", "type": "object" }, "FunctionResponse": { "additionalProperties": false, "description": "The result output from a FunctionCall that contains a string representing the FunctionDeclaration.name and a structured JSON object containing any output from the function is used as context to the model.\n\nThis should contain the result of a `FunctionCall` made based on model\nprediction.", "properties": { "willContinue": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "description": "Optional. Signals that function call continues, and more responses will be returned, turning the function call into a generator. Is only applicable to NON_BLOCKING function calls, is ignored otherwise. If set to false, future responses will not be considered. It is allowed to return empty `response` with `will_continue=False` to signal that the function call is finished. This may still trigger the model generation. To avoid triggering the generation and finish the function call, additionally set `scheduling` to `SILENT`. This field is not supported in Vertex AI.", "title": "Willcontinue" }, "scheduling": { "anyOf": [ { "$ref": "#/$defs/FunctionResponseScheduling" }, { "type": "null" } ], "default": null, "description": "Optional. Specifies how the response should be scheduled in the conversation. Only applicable to NON_BLOCKING function calls, is ignored otherwise. Defaults to WHEN_IDLE." }, "parts": { "anyOf": [ { "items": { "$ref": "#/$defs/FunctionResponsePart" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Optional. Ordered `Parts` that constitute a function response. Parts may have different IANA MIME types.", "title": "Parts" }, "id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. The id of the function call this response is for. Populated by the client to match the corresponding function call `id`.", "title": "Id" }, "name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Required. The name of the function to call. Matches FunctionDeclaration.name and FunctionCall.name.", "title": "Name" }, "response": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "type": "null" } ], "default": null, "description": "Required. The function response in JSON object format. Use \"output\" key to specify function output and \"error\" key to specify error details (if any). If \"output\" and \"error\" keys are not specified, then whole \"response\" is treated as function output.", "title": "Response" } }, "title": "FunctionResponse", "type": "object" }, "FunctionResponseBlob": { "additionalProperties": false, "description": "Raw media bytes for function response.\n\nText should not be sent as raw bytes, use the 'text' field.", "properties": { "mimeType": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Required. The IANA standard MIME type of the source data.", "title": "Mimetype" }, "data": { "anyOf": [ { "format": "base64url", "type": "string" }, { "type": "null" } ], "default": null, "description": "Required. Raw bytes.", "title": "Data" }, "displayName": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. Display name of the blob. Used to provide a label or filename to distinguish blobs. This field is only returned in PromptMessage for prompt management. It is currently used in the Gemini GenerateContent calls only when server side tools (code_execution, google_search, and url_context) are enabled. This field is not supported in Gemini API.", "title": "Displayname" } }, "title": "FunctionResponseBlob", "type": "object" }, "FunctionResponseFileData": { "additionalProperties": false, "description": "URI based data for function response.\n\nThis data type is not supported in Gemini API.", "properties": { "fileUri": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Required. URI.", "title": "Fileuri" }, "mimeType": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Required. The IANA standard MIME type of the source data.", "title": "Mimetype" }, "displayName": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. Display name of the file data. Used to provide a label or filename to distinguish file datas. This field is only returned in PromptMessage for prompt management. It is currently used in the Gemini GenerateContent calls only when server side tools (code_execution, google_search, and url_context) are enabled.", "title": "Displayname" } }, "title": "FunctionResponseFileData", "type": "object" }, "FunctionResponsePart": { "additionalProperties": false, "description": "A datatype containing media that is part of a `FunctionResponse` message.\n\nA `FunctionResponsePart` consists of data which has an associated datatype. A\n`FunctionResponsePart` can only contain one of the accepted types in\n`FunctionResponsePart.data`. A `FunctionResponsePart` must have a fixed IANA\nMIME type identifying the type and subtype of the media if the `inline_data`\nfield is filled with raw bytes.", "properties": { "inlineData": { "anyOf": [ { "$ref": "#/$defs/FunctionResponseBlob" }, { "type": "null" } ], "default": null, "description": "Inline media bytes." }, "fileData": { "anyOf": [ { "$ref": "#/$defs/FunctionResponseFileData" }, { "type": "null" } ], "default": null, "description": "URI based data. This field is not supported in Gemini API." } }, "title": "FunctionResponsePart", "type": "object" }, "FunctionResponseScheduling": { "description": "Specifies how the response should be scheduled in the conversation.\n\nOnly applicable to NON_BLOCKING function calls, is ignored otherwise. Defaults\nto WHEN_IDLE.", "enum": [ "SCHEDULING_UNSPECIFIED", "SILENT", "WHEN_IDLE", "INTERRUPT" ], "title": "FunctionResponseScheduling", "type": "string" }, "GenerateContentResponseUsageMetadata": { "additionalProperties": false, "description": "Usage metadata about the content generation request and response.\n\nThis message provides a detailed breakdown of token usage and other relevant\nmetrics. This data type is not supported in Gemini API.", "properties": { "cacheTokensDetails": { "anyOf": [ { "items": { "$ref": "#/$defs/ModalityTokenCount" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Output only. A detailed breakdown of the token count for each modality in the cached content.", "title": "Cachetokensdetails" }, "cachedContentTokenCount": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Output only. The number of tokens in the cached content that was used for this request.", "title": "Cachedcontenttokencount" }, "candidatesTokenCount": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "The total number of tokens in the generated candidates.", "title": "Candidatestokencount" }, "candidatesTokensDetails": { "anyOf": [ { "items": { "$ref": "#/$defs/ModalityTokenCount" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Output only. A detailed breakdown of the token count for each modality in the generated candidates.", "title": "Candidatestokensdetails" }, "promptTokenCount": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "The total number of tokens in the prompt. This includes any text, images, or other media provided in the request. When `cached_content` is set, this also includes the number of tokens in the cached content.", "title": "Prompttokencount" }, "promptTokensDetails": { "anyOf": [ { "items": { "$ref": "#/$defs/ModalityTokenCount" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Output only. A detailed breakdown of the token count for each modality in the prompt.", "title": "Prompttokensdetails" }, "thoughtsTokenCount": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Output only. The number of tokens that were part of the model's generated \"thoughts\" output, if applicable.", "title": "Thoughtstokencount" }, "toolUsePromptTokenCount": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Output only. The number of tokens in the results from tool executions, which are provided back to the model as input, if applicable.", "title": "Tooluseprompttokencount" }, "toolUsePromptTokensDetails": { "anyOf": [ { "items": { "$ref": "#/$defs/ModalityTokenCount" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Output only. A detailed breakdown by modality of the token counts from the results of tool executions, which are provided back to the model as input.", "title": "Tooluseprompttokensdetails" }, "totalTokenCount": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "The total number of tokens for the entire request. This is the sum of `prompt_token_count`, `candidates_token_count`, `tool_use_prompt_token_count`, and `thoughts_token_count`.", "title": "Totaltokencount" }, "trafficType": { "anyOf": [ { "$ref": "#/$defs/TrafficType" }, { "type": "null" } ], "default": null, "description": "Output only. The traffic type for this request." } }, "title": "GenerateContentResponseUsageMetadata", "type": "object" }, "GoogleTypeDate": { "additionalProperties": false, "description": "Represents a whole or partial calendar date, such as a birthday.\n\nThe time of day and time zone are either specified elsewhere or are\ninsignificant. The date is relative to the Gregorian Calendar. This can\nrepresent one of the following: * A full date, with non-zero year, month, and\nday values. * A month and day, with a zero year (for example, an anniversary).\n* A year on its own, with a zero month and a zero day. * A year and month,\nwith a zero day (for example, a credit card expiration date). Related types: *\ngoogle.type.TimeOfDay * google.type.DateTime * google.protobuf.Timestamp. This\ndata type is not supported in Gemini API.", "properties": { "day": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a year by itself or a year and month where the day isn't significant.", "title": "Day" }, "month": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day.", "title": "Month" }, "year": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year.", "title": "Year" } }, "title": "GoogleTypeDate", "type": "object" }, "GroundingChunk": { "additionalProperties": false, "description": "A piece of evidence that supports a claim made by the model.\n\nThis is used to show a citation for a claim made by the model. When grounding\nis enabled, the model returns a `GroundingChunk` that contains a reference to\nthe source of the information.", "properties": { "image": { "anyOf": [ { "$ref": "#/$defs/GroundingChunkImage" }, { "type": "null" } ], "default": null, "description": "A grounding chunk from an image search result. See the `Image` message for details." }, "maps": { "anyOf": [ { "$ref": "#/$defs/GroundingChunkMaps" }, { "type": "null" } ], "default": null, "description": "A `Maps` chunk is a piece of evidence that comes from Google Maps.\n\n It contains information about a place, such as its name, address, and\n reviews. This is used to provide the user with rich, location-based\n information." }, "retrievedContext": { "anyOf": [ { "$ref": "#/$defs/GroundingChunkRetrievedContext" }, { "type": "null" } ], "default": null, "description": "A grounding chunk from a data source retrieved by a retrieval tool, such as Vertex AI Search. See the `RetrievedContext` message for details" }, "web": { "anyOf": [ { "$ref": "#/$defs/GroundingChunkWeb" }, { "type": "null" } ], "default": null, "description": "A grounding chunk from a web page, typically from Google Search. See the `Web` message for details." } }, "title": "GroundingChunk", "type": "object" }, "GroundingChunkCustomMetadata": { "additionalProperties": false, "description": "User provided metadata about the GroundingFact.\n\nThis data type is not supported in Vertex AI.", "properties": { "key": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The key of the metadata.", "title": "Key" }, "numericValue": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Optional. The numeric value of the metadata. The expected range for this value depends on the specific `key` used.", "title": "Numericvalue" }, "stringListValue": { "anyOf": [ { "$ref": "#/$defs/GroundingChunkStringList" }, { "type": "null" } ], "default": null, "description": "Optional. A list of string values for the metadata." }, "stringValue": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. The string value of the metadata.", "title": "Stringvalue" } }, "title": "GroundingChunkCustomMetadata", "type": "object" }, "GroundingChunkImage": { "additionalProperties": false, "description": "An `Image` chunk is a piece of evidence that comes from an image search result.\n\nIt contains the URI of the image search result and the URI of the image. This\nis used to provide the user with a link to the source of the information.", "properties": { "sourceUri": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The URI of the image search result page.", "title": "Sourceuri" }, "imageUri": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The URI of the image.", "title": "Imageuri" }, "title": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The title of the image search result page.", "title": "Title" }, "domain": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The domain of the image search result page.", "title": "Domain" } }, "title": "GroundingChunkImage", "type": "object" }, "GroundingChunkMaps": { "additionalProperties": false, "description": "A `Maps` chunk is a piece of evidence that comes from Google Maps.\n\nIt contains information about a place, such as its name, address, and reviews.\nThis is used to provide the user with rich, location-based information.", "properties": { "placeAnswerSources": { "anyOf": [ { "$ref": "#/$defs/GroundingChunkMapsPlaceAnswerSources" }, { "type": "null" } ], "default": null, "description": "The sources that were used to generate the place answer.\n\n This includes review snippets and photos that were used to generate the\n answer, as well as URIs to flag content." }, "placeId": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "This Place's resource name, in `places/{place_id}` format.\n\n This can be used to look up the place in the Google Maps API.", "title": "Placeid" }, "text": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The text of the place answer.", "title": "Text" }, "title": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The title of the place.", "title": "Title" }, "uri": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The URI of the place.", "title": "Uri" }, "route": { "anyOf": [ { "$ref": "#/$defs/GroundingChunkMapsRoute" }, { "type": "null" } ], "default": null, "description": "Output only. Route information." } }, "title": "GroundingChunkMaps", "type": "object" }, "GroundingChunkMapsPlaceAnswerSources": { "additionalProperties": false, "description": "The sources that were used to generate the place answer.\n\nThis includes review snippets and photos that were used to generate the\nanswer, as well as URIs to flag content.", "properties": { "reviewSnippet": { "anyOf": [ { "items": { "$ref": "#/$defs/GroundingChunkMapsPlaceAnswerSourcesReviewSnippet" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Snippets of reviews that were used to generate the answer.", "title": "Reviewsnippet" }, "flagContentUri": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "A link where users can flag a problem with the generated answer.", "title": "Flagcontenturi" }, "reviewSnippets": { "anyOf": [ { "items": { "$ref": "#/$defs/GroundingChunkMapsPlaceAnswerSourcesReviewSnippet" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Snippets of reviews that were used to generate the answer.", "title": "Reviewsnippets" } }, "title": "GroundingChunkMapsPlaceAnswerSources", "type": "object" }, "GroundingChunkMapsPlaceAnswerSourcesAuthorAttribution": { "additionalProperties": false, "description": "Author attribution for a photo or review.", "properties": { "displayName": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Name of the author of the Photo or Review.", "title": "Displayname" }, "photoUri": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Profile photo URI of the author of the Photo or Review.", "title": "Photouri" }, "uri": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "URI of the author of the Photo or Review.", "title": "Uri" } }, "title": "GroundingChunkMapsPlaceAnswerSourcesAuthorAttribution", "type": "object" }, "GroundingChunkMapsPlaceAnswerSourcesReviewSnippet": { "additionalProperties": false, "description": "Encapsulates a review snippet.", "properties": { "authorAttribution": { "anyOf": [ { "$ref": "#/$defs/GroundingChunkMapsPlaceAnswerSourcesAuthorAttribution" }, { "type": "null" } ], "default": null, "description": "This review's author." }, "flagContentUri": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "A link where users can flag a problem with the review.", "title": "Flagcontenturi" }, "googleMapsUri": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "A link to show the review on Google Maps.", "title": "Googlemapsuri" }, "relativePublishTimeDescription": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "A string of formatted recent time, expressing the review time relative to the current time in a form appropriate for the language and country.", "title": "Relativepublishtimedescription" }, "review": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "A reference representing this place review which may be used to look up this place review again.", "title": "Review" }, "reviewId": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Id of the review referencing the place.", "title": "Reviewid" }, "title": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Title of the review.", "title": "Title" } }, "title": "GroundingChunkMapsPlaceAnswerSourcesReviewSnippet", "type": "object" }, "GroundingChunkMapsRoute": { "additionalProperties": false, "description": "Route information from Google Maps.\n\nThis data type is not supported in Gemini API.", "properties": { "distanceMeters": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "The total distance of the route, in meters.", "title": "Distancemeters" }, "duration": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The total duration of the route.", "title": "Duration" }, "encodedPolyline": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "An encoded polyline of the route. See https://developers.google.com/maps/documentation/utilities/polylinealgorithm", "title": "Encodedpolyline" } }, "title": "GroundingChunkMapsRoute", "type": "object" }, "GroundingChunkRetrievedContext": { "additionalProperties": false, "description": "Context retrieved from a data source to ground the model's response.\n\nThis is used when a retrieval tool fetches information from a user-provided\ncorpus or a public dataset.", "properties": { "documentName": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Output only. The full resource name of the referenced Vertex AI Search document. This is used to identify the specific document that was retrieved. The format is `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document}`. This field is not supported in Gemini API.", "title": "Documentname" }, "ragChunk": { "anyOf": [ { "$ref": "#/$defs/RagChunk" }, { "type": "null" } ], "default": null, "description": "Additional context for a Retrieval-Augmented Generation (RAG) retrieval result. This is populated only when the RAG retrieval tool is used. This field is not supported in Gemini API." }, "text": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The content of the retrieved data source.", "title": "Text" }, "title": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The title of the retrieved data source.", "title": "Title" }, "uri": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The URI of the retrieved data source.", "title": "Uri" }, "customMetadata": { "anyOf": [ { "items": { "$ref": "#/$defs/GroundingChunkCustomMetadata" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Optional. User-provided metadata about the retrieved context. This field is not supported in Vertex AI.", "title": "Custommetadata" }, "fileSearchStore": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. Name of the `FileSearchStore` containing the document. Example: `fileSearchStores/123`. This field is not supported in Vertex AI.", "title": "Filesearchstore" }, "pageNumber": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Optional. Page number of the retrieved context, if applicable. This field is not supported in Vertex AI.", "title": "Pagenumber" }, "mediaId": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. The media blob resource name for multimodal file search results. Format: fileSearchStores/{file_search_store_id}/media/{blob_id}. This field is not supported in Vertex AI.", "title": "Mediaid" } }, "title": "GroundingChunkRetrievedContext", "type": "object" }, "GroundingChunkStringList": { "additionalProperties": false, "description": "A list of string values. This data type is not supported in Vertex AI.", "properties": { "values": { "anyOf": [ { "items": { "type": "string" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "The string values of the list.", "title": "Values" } }, "title": "GroundingChunkStringList", "type": "object" }, "GroundingChunkWeb": { "additionalProperties": false, "description": "A `Web` chunk is a piece of evidence that comes from a web page.\n\nIt contains the URI of the web page, the title of the page, and the domain of\nthe page. This is used to provide the user with a link to the source of the\ninformation.", "properties": { "domain": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The domain of the web page that contains the evidence. This can be used to filter out low-quality sources. This field is not supported in Gemini API.", "title": "Domain" }, "title": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The title of the web page that contains the evidence.", "title": "Title" }, "uri": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The URI of the web page that contains the evidence.", "title": "Uri" } }, "title": "GroundingChunkWeb", "type": "object" }, "GroundingMetadata": { "additionalProperties": false, "description": "Information for various kinds of grounding.", "properties": { "imageSearchQueries": { "anyOf": [ { "items": { "type": "string" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Optional. The image search queries that were used to generate the content. This field is populated only when the grounding source is Google Search with the Image Search search_type enabled.", "title": "Imagesearchqueries" }, "groundingChunks": { "anyOf": [ { "items": { "$ref": "#/$defs/GroundingChunk" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "A list of supporting references retrieved from the grounding\n source. This field is populated when the grounding source is Google\n Search, Vertex AI Search, or Google Maps.\n ", "title": "Groundingchunks" }, "groundingSupports": { "anyOf": [ { "items": { "$ref": "#/$defs/GroundingSupport" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "List of grounding support.", "title": "Groundingsupports" }, "retrievalMetadata": { "anyOf": [ { "$ref": "#/$defs/RetrievalMetadata" }, { "type": "null" } ], "default": null, "description": "Metadata related to retrieval in the grounding flow." }, "searchEntryPoint": { "anyOf": [ { "$ref": "#/$defs/SearchEntryPoint" }, { "type": "null" } ], "default": null, "description": "Optional. Google search entry for the following-up web\n searches." }, "webSearchQueries": { "anyOf": [ { "items": { "type": "string" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Web search queries for the following-up web search.", "title": "Websearchqueries" }, "googleMapsWidgetContextToken": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. Output only. Deprecated: The Google Maps contextual widget behavior in Grounding with Google Maps is being deprecated; this field is planned for removal and will no longer be populated once removed. A token that can be used to render a Google Maps widget with the contextual data. This field is populated only when the grounding source is Google Maps.", "title": "Googlemapswidgetcontexttoken" }, "retrievalQueries": { "anyOf": [ { "items": { "type": "string" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Optional. The queries that were executed by the retrieval tools. This field is populated only when the grounding source is a retrieval tool, such as Vertex AI Search. This field is not supported in Gemini API.", "title": "Retrievalqueries" }, "sourceFlaggingUris": { "anyOf": [ { "items": { "$ref": "#/$defs/GroundingMetadataSourceFlaggingUri" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Optional. Output only. A list of URIs that can be used to flag a place or review for inappropriate content. This field is populated only when the grounding source is Google Maps. This field is not supported in Gemini API.", "title": "Sourceflagginguris" } }, "title": "GroundingMetadata", "type": "object" }, "GroundingMetadataSourceFlaggingUri": { "additionalProperties": false, "description": "A URI that can be used to flag a place or review for inappropriate content.\n\nThis is populated only when the grounding source is Google Maps. This data\ntype is not supported in Gemini API.", "properties": { "flagContentUri": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The URI that can be used to flag the content.", "title": "Flagcontenturi" }, "sourceId": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The ID of the place or review.", "title": "Sourceid" } }, "title": "GroundingMetadataSourceFlaggingUri", "type": "object" }, "GroundingSupport": { "additionalProperties": false, "description": "Grounding support.", "properties": { "confidenceScores": { "anyOf": [ { "items": { "type": "number" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Confidence score of the support references.\n\n Ranges from 0 to 1. 1 is the most confident. This list must have the\n same size as the grounding_chunk_indices.", "title": "Confidencescores" }, "groundingChunkIndices": { "anyOf": [ { "items": { "type": "integer" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "A list of indices (into 'grounding_chunk') specifying the\n citations associated with the claim. For instance [1,3,4] means that\n grounding_chunk[1], grounding_chunk[3], grounding_chunk[4] are the\n retrieved content attributed to the claim.", "title": "Groundingchunkindices" }, "segment": { "anyOf": [ { "$ref": "#/$defs/Segment" }, { "type": "null" } ], "default": null, "description": "Segment of the content this support belongs to." }, "renderedParts": { "anyOf": [ { "items": { "type": "integer" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Indices into the `rendered_parts` field of the `GroundingMetadata` message. These indices specify which rendered parts are associated with this support message.", "title": "Renderedparts" } }, "title": "GroundingSupport", "type": "object" }, "HttpAuth": { "additionalProperties": true, "description": "The credentials and metadata for HTTP authentication.", "properties": { "scheme": { "title": "Scheme", "type": "string" }, "credentials": { "$ref": "#/$defs/HttpCredentials" }, "additionalHeaders": { "anyOf": [ { "additionalProperties": { "type": "string" }, "type": "object" }, { "type": "null" } ], "default": null, "title": "Additionalheaders" } }, "required": [ "scheme", "credentials" ], "title": "HttpAuth", "type": "object" }, "HttpCredentials": { "additionalProperties": true, "description": "Represents the secret token value for HTTP authentication, like user name, password, oauth token, etc.", "properties": { "username": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Username" }, "password": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Password" }, "token": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Token" } }, "title": "HttpCredentials", "type": "object" }, "Language": { "description": "Programming language of the `code`.", "enum": [ "LANGUAGE_UNSPECIFIED", "PYTHON" ], "title": "Language", "type": "string" }, "LiveServerGoAway": { "additionalProperties": false, "description": "Server will not be able to service client soon.", "properties": { "timeLeft": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The remaining time before the connection will be terminated as ABORTED. The minimal time returned here is specified differently together with the rate limits for a given model.", "title": "Timeleft" } }, "title": "LiveServerGoAway", "type": "object" }, "LiveServerSessionResumptionUpdate": { "additionalProperties": false, "description": "Update of the session resumption state.\n\nOnly sent if `session_resumption` was set in the connection config.", "properties": { "newHandle": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "New handle that represents state that can be resumed. Empty if `resumable`=false.", "title": "Newhandle" }, "resumable": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "description": "True if session can be resumed at this point. It might be not possible to resume session at some points. In that case we send update empty new_handle and resumable=false. Example of such case could be model executing function calls or just generating. Resuming session (using previous session token) in such state will result in some data loss.", "title": "Resumable" }, "lastConsumedClientMessageIndex": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Index of last message sent by client that is included in state represented by this SessionResumptionToken. Only sent when `SessionResumptionConfig.transparent` is set.\n\nPresence of this index allows users to transparently reconnect and avoid issue of losing some part of realtime audio input/video. If client wishes to temporarily disconnect (for example as result of receiving GoAway) they can do it without losing state by buffering messages sent since last `SessionResumptionTokenUpdate`. This field will enable them to limit buffering (avoid keeping all requests in RAM).\n\nNote: This should not be used for when resuming a session at some time later -- in those cases partial audio and video frames are likely not needed.", "title": "Lastconsumedclientmessageindex" } }, "title": "LiveServerSessionResumptionUpdate", "type": "object" }, "LogprobsResult": { "additionalProperties": false, "description": "The log probabilities of the tokens generated by the model.\n\nThis is useful for understanding the model's confidence in its predictions and\nfor debugging. For example, you can use log probabilities to identify when the\nmodel is making a less confident prediction or to explore alternative\nresponses that the model considered. A low log probability can also indicate\nthat the model is \"hallucinating\" or generating factually incorrect\ninformation.", "properties": { "chosenCandidates": { "anyOf": [ { "items": { "$ref": "#/$defs/LogprobsResultCandidate" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "A list of the chosen candidate tokens at each decoding step. The length of this list is equal to the total number of decoding steps. Note that the chosen candidate might not be in `top_candidates`.", "title": "Chosencandidates" }, "topCandidates": { "anyOf": [ { "items": { "$ref": "#/$defs/LogprobsResultTopCandidates" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "A list of the top candidate tokens at each decoding step. The length of this list is equal to the total number of decoding steps.", "title": "Topcandidates" }, "logProbabilitySum": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Sum of log probabilities for all tokens. This field is not supported in Vertex AI.", "title": "Logprobabilitysum" } }, "title": "LogprobsResult", "type": "object" }, "LogprobsResultCandidate": { "additionalProperties": false, "description": "A single token and its associated log probability.", "properties": { "logProbability": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "The log probability of this token. A higher value indicates that the model was more confident in this token. The log probability can be used to assess the relative likelihood of different tokens and to identify when the model is uncertain.", "title": "Logprobability" }, "token": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The token's string representation.", "title": "Token" }, "tokenId": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "The token's numerical ID. While the `token` field provides the string representation of the token, the `token_id` is the numerical representation that the model uses internally. This can be useful for developers who want to build custom logic based on the model's vocabulary.", "title": "Tokenid" } }, "title": "LogprobsResultCandidate", "type": "object" }, "LogprobsResultTopCandidates": { "additionalProperties": false, "description": "A list of the top candidate tokens and their log probabilities at each decoding step.\n\nThis can be used to see what other tokens the model considered.", "properties": { "candidates": { "anyOf": [ { "items": { "$ref": "#/$defs/LogprobsResultCandidate" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "The list of candidate tokens, sorted by log probability in descending order.", "title": "Candidates" } }, "title": "LogprobsResultTopCandidates", "type": "object" }, "MediaModality": { "description": "The modality that this token count applies to.", "enum": [ "MODALITY_UNSPECIFIED", "TEXT", "IMAGE", "VIDEO", "AUDIO", "DOCUMENT" ], "title": "MediaModality", "type": "string" }, "ModalityTokenCount": { "additionalProperties": false, "description": "Represents a breakdown of token usage by modality.\n\nThis message is used in CountTokensResponse and\nGenerateContentResponse.UsageMetadata to provide a detailed view of how many\ntokens are used by each modality (e.g., text, image, video) in a request. This\nis particularly useful for multimodal models, allowing you to track and manage\ntoken consumption for billing and quota purposes.", "properties": { "modality": { "anyOf": [ { "$ref": "#/$defs/MediaModality" }, { "type": "null" } ], "default": null, "description": "The modality that this token count applies to." }, "tokenCount": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "The number of tokens counted for this modality.", "title": "Tokencount" } }, "title": "ModalityTokenCount", "type": "object" }, "NodeInfo": { "description": "Workflow node metadata attached to an Event.", "properties": { "path": { "default": "", "title": "Path", "type": "string" }, "outputFor": { "anyOf": [ { "items": { "type": "string" }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Outputfor" }, "messageAsOutput": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "title": "Messageasoutput" } }, "title": "NodeInfo", "type": "object" }, "OAuth2Auth": { "additionalProperties": true, "description": "Represents credential value and its metadata for a OAuth2 credential.", "properties": { "clientId": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Clientid" }, "clientSecret": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Clientsecret" }, "authUri": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Authuri" }, "nonce": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Nonce" }, "state": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "State" }, "redirectUri": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Redirecturi" }, "authResponseUri": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Authresponseuri" }, "authCode": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Authcode" }, "accessToken": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Accesstoken" }, "refreshToken": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Refreshtoken" }, "idToken": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Idtoken" }, "expiresAt": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Expiresat" }, "expiresIn": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Expiresin" }, "audience": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Audience" }, "prompt": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Prompt" }, "codeVerifier": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Codeverifier" }, "codeChallengeMethod": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Codechallengemethod" }, "tokenEndpointAuthMethod": { "anyOf": [ { "enum": [ "client_secret_basic", "client_secret_post", "client_secret_jwt", "private_key_jwt" ], "type": "string" }, { "type": "null" } ], "default": "client_secret_basic", "title": "Tokenendpointauthmethod" } }, "title": "OAuth2Auth", "type": "object" }, "Outcome": { "description": "Outcome of the code execution.", "enum": [ "OUTCOME_UNSPECIFIED", "OUTCOME_OK", "OUTCOME_FAILED", "OUTCOME_DEADLINE_EXCEEDED" ], "title": "Outcome", "type": "string" }, "Part": { "additionalProperties": false, "description": "A datatype containing media content.\n\nExactly one field within a Part should be set, representing the specific type\nof content being conveyed. Using multiple fields within the same `Part`\ninstance is considered invalid.", "properties": { "mediaResolution": { "anyOf": [ { "$ref": "#/$defs/PartMediaResolution" }, { "type": "null" } ], "default": null, "description": "Media resolution for the input media.\n " }, "codeExecutionResult": { "anyOf": [ { "$ref": "#/$defs/CodeExecutionResult" }, { "type": "null" } ], "default": null, "description": "Optional. The result of executing the ExecutableCode." }, "executableCode": { "anyOf": [ { "$ref": "#/$defs/ExecutableCode" }, { "type": "null" } ], "default": null, "description": "Optional. Code generated by the model that is intended to be executed." }, "fileData": { "anyOf": [ { "$ref": "#/$defs/FileData" }, { "type": "null" } ], "default": null, "description": "Optional. The URI-based data of the part. This can be used to include files from Google Cloud Storage." }, "functionCall": { "anyOf": [ { "$ref": "#/$defs/FunctionCall" }, { "type": "null" } ], "default": null, "description": "Optional. A predicted function call returned from the model. This contains the name of the function to call and the arguments to pass to the function." }, "functionResponse": { "anyOf": [ { "$ref": "#/$defs/FunctionResponse" }, { "type": "null" } ], "default": null, "description": "Optional. The result of a function call. This is used to provide the model with the result of a function call that it predicted." }, "inlineData": { "anyOf": [ { "$ref": "#/$defs/Blob" }, { "type": "null" } ], "default": null, "description": "Optional. The inline data content of the part. This can be used to include images, audio, or video in a request." }, "text": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. The text content of the part. When sent from the VSCode Gemini Code Assist extension, references to @mentioned items will be converted to markdown boldface text. For example `@my-repo` will be converted to and sent as `**my-repo**` by the IDE agent.", "title": "Text" }, "thought": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "description": "Optional. Indicates whether the `part` represents the model's thought process or reasoning.", "title": "Thought" }, "thoughtSignature": { "anyOf": [ { "format": "base64url", "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. An opaque signature for the thought so it can be reused in subsequent requests.", "title": "Thoughtsignature" }, "videoMetadata": { "anyOf": [ { "$ref": "#/$defs/VideoMetadata" }, { "type": "null" } ], "default": null, "description": "Optional. Video metadata. The metadata should only be specified while the video data is presented in inline_data or file_data." }, "toolCall": { "anyOf": [ { "$ref": "#/$defs/ToolCall" }, { "type": "null" } ], "default": null, "description": "Server-side tool call. This field is populated when the model predicts a tool invocation that should be executed on the server. The client is expected to echo this message back to the API." }, "toolResponse": { "anyOf": [ { "$ref": "#/$defs/ToolResponse" }, { "type": "null" } ], "default": null, "description": "The output from a server-side ToolCall execution. This field is populated by the client with the results of executing the corresponding ToolCall." }, "partMetadata": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "type": "null" } ], "default": null, "description": "Custom metadata associated with the Part. Agents using genai.Part as content representation may need to keep track of the additional information. For example it can be name of a file/source from which the Part originates or a way to multiplex multiple Part streams. This field is not supported in Vertex AI.", "title": "Partmetadata" }, "audioTranscription": { "anyOf": [ { "$ref": "#/$defs/Transcription" }, { "type": "null" } ], "default": null, "description": "Output only. The transcription of the audio part." } }, "title": "Part", "type": "object" }, "PartMediaResolution": { "additionalProperties": false, "description": "Media resolution for the input media.", "properties": { "level": { "anyOf": [ { "$ref": "#/$defs/PartMediaResolutionLevel" }, { "type": "null" } ], "default": null, "description": "The tokenization quality used for given media.\n " }, "numTokens": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Specifies the required sequence length for media tokenization.\n ", "title": "Numtokens" } }, "title": "PartMediaResolution", "type": "object" }, "PartMediaResolutionLevel": { "description": "The tokenization quality used for given media.", "enum": [ "MEDIA_RESOLUTION_UNSPECIFIED", "MEDIA_RESOLUTION_LOW", "MEDIA_RESOLUTION_MEDIUM", "MEDIA_RESOLUTION_HIGH", "MEDIA_RESOLUTION_ULTRA_HIGH" ], "title": "PartMediaResolutionLevel", "type": "string" }, "PartialArg": { "additionalProperties": false, "description": "Partial argument value of the function call.\n\nThis data type is not supported in Gemini API.", "properties": { "boolValue": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "description": "Optional. Represents a boolean value.", "title": "Boolvalue" }, "jsonPath": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Required. A JSON Path (RFC 9535) to the argument being streamed. https://datatracker.ietf.org/doc/html/rfc9535. e.g. \"$.foo.bar[0].data\".", "title": "Jsonpath" }, "nullValue": { "anyOf": [ { "const": "NULL_VALUE", "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. Represents a null value.", "title": "Nullvalue" }, "numberValue": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Optional. Represents a double value.", "title": "Numbervalue" }, "stringValue": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. Represents a string value.", "title": "Stringvalue" }, "willContinue": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "description": "Optional. Whether this is not the last part of the same json_path. If true, another PartialArg message for the current json_path is expected to follow.", "title": "Willcontinue" } }, "title": "PartialArg", "type": "object" }, "RagChunk": { "additionalProperties": false, "description": "A RagChunk includes the content of a chunk of a RagFile, and associated metadata.\n\nThis data type is not supported in Gemini API.", "properties": { "pageSpan": { "anyOf": [ { "$ref": "#/$defs/RagChunkPageSpan" }, { "type": "null" } ], "default": null, "description": "If populated, represents where the chunk starts and ends in the document." }, "text": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The content of the chunk.", "title": "Text" }, "chunkId": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The ID of the chunk.", "title": "Chunkid" }, "fileId": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The ID of the file that the chunk belongs to.", "title": "Fileid" } }, "title": "RagChunk", "type": "object" }, "RagChunkPageSpan": { "additionalProperties": false, "description": "Represents where the chunk starts and ends in the document.\n\nThis data type is not supported in Gemini API.", "properties": { "firstPage": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Page where chunk starts in the document. Inclusive. 1-indexed.", "title": "Firstpage" }, "lastPage": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Page where chunk ends in the document. Inclusive. 1-indexed.", "title": "Lastpage" } }, "title": "RagChunkPageSpan", "type": "object" }, "RealtimeCacheEntry": { "additionalProperties": false, "description": "Store audio data chunks for caching before flushing.", "properties": { "role": { "title": "Role", "type": "string" }, "data": { "$ref": "#/$defs/Blob" }, "timestamp": { "title": "Timestamp", "type": "number" } }, "required": [ "role", "data", "timestamp" ], "title": "RealtimeCacheEntry", "type": "object" }, "ResumabilityConfig": { "description": "The config of the resumability for an application.\n\nThe \"resumability\" in ADK refers to the ability to:\n1. pause an invocation upon a long-running function call.\n2. resume an invocation from the last event, if it's paused or failed midway\nthrough.\n\nNote: ADK resumes the invocation in a best-effort manner:\n1. Tool call to resume needs to be idempotent because we only guarantee\nan at-least-once behavior once resumed.\n2. Any temporary / in-memory state will be lost upon resumption.", "properties": { "is_resumable": { "default": false, "title": "Is Resumable", "type": "boolean" } }, "title": "ResumabilityConfig", "type": "object" }, "RetrievalMetadata": { "additionalProperties": false, "description": "Metadata returned to client when grounding is enabled.", "properties": { "googleSearchDynamicRetrievalScore": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Optional. Score indicating how likely information from google\n search could help answer the prompt. The score is in the range [0, 1],\n where 0 is the least likely and 1 is the most likely. This score is only\n populated when google search grounding and dynamic retrieval is enabled.\n It will be compared to the threshold to determine whether to trigger\n Google search.", "title": "Googlesearchdynamicretrievalscore" } }, "title": "RetrievalMetadata", "type": "object" }, "RetryConfig": { "description": "Configuration for retrying a node.", "properties": { "max_attempts": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Maximum number of attempts, including the original request.\n If 0 or 1, it means no retries. If not specified, default to 5.", "title": "Max Attempts" }, "initial_delay": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Initial delay before the first retry, in fractions of a second. If not specified, default to 1.0 second.", "title": "Initial Delay" }, "max_delay": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Maximum delay between retries, in fractions of a second. If not specified, default to 60.0 seconds.", "title": "Max Delay" }, "backoff_factor": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Multiplier by which the delay increases after each attempt. If not specified, default to 2.0.", "title": "Backoff Factor" }, "jitter": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Randomness factor for the delay. If not specified, default to 1.0. Otherwise use 0.0 to remove randomness.", "title": "Jitter" }, "exceptions": { "anyOf": [ { "items": { "anyOf": [ { "type": "string" }, {} ] }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Exceptions to retry on. Accepts exception class names as\n strings (e.g. ``['ValueError']``) or exception classes directly (e.g.\n ``[ValueError]``). ``None`` means retry on all exceptions.", "title": "Exceptions" } }, "title": "RetryConfig", "type": "object" }, "Schema": { "additionalProperties": false, "description": "Schema is used to define the format of input/output data.\n\nRepresents a select subset of an [OpenAPI 3.0 schema\nobject](https://spec.openapis.org/oas/v3.0.3#schema-object). More fields may\nbe added in the future as needed.", "properties": { "additionalProperties": { "anyOf": [ {}, { "type": "null" } ], "default": null, "description": "Optional. Can either be a boolean or an object; controls the presence of additional properties.", "title": "Additionalproperties" }, "defs": { "anyOf": [ { "additionalProperties": { "$ref": "#/$defs/Schema" }, "type": "object" }, { "type": "null" } ], "default": null, "description": "Optional. A map of definitions for use by `ref` Only allowed at the root of the schema.", "title": "Defs" }, "ref": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. Allows indirect references between schema nodes. The value should be a valid reference to a child of the root `defs`. For example, the following schema defines a reference to a schema node named \"Pet\": type: object properties: pet: ref: #/defs/Pet defs: Pet: type: object properties: name: type: string The value of the \"pet\" property is a reference to the schema node named \"Pet\". See details in https://json-schema.org/understanding-json-schema/structuring", "title": "Ref" }, "anyOf": { "anyOf": [ { "items": { "$ref": "#/$defs/Schema" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Optional. The instance must be valid against any (one or more) of the subschemas listed in `any_of`.", "title": "Anyof" }, "default": { "anyOf": [ {}, { "type": "null" } ], "default": null, "description": "Optional. Default value to use if the field is not specified.", "title": "Default" }, "description": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. Describes the data. The model uses this field to understand the purpose of the schema and how to use it. It is a best practice to provide a clear and descriptive explanation for the schema and its properties here, rather than in the prompt.", "title": "Description" }, "enum": { "anyOf": [ { "items": { "type": "string" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Optional. Possible values of the field. This field can be used to restrict a value to a fixed set of values. To mark a field as an enum, set `format` to `enum` and provide the list of possible values in `enum`. For example: 1. To define directions: `{type:STRING, format:enum, enum:[\"EAST\", \"NORTH\", \"SOUTH\", \"WEST\"]}` 2. To define apartment numbers: `{type:INTEGER, format:enum, enum:[\"101\", \"201\", \"301\"]}`", "title": "Enum" }, "example": { "anyOf": [ {}, { "type": "null" } ], "default": null, "description": "Optional. Example of an instance of this schema.", "title": "Example" }, "format": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. The format of the data. For `NUMBER` type, format can be `float` or `double`. For `INTEGER` type, format can be `int32` or `int64`. For `STRING` type, format can be `email`, `byte`, `date`, `date-time`, `password`, and other formats to further refine the data type.", "title": "Format" }, "items": { "anyOf": [ { "$ref": "#/$defs/Schema" }, { "type": "null" } ], "default": null, "description": "Optional. If type is `ARRAY`, `items` specifies the schema of elements in the array." }, "maxItems": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Optional. If type is `ARRAY`, `max_items` specifies the maximum number of items in an array.", "title": "Maxitems" }, "maxLength": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Optional. If type is `STRING`, `max_length` specifies the maximum length of the string.", "title": "Maxlength" }, "maxProperties": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Optional. If type is `OBJECT`, `max_properties` specifies the maximum number of properties that can be provided.", "title": "Maxproperties" }, "maximum": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Optional. If type is `INTEGER` or `NUMBER`, `maximum` specifies the maximum allowed value.", "title": "Maximum" }, "minItems": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Optional. If type is `ARRAY`, `min_items` specifies the minimum number of items in an array.", "title": "Minitems" }, "minLength": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Optional. If type is `STRING`, `min_length` specifies the minimum length of the string.", "title": "Minlength" }, "minProperties": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Optional. If type is `OBJECT`, `min_properties` specifies the minimum number of properties that can be provided.", "title": "Minproperties" }, "minimum": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Optional. If type is `INTEGER` or `NUMBER`, `minimum` specifies the minimum allowed value.", "title": "Minimum" }, "nullable": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "description": "Optional. Indicates if the value of this field can be null.", "title": "Nullable" }, "pattern": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. If type is `STRING`, `pattern` specifies a regular expression that the string must match.", "title": "Pattern" }, "properties": { "anyOf": [ { "additionalProperties": { "$ref": "#/$defs/Schema" }, "type": "object" }, { "type": "null" } ], "default": null, "description": "Optional. If type is `OBJECT`, `properties` is a map of property names to schema definitions for each property of the object.", "title": "Properties" }, "propertyOrdering": { "anyOf": [ { "items": { "type": "string" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Optional. Order of properties displayed or used where order matters. This is not a standard field in OpenAPI specification, but can be used to control the order of properties.", "title": "Propertyordering" }, "required": { "anyOf": [ { "items": { "type": "string" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Optional. If type is `OBJECT`, `required` lists the names of properties that must be present.", "title": "Required" }, "title": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. Title for the schema.", "title": "Title" }, "type": { "anyOf": [ { "$ref": "#/$defs/Type" }, { "type": "null" } ], "default": null, "description": "Optional. Data type of the schema field." } }, "title": "Schema", "type": "object" }, "SearchEntryPoint": { "additionalProperties": false, "description": "The entry point used to search for grounding sources.", "properties": { "renderedContent": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. Web content snippet that can be embedded in a web page\n or an app webview.", "title": "Renderedcontent" }, "sdkBlob": { "anyOf": [ { "format": "base64url", "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. JSON representing array of tuples.", "title": "Sdkblob" } }, "title": "SearchEntryPoint", "type": "object" }, "Segment": { "additionalProperties": false, "description": "Segment of the content this support belongs to.", "properties": { "startIndex": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Output only. Start index in the given Part, measured in bytes.\n\n Offset from the start of the Part, inclusive, starting at zero.", "title": "Startindex" }, "endIndex": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Output only. End index in the given Part, measured in bytes.\n\n Offset from the start of the Part, exclusive, starting at zero.", "title": "Endindex" }, "partIndex": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Output only. The index of a Part object within its parent\n Content object.", "title": "Partindex" }, "text": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Output only. The text corresponding to the segment from the\n response.", "title": "Text" } }, "title": "Segment", "type": "object" }, "ServiceAccount": { "additionalProperties": true, "description": "Represents Google Service Account configuration.\n\nAttributes:\n service_account_credential: The service account credential (JSON key).\n scopes: The OAuth2 scopes to request. Optional; when omitted with\n ``use_default_credential=True``, defaults to the cloud-platform scope.\n use_default_credential: Whether to use Application Default Credentials.\n use_id_token: Whether to exchange for an ID token instead of an access\n token. Required for service-to-service authentication with Cloud Run,\n Cloud Functions, and other Google Cloud services that require identity\n verification. When True, ``audience`` must also be set.\n audience: The target audience for the ID token, typically the URL of the\n receiving service (e.g. ``https://my-service-xyz.run.app``). Required\n when ``use_id_token`` is True.", "properties": { "serviceAccountCredential": { "anyOf": [ { "$ref": "#/$defs/ServiceAccountCredential" }, { "type": "null" } ], "default": null }, "scopes": { "anyOf": [ { "items": { "type": "string" }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Scopes" }, "useDefaultCredential": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": false, "title": "Usedefaultcredential" }, "useIdToken": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": false, "title": "Useidtoken" }, "audience": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Audience" } }, "title": "ServiceAccount", "type": "object" }, "ServiceAccountCredential": { "additionalProperties": true, "description": "Represents Google Service Account configuration.\n\nAttributes:\n type: The type should be \"service_account\".\n project_id: The project ID.\n private_key_id: The ID of the private key.\n private_key: The private key.\n client_email: The client email.\n client_id: The client ID.\n auth_uri: The authorization URI.\n token_uri: The token URI.\n auth_provider_x509_cert_url: URL for auth provider's X.509 cert.\n client_x509_cert_url: URL for the client's X.509 cert.\n universe_domain: The universe domain.\n\nExample:\n\n config = ServiceAccountCredential(\n type_=\"service_account\",\n project_id=\"your_project_id\",\n private_key_id=\"your_private_key_id\",\n private_key=\"-----BEGIN PRIVATE KEY-----...\",\n client_email=\"...@....iam.gserviceaccount.com\",\n client_id=\"your_client_id\",\n auth_uri=\"https://accounts.google.com/o/oauth2/auth\",\n token_uri=\"https://oauth2.googleapis.com/token\",\n auth_provider_x509_cert_url=\"https://www.googleapis.com/oauth2/v1/certs\",\n client_x509_cert_url=\"https://www.googleapis.com/robot/v1/metadata/x509/...\",\n universe_domain=\"googleapis.com\"\n )\n\n\n config = ServiceAccountConfig.model_construct(**{\n ...service account config dict\n })", "properties": { "type": { "default": "", "title": "Type", "type": "string" }, "projectId": { "title": "Projectid", "type": "string" }, "privateKeyId": { "title": "Privatekeyid", "type": "string" }, "privateKey": { "title": "Privatekey", "type": "string" }, "clientEmail": { "title": "Clientemail", "type": "string" }, "clientId": { "title": "Clientid", "type": "string" }, "authUri": { "title": "Authuri", "type": "string" }, "tokenUri": { "title": "Tokenuri", "type": "string" }, "authProviderX509CertUrl": { "title": "Authproviderx509Certurl", "type": "string" }, "clientX509CertUrl": { "title": "Clientx509Certurl", "type": "string" }, "universeDomain": { "title": "Universedomain", "type": "string" } }, "required": [ "projectId", "privateKeyId", "privateKey", "clientEmail", "clientId", "authUri", "tokenUri", "authProviderX509CertUrl", "clientX509CertUrl", "universeDomain" ], "title": "ServiceAccountCredential", "type": "object" }, "Session": { "additionalProperties": false, "description": "Represents a series of interactions between a user and agents.", "properties": { "id": { "description": "Unique identifier of the session.", "examples": [ "session-abc123" ], "title": "Id", "type": "string" }, "appName": { "description": "Application name that owns the session.", "examples": [ "hello_world" ], "title": "Appname", "type": "string" }, "userId": { "description": "User ID that owns the session.", "examples": [ "user-123" ], "title": "Userid", "type": "string" }, "state": { "additionalProperties": true, "description": "Current persisted session state.", "examples": [ { "locale": "en-US" } ], "title": "State", "type": "object" }, "events": { "description": "Ordered event history for the session, including user, model, and tool events (e.g. user input, model response, function call/response).", "items": { "$ref": "#/$defs/Event" }, "title": "Events", "type": "array" }, "lastUpdateTime": { "default": 0.0, "description": "Unix timestamp in seconds for the most recent session update.", "examples": [ 1742000000.0 ], "title": "Lastupdatetime", "type": "number" } }, "required": [ "id", "appName", "userId" ], "title": "Session", "type": "object" }, "ToolCall": { "additionalProperties": false, "description": "A predicted server-side `ToolCall` returned from the model.\n\nThis message contains information about a tool that the model wants to invoke.\nThe client is NOT expected to execute this `ToolCall`. Instead, the\nclient should pass this `ToolCall` back to the API in a subsequent turn\nwithin a `Content` message, along with the corresponding `ToolResponse`.", "properties": { "id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Unique identifier of the tool call. The server returns the tool response with the matching `id`.", "title": "Id" }, "toolType": { "anyOf": [ { "$ref": "#/$defs/ToolType" }, { "type": "null" } ], "default": null, "description": "The type of tool that was called." }, "args": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "type": "null" } ], "default": null, "description": "The tool call arguments. Example: {\"arg1\": \"value1\", \"arg2\": \"value2\"}.", "title": "Args" } }, "title": "ToolCall", "type": "object" }, "ToolConfirmation": { "additionalProperties": false, "description": "Represents a tool confirmation configuration.", "properties": { "hint": { "default": "", "title": "Hint", "type": "string" }, "confirmed": { "default": false, "title": "Confirmed", "type": "boolean" }, "payload": { "anyOf": [ {}, { "type": "null" } ], "default": null, "title": "Payload" } }, "title": "ToolConfirmation", "type": "object" }, "ToolResponse": { "additionalProperties": false, "description": "The output from a server-side `ToolCall` execution.\n\nThis message contains the results of a tool invocation that was initiated by a\n`ToolCall` from the model. The client should pass this `ToolResponse` back to\nthe API in a subsequent turn within a `Content` message, along with the\ncorresponding `ToolCall`.", "properties": { "id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The identifier of the tool call this response is for.", "title": "Id" }, "toolType": { "anyOf": [ { "$ref": "#/$defs/ToolType" }, { "type": "null" } ], "default": null, "description": "The type of tool that was called, matching the tool_type in the corresponding ToolCall." }, "response": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "type": "null" } ], "default": null, "description": "The tool response.", "title": "Response" } }, "title": "ToolResponse", "type": "object" }, "ToolType": { "description": "The type of tool in the function call.", "enum": [ "TOOL_TYPE_UNSPECIFIED", "GOOGLE_SEARCH_WEB", "GOOGLE_SEARCH_IMAGE", "URL_CONTEXT", "GOOGLE_MAPS", "FILE_SEARCH" ], "title": "ToolType", "type": "string" }, "TrafficType": { "description": "Output only.\n\nThe traffic type for this request. This enum is not supported in Gemini API.", "enum": [ "TRAFFIC_TYPE_UNSPECIFIED", "ON_DEMAND", "ON_DEMAND_PRIORITY", "ON_DEMAND_FLEX", "PROVISIONED_THROUGHPUT" ], "title": "TrafficType", "type": "string" }, "Transcription": { "additionalProperties": false, "description": "Audio transcription in Server Content.", "properties": { "text": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. Transcription text.", "title": "Text" }, "finished": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "description": "Optional. The bool indicates the end of the transcription.", "title": "Finished" }, "languageCode": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The BCP-47 language code of the transcription.", "title": "Languagecode" }, "speakerLabel": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "A label identifying the speaker of this audio segment (e.g. \"spk_1\", \"spk_2\").\n ", "title": "Speakerlabel" }, "words": { "anyOf": [ { "items": { "$ref": "#/$defs/WordInfo" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Detailed word-level transcriptions and timing details.\n ", "title": "Words" } }, "title": "Transcription", "type": "object" }, "TranscriptionEntry": { "additionalProperties": false, "description": "Store the data that can be used for transcription.", "properties": { "role": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Role" }, "data": { "anyOf": [ { "$ref": "#/$defs/Blob" }, { "$ref": "#/$defs/Content" } ], "title": "Data" } }, "required": [ "data" ], "title": "TranscriptionEntry", "type": "object" }, "TurnCompleteReason": { "description": "The reason why the turn is complete.", "enum": [ "TURN_COMPLETE_REASON_UNSPECIFIED", "MALFORMED_FUNCTION_CALL", "RESPONSE_REJECTED", "NEED_MORE_INPUT", "PROHIBITED_INPUT_CONTENT", "IMAGE_PROHIBITED_INPUT_CONTENT", "INPUT_TEXT_CONTAIN_PROMINENT_PERSON_PROHIBITED", "INPUT_IMAGE_CELEBRITY", "INPUT_IMAGE_PHOTO_REALISTIC_CHILD_PROHIBITED", "INPUT_TEXT_NCII_PROHIBITED", "INPUT_OTHER", "INPUT_IP_PROHIBITED", "BLOCKLIST", "UNSAFE_PROMPT_FOR_IMAGE_GENERATION", "GENERATED_IMAGE_SAFETY", "GENERATED_CONTENT_SAFETY", "GENERATED_AUDIO_SAFETY", "GENERATED_VIDEO_SAFETY", "GENERATED_CONTENT_PROHIBITED", "GENERATED_CONTENT_BLOCKLIST", "GENERATED_IMAGE_PROHIBITED", "GENERATED_IMAGE_CELEBRITY", "GENERATED_IMAGE_PROMINENT_PEOPLE_DETECTED_BY_REWRITER", "GENERATED_IMAGE_IDENTIFIABLE_PEOPLE", "GENERATED_IMAGE_MINORS", "OUTPUT_IMAGE_IP_PROHIBITED", "GENERATED_OTHER", "MAX_REGENERATION_REACHED" ], "title": "TurnCompleteReason", "type": "string" }, "Type": { "description": "Data type of the schema field.", "enum": [ "TYPE_UNSPECIFIED", "STRING", "NUMBER", "INTEGER", "BOOLEAN", "ARRAY", "OBJECT", "NULL" ], "title": "Type", "type": "string" }, "UiWidget": { "additionalProperties": false, "description": "Rendering metadata for a UI widget associated with an event.\n\nWhen present on an Event.actions, the UI renders the widget using the\nspecified provider's renderer component.", "properties": { "id": { "title": "Id", "type": "string" }, "provider": { "title": "Provider", "type": "string" }, "payload": { "additionalProperties": true, "title": "Payload", "type": "object" } }, "required": [ "id", "provider" ], "title": "UiWidget", "type": "object" }, "VideoMetadata": { "additionalProperties": false, "description": "Provides metadata for a video, including the start and end offsets for clipping and the frame rate.", "properties": { "endOffset": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. The end offset of the video.", "title": "Endoffset" }, "fps": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Optional. The frame rate of the video sent to the model. If not specified, the default value is 1.0. The valid range is (0.0, 24.0].", "title": "Fps" }, "startOffset": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. The start offset of the video.", "title": "Startoffset" } }, "title": "VideoMetadata", "type": "object" }, "VoiceActivity": { "additionalProperties": false, "description": "Voice activity signal.", "properties": { "voiceActivityType": { "anyOf": [ { "$ref": "#/$defs/VoiceActivityType" }, { "type": "null" } ], "default": null, "description": "The type of the voice activity signal." }, "audioOffset": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The time voice activity detected in audio time, relative to the start of the audio stream.", "title": "Audiooffset" } }, "title": "VoiceActivity", "type": "object" }, "VoiceActivityType": { "description": "The type of the voice activity signal.", "enum": [ "TYPE_UNSPECIFIED", "ACTIVITY_START", "ACTIVITY_END" ], "title": "VoiceActivityType", "type": "string" }, "WordInfo": { "additionalProperties": false, "description": "Information about a single recognized word.", "properties": { "word": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Transcript of the word.\n ", "title": "Word" }, "startOffset": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Start offset in time of the word relative to the start of the audio.\n ", "title": "Startoffset" }, "endOffset": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "End offset in time of the word relative to the start of the audio.\n ", "title": "Endoffset" } }, "title": "WordInfo", "type": "object" } }, "additionalProperties": false, "required": [ "invocation_id", "session" ] }
- Fields:
active_non_blocking_tool_tasks (dict[str, _asyncio.Task[Any]] | None)active_streaming_tools (dict[str, google.adk.agents.active_streaming_tool.ActiveStreamingTool] | None)agent (google.adk.agents.base_agent.BaseAgent | google.adk.workflow._base_node.BaseNode | None)agent_states (dict[str, dict[str, Any]])artifact_service (google.adk.artifacts.base_artifact_service.BaseArtifactService | None)branch (str | None)canonical_tools_cache (list[google.adk.tools.base_tool.BaseTool] | None)context_cache_config (google.adk.agents.context_cache_config.ContextCacheConfig | None)credential_by_key (dict[str, google.adk.auth.auth_credential.AuthCredential])credential_service (google.adk.auth.credential_service.base_credential_service.BaseCredentialService | None)end_invocation (bool)end_of_agents (dict[str, bool])events_compaction_config (google.adk.apps._configs.EventsCompactionConfig | None)input_realtime_cache (list[google.adk.agents.invocation_context.RealtimeCacheEntry] | None)invocation_id (str)isolation_scope (str | None)live_request_queue (google.adk.agents.live_request_queue.LiveRequestQueue | None)live_session_resumption_handle (str | None)memory_service (google.adk.memory.base_memory_service.BaseMemoryService | None)node_path (str | None)output_realtime_cache (list[google.adk.agents.invocation_context.RealtimeCacheEntry] | None)plugin_manager (google.adk.plugins.plugin_manager.PluginManager)resumability_config (google.adk.apps._configs.ResumabilityConfig | None)run_config (google.adk.agents.run_config.RunConfig | None)session (google.adk.sessions.session.Session)session_service (google.adk.sessions.base_session_service.BaseSessionService)token_compaction_checked (bool)transcription_cache (list[google.adk.agents.transcription_entry.TranscriptionEntry] | None)user_content (google.genai.types.Content | None)
- field active_non_blocking_tool_tasks: Optional[dict[str, asyncio.Task[Any]]] = None¶
The running non-blocking tool tasks of this invocation (Live only).
- field active_streaming_tools: Optional[dict[str, ActiveStreamingTool]] = None¶
The running streaming tools of this invocation.
- field agent: Optional[BaseAgent | BaseNode] = None¶
The current agent of this invocation context.
None when Runner drives a BaseNode (not a BaseAgent).
- field agent_states: dict[str, dict[str, Any]] [Optional]¶
The state of the agent for this invocation.
- field artifact_service: Optional[BaseArtifactService] = None¶
- field branch: Optional[str] = None¶
The branch of the invocation context.
The format is like agent_1.agent_2.agent_3, where agent_1 is the parent of agent_2, and agent_2 is the parent of agent_3.
Branch is used when multiple sub-agents shouldn’t see their peer agents’ conversation history.
- field canonical_tools_cache: Optional[list[BaseTool]] = None¶
The cache of canonical tools for this invocation.
- field context_cache_config: Optional[ContextCacheConfig] = None¶
- field credential_by_key: dict[str, AuthCredential] [Optional]¶
The resolved credentials for this invocation, keyed by credential_key.
- field credential_service: Optional[BaseCredentialService] = None¶
- field end_invocation: bool = False¶
Whether to end this invocation.
Set to True in callbacks or tools to terminate this invocation.
- field end_of_agents: dict[str, bool] [Optional]¶
The end of agent status for each agent in this invocation.
- field events_compaction_config: Optional[EventsCompactionConfig] = None¶
The compaction config for this invocation.
- field input_realtime_cache: Optional[list[RealtimeCacheEntry]] = None¶
Caches input audio chunks before flushing to session and artifact services.
- field invocation_id: str [Required]¶
The id of this invocation context. Readonly.
- field isolation_scope: Optional[str] = None¶
Scope tag for filtering session events visible to this agent.
When set, the LLM content-builder restricts session events to those whose
event.isolation_scopematches. One usage today is the Task API: task-mode and single_turn-mode agents are scoped under the originating function-call id; chat coordinators are unscoped and see only unscoped events.⚠️ DO NOT USE THIS FIELD DIRECTLY. It is an internal mechanism that may change without notice.
- field live_request_queue: Optional[LiveRequestQueue] = None¶
The queue to receive live requests.
- field live_session_resumption_handle: Optional[str] = None¶
The handle for live session resumption.
- field memory_service: Optional[BaseMemoryService] = None¶
- field node_path: Optional[str] = None¶
The path of the current agent in the workflow call stack.
Used by workflow agents to track their position in nested agent hierarchies. Format: “agent_1/agent_2/agent_3” where agent_1 is the outermost workflow. None for non-workflow agents.
- field output_realtime_cache: Optional[list[RealtimeCacheEntry]] = None¶
Caches output audio chunks before flushing to session and artifact services.
- field plugin_manager: PluginManager [Optional]¶
The manager for keeping track of plugins in this invocation.
- field resumability_config: Optional[ResumabilityConfig] = None¶
The resumability config that applies to all agents under this invocation.
- field run_config: Optional[RunConfig] = None¶
Configurations for live agents under this invocation.
- field session: Session [Required]¶
The current session of this invocation context. Readonly.
- field session_service: BaseSessionService [Required]¶
- field token_compaction_checked: bool = False¶
Whether token-threshold compaction ran during this invocation.
- field transcription_cache: Optional[list[TranscriptionEntry]] = None¶
Caches necessary data, audio or contents, that are needed by transcription.
- field user_content: Optional[types.Content] = None¶
The user content that started this invocation. Readonly.
- increment_llm_call_count()¶
Tracks number of llm calls made.
- Return type:
None- Raises:
LlmCallsLimitExceededError – If number of llm calls made exceed the set threshold.
- model_post_init(_InvocationContext__context)¶
Override this method to perform additional initialization after __init__ and model_construct. This is useful if you want to do some validation that requires the entire model to be initialized.
- Return type:
None
- populate_invocation_agent_states()¶
Populates agent states for the current invocation if it is resumable.
For history events that contain agent state information, set the agent_state and end_of_agent of the agent that generated the event.
For non-workflow agents, also set an initial agent_state if it has already generated some contents.
- Return type:
None
- reset_sub_agent_states(agent_name)¶
Resets the state of all sub-agents of the given agent in this invocation.
- Return type:
None- Parameters:
agent_name – The name of the agent whose sub-agent states need to be reset.
- set_agent_state(agent_name, *, agent_state=None, end_of_agent=False)¶
Sets the state of an agent in this invocation.
If end_of_agent is True, will set the end_of_agent flag to True and clear the agent_state.
Otherwise, if agent_state is not None, will set the agent_state and reset the end_of_agent flag to False.
Otherwise, will clear the agent_state and end_of_agent flag, to allow the agent to re-run.
- Parameters:
agent_name – The name of the agent.
agent_state – The state of the agent. Will be ignored if end_of_agent is True.
end_of_agent – Whether the agent has finished running.
- Return type:
None
- should_pause_invocation(event)¶
Returns whether to pause the invocation right after this event.
“Pausing” an invocation is different from “ending” an invocation. A paused invocation can be resumed later, while an ended invocation cannot.
Pausing the current agent’s run will also pause all the agents that depend on its execution, i.e. the subsequent agents in a workflow, and the current agent’s ancestors, etc.
Note that parallel sibling agents won’t be affected, but their common ancestors will be paused after all the non-blocking sub-agents finished running.
- Return type:
bool
- Should meet all following conditions to pause an invocation:
The current event has a long running function call.
- Parameters:
event – The current event.
- Returns:
Whether to pause the invocation right after this event.
- stamp_event_branch_context(event)¶
Stamps the event with the branch and isolation scope of its matching function call.
- Return type:
None
- property app_name: str¶
- property is_resumable: bool¶
Returns whether the current invocation is resumable.
- property user_id: str¶
- pydantic model google.adk.agents.LiveRequest¶
Bases:
BaseModelRequest send to live agents.
Show JSON schema
{ "title": "LiveRequest", "description": "Request send to live agents.", "type": "object", "properties": { "content": { "anyOf": [ { "$ref": "#/$defs/Content" }, { "type": "null" } ], "default": null }, "blob": { "anyOf": [ { "$ref": "#/$defs/Blob" }, { "type": "null" } ], "default": null }, "activity_start": { "anyOf": [ { "$ref": "#/$defs/ActivityStart" }, { "type": "null" } ], "default": null }, "activity_end": { "anyOf": [ { "$ref": "#/$defs/ActivityEnd" }, { "type": "null" } ], "default": null }, "close": { "default": false, "title": "Close", "type": "boolean" }, "partial": { "default": false, "title": "Partial", "type": "boolean" }, "state_delta": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "type": "null" } ], "default": null, "title": "State Delta" } }, "$defs": { "ActivityEnd": { "additionalProperties": false, "description": "Marks the end of user activity.\n\nThis can only be sent if automatic (i.e. server-side) activity detection is\ndisabled.", "properties": {}, "title": "ActivityEnd", "type": "object" }, "ActivityStart": { "additionalProperties": false, "description": "Marks the start of user activity.\n\nThis can only be sent if automatic (i.e. server-side) activity detection is\ndisabled.", "properties": {}, "title": "ActivityStart", "type": "object" }, "Blob": { "additionalProperties": false, "description": "A content blob.\n\nA Blob contains data of a specific media type. It is used to represent images,\naudio, and video.", "properties": { "data": { "anyOf": [ { "format": "base64url", "type": "string" }, { "type": "null" } ], "default": null, "description": "Required. The raw bytes of the data.", "title": "Data" }, "displayName": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. The display name of the blob. Used to provide a label or filename to distinguish blobs. This field is only returned in `PromptMessage` for prompt management. It is used in the Gemini calls only when server-side tools (`code_execution`, `google_search`, and `url_context`) are enabled. This field is not supported in Gemini API.", "title": "Displayname" }, "mimeType": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Required. The IANA standard MIME type of the source data.", "title": "Mimetype" } }, "title": "Blob", "type": "object" }, "CodeExecutionResult": { "additionalProperties": false, "description": "Result of executing the ExecutableCode.\n\nGenerated only when the `CodeExecution` tool is used.", "properties": { "outcome": { "anyOf": [ { "$ref": "#/$defs/Outcome" }, { "type": "null" } ], "default": null, "description": "Required. Outcome of the code execution." }, "output": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. Contains stdout when code execution is successful, stderr or other description otherwise.", "title": "Output" }, "id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. The identifier of the `ExecutableCode` part this result is for. Only populated if the corresponding `ExecutableCode` has an id. This field is not supported in Vertex AI.", "title": "Id" } }, "title": "CodeExecutionResult", "type": "object" }, "Content": { "additionalProperties": false, "description": "Contains the multi-part content of a message.", "properties": { "parts": { "anyOf": [ { "items": { "$ref": "#/$defs/Part" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "List of parts that constitute a single message. Each part may have\n a different IANA MIME type.", "title": "Parts" }, "role": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. The producer of the content. Must be either 'user' or 'model'. If not set, the service will default to 'user'.", "title": "Role" } }, "title": "Content", "type": "object" }, "ExecutableCode": { "additionalProperties": false, "description": "Code generated by the model that is meant to be executed, and the result returned to the model.\n\nGenerated when using the `CodeExecution` tool, in which the code will be\nautomatically executed, and a corresponding CodeExecutionResult will also be\ngenerated.", "properties": { "code": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Required. The code to be executed.", "title": "Code" }, "language": { "anyOf": [ { "$ref": "#/$defs/Language" }, { "type": "null" } ], "default": null, "description": "Required. Programming language of the `code`." }, "id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. Unique identifier of the `ExecutableCode` part. The server returns the `CodeExecutionResult` with the matching `id`. This field is not supported in Vertex AI.", "title": "Id" } }, "title": "ExecutableCode", "type": "object" }, "FileData": { "additionalProperties": false, "description": "URI-based data.\n\nA FileData message contains a URI pointing to data of a specific media type.\nIt is used to represent images, audio, and video stored in Google Cloud\nStorage.", "properties": { "displayName": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. The display name of the file. Used to provide a label or filename to distinguish files. This field is only returned in `PromptMessage` for prompt management. It is used in the Gemini calls only when server side tools (`code_execution`, `google_search`, and `url_context`) are enabled. This field is not supported in Gemini API.", "title": "Displayname" }, "fileUri": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Required. The URI of the file in Google Cloud Storage.", "title": "Fileuri" }, "mimeType": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Required. The IANA standard MIME type of the source data.", "title": "Mimetype" } }, "title": "FileData", "type": "object" }, "FunctionCall": { "additionalProperties": false, "description": "A predicted FunctionCall returned from the model that contains a string representing the FunctionDeclaration.name and a structured JSON object containing the parameters and their values.", "properties": { "id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. The unique id of the function call. If populated, the client to execute the `function_call` and return the response with the matching `id`.", "title": "Id" }, "args": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "type": "null" } ], "default": null, "description": "Optional. The function parameters and values in JSON object format. See FunctionDeclaration.parameters for parameter details.", "title": "Args" }, "name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. The name of the function to call. Matches FunctionDeclaration.name.", "title": "Name" }, "partialArgs": { "anyOf": [ { "items": { "$ref": "#/$defs/PartialArg" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Optional. The partial argument value of the function call. If provided, represents the arguments/fields that are streamed incrementally. This field is not supported in Gemini API.", "title": "Partialargs" }, "willContinue": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "description": "Optional. Whether this is the last part of the FunctionCall. If true, another partial message for the current FunctionCall is expected to follow. This field is not supported in Gemini API.", "title": "Willcontinue" } }, "title": "FunctionCall", "type": "object" }, "FunctionResponse": { "additionalProperties": false, "description": "The result output from a FunctionCall that contains a string representing the FunctionDeclaration.name and a structured JSON object containing any output from the function is used as context to the model.\n\nThis should contain the result of a `FunctionCall` made based on model\nprediction.", "properties": { "willContinue": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "description": "Optional. Signals that function call continues, and more responses will be returned, turning the function call into a generator. Is only applicable to NON_BLOCKING function calls, is ignored otherwise. If set to false, future responses will not be considered. It is allowed to return empty `response` with `will_continue=False` to signal that the function call is finished. This may still trigger the model generation. To avoid triggering the generation and finish the function call, additionally set `scheduling` to `SILENT`. This field is not supported in Vertex AI.", "title": "Willcontinue" }, "scheduling": { "anyOf": [ { "$ref": "#/$defs/FunctionResponseScheduling" }, { "type": "null" } ], "default": null, "description": "Optional. Specifies how the response should be scheduled in the conversation. Only applicable to NON_BLOCKING function calls, is ignored otherwise. Defaults to WHEN_IDLE." }, "parts": { "anyOf": [ { "items": { "$ref": "#/$defs/FunctionResponsePart" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Optional. Ordered `Parts` that constitute a function response. Parts may have different IANA MIME types.", "title": "Parts" }, "id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. The id of the function call this response is for. Populated by the client to match the corresponding function call `id`.", "title": "Id" }, "name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Required. The name of the function to call. Matches FunctionDeclaration.name and FunctionCall.name.", "title": "Name" }, "response": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "type": "null" } ], "default": null, "description": "Required. The function response in JSON object format. Use \"output\" key to specify function output and \"error\" key to specify error details (if any). If \"output\" and \"error\" keys are not specified, then whole \"response\" is treated as function output.", "title": "Response" } }, "title": "FunctionResponse", "type": "object" }, "FunctionResponseBlob": { "additionalProperties": false, "description": "Raw media bytes for function response.\n\nText should not be sent as raw bytes, use the 'text' field.", "properties": { "mimeType": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Required. The IANA standard MIME type of the source data.", "title": "Mimetype" }, "data": { "anyOf": [ { "format": "base64url", "type": "string" }, { "type": "null" } ], "default": null, "description": "Required. Raw bytes.", "title": "Data" }, "displayName": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. Display name of the blob. Used to provide a label or filename to distinguish blobs. This field is only returned in PromptMessage for prompt management. It is currently used in the Gemini GenerateContent calls only when server side tools (code_execution, google_search, and url_context) are enabled. This field is not supported in Gemini API.", "title": "Displayname" } }, "title": "FunctionResponseBlob", "type": "object" }, "FunctionResponseFileData": { "additionalProperties": false, "description": "URI based data for function response.\n\nThis data type is not supported in Gemini API.", "properties": { "fileUri": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Required. URI.", "title": "Fileuri" }, "mimeType": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Required. The IANA standard MIME type of the source data.", "title": "Mimetype" }, "displayName": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. Display name of the file data. Used to provide a label or filename to distinguish file datas. This field is only returned in PromptMessage for prompt management. It is currently used in the Gemini GenerateContent calls only when server side tools (code_execution, google_search, and url_context) are enabled.", "title": "Displayname" } }, "title": "FunctionResponseFileData", "type": "object" }, "FunctionResponsePart": { "additionalProperties": false, "description": "A datatype containing media that is part of a `FunctionResponse` message.\n\nA `FunctionResponsePart` consists of data which has an associated datatype. A\n`FunctionResponsePart` can only contain one of the accepted types in\n`FunctionResponsePart.data`. A `FunctionResponsePart` must have a fixed IANA\nMIME type identifying the type and subtype of the media if the `inline_data`\nfield is filled with raw bytes.", "properties": { "inlineData": { "anyOf": [ { "$ref": "#/$defs/FunctionResponseBlob" }, { "type": "null" } ], "default": null, "description": "Inline media bytes." }, "fileData": { "anyOf": [ { "$ref": "#/$defs/FunctionResponseFileData" }, { "type": "null" } ], "default": null, "description": "URI based data. This field is not supported in Gemini API." } }, "title": "FunctionResponsePart", "type": "object" }, "FunctionResponseScheduling": { "description": "Specifies how the response should be scheduled in the conversation.\n\nOnly applicable to NON_BLOCKING function calls, is ignored otherwise. Defaults\nto WHEN_IDLE.", "enum": [ "SCHEDULING_UNSPECIFIED", "SILENT", "WHEN_IDLE", "INTERRUPT" ], "title": "FunctionResponseScheduling", "type": "string" }, "Language": { "description": "Programming language of the `code`.", "enum": [ "LANGUAGE_UNSPECIFIED", "PYTHON" ], "title": "Language", "type": "string" }, "Outcome": { "description": "Outcome of the code execution.", "enum": [ "OUTCOME_UNSPECIFIED", "OUTCOME_OK", "OUTCOME_FAILED", "OUTCOME_DEADLINE_EXCEEDED" ], "title": "Outcome", "type": "string" }, "Part": { "additionalProperties": false, "description": "A datatype containing media content.\n\nExactly one field within a Part should be set, representing the specific type\nof content being conveyed. Using multiple fields within the same `Part`\ninstance is considered invalid.", "properties": { "mediaResolution": { "anyOf": [ { "$ref": "#/$defs/PartMediaResolution" }, { "type": "null" } ], "default": null, "description": "Media resolution for the input media.\n " }, "codeExecutionResult": { "anyOf": [ { "$ref": "#/$defs/CodeExecutionResult" }, { "type": "null" } ], "default": null, "description": "Optional. The result of executing the ExecutableCode." }, "executableCode": { "anyOf": [ { "$ref": "#/$defs/ExecutableCode" }, { "type": "null" } ], "default": null, "description": "Optional. Code generated by the model that is intended to be executed." }, "fileData": { "anyOf": [ { "$ref": "#/$defs/FileData" }, { "type": "null" } ], "default": null, "description": "Optional. The URI-based data of the part. This can be used to include files from Google Cloud Storage." }, "functionCall": { "anyOf": [ { "$ref": "#/$defs/FunctionCall" }, { "type": "null" } ], "default": null, "description": "Optional. A predicted function call returned from the model. This contains the name of the function to call and the arguments to pass to the function." }, "functionResponse": { "anyOf": [ { "$ref": "#/$defs/FunctionResponse" }, { "type": "null" } ], "default": null, "description": "Optional. The result of a function call. This is used to provide the model with the result of a function call that it predicted." }, "inlineData": { "anyOf": [ { "$ref": "#/$defs/Blob" }, { "type": "null" } ], "default": null, "description": "Optional. The inline data content of the part. This can be used to include images, audio, or video in a request." }, "text": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. The text content of the part. When sent from the VSCode Gemini Code Assist extension, references to @mentioned items will be converted to markdown boldface text. For example `@my-repo` will be converted to and sent as `**my-repo**` by the IDE agent.", "title": "Text" }, "thought": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "description": "Optional. Indicates whether the `part` represents the model's thought process or reasoning.", "title": "Thought" }, "thoughtSignature": { "anyOf": [ { "format": "base64url", "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. An opaque signature for the thought so it can be reused in subsequent requests.", "title": "Thoughtsignature" }, "videoMetadata": { "anyOf": [ { "$ref": "#/$defs/VideoMetadata" }, { "type": "null" } ], "default": null, "description": "Optional. Video metadata. The metadata should only be specified while the video data is presented in inline_data or file_data." }, "toolCall": { "anyOf": [ { "$ref": "#/$defs/ToolCall" }, { "type": "null" } ], "default": null, "description": "Server-side tool call. This field is populated when the model predicts a tool invocation that should be executed on the server. The client is expected to echo this message back to the API." }, "toolResponse": { "anyOf": [ { "$ref": "#/$defs/ToolResponse" }, { "type": "null" } ], "default": null, "description": "The output from a server-side ToolCall execution. This field is populated by the client with the results of executing the corresponding ToolCall." }, "partMetadata": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "type": "null" } ], "default": null, "description": "Custom metadata associated with the Part. Agents using genai.Part as content representation may need to keep track of the additional information. For example it can be name of a file/source from which the Part originates or a way to multiplex multiple Part streams. This field is not supported in Vertex AI.", "title": "Partmetadata" }, "audioTranscription": { "anyOf": [ { "$ref": "#/$defs/Transcription" }, { "type": "null" } ], "default": null, "description": "Output only. The transcription of the audio part." } }, "title": "Part", "type": "object" }, "PartMediaResolution": { "additionalProperties": false, "description": "Media resolution for the input media.", "properties": { "level": { "anyOf": [ { "$ref": "#/$defs/PartMediaResolutionLevel" }, { "type": "null" } ], "default": null, "description": "The tokenization quality used for given media.\n " }, "numTokens": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Specifies the required sequence length for media tokenization.\n ", "title": "Numtokens" } }, "title": "PartMediaResolution", "type": "object" }, "PartMediaResolutionLevel": { "description": "The tokenization quality used for given media.", "enum": [ "MEDIA_RESOLUTION_UNSPECIFIED", "MEDIA_RESOLUTION_LOW", "MEDIA_RESOLUTION_MEDIUM", "MEDIA_RESOLUTION_HIGH", "MEDIA_RESOLUTION_ULTRA_HIGH" ], "title": "PartMediaResolutionLevel", "type": "string" }, "PartialArg": { "additionalProperties": false, "description": "Partial argument value of the function call.\n\nThis data type is not supported in Gemini API.", "properties": { "boolValue": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "description": "Optional. Represents a boolean value.", "title": "Boolvalue" }, "jsonPath": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Required. A JSON Path (RFC 9535) to the argument being streamed. https://datatracker.ietf.org/doc/html/rfc9535. e.g. \"$.foo.bar[0].data\".", "title": "Jsonpath" }, "nullValue": { "anyOf": [ { "const": "NULL_VALUE", "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. Represents a null value.", "title": "Nullvalue" }, "numberValue": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Optional. Represents a double value.", "title": "Numbervalue" }, "stringValue": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. Represents a string value.", "title": "Stringvalue" }, "willContinue": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "description": "Optional. Whether this is not the last part of the same json_path. If true, another PartialArg message for the current json_path is expected to follow.", "title": "Willcontinue" } }, "title": "PartialArg", "type": "object" }, "ToolCall": { "additionalProperties": false, "description": "A predicted server-side `ToolCall` returned from the model.\n\nThis message contains information about a tool that the model wants to invoke.\nThe client is NOT expected to execute this `ToolCall`. Instead, the\nclient should pass this `ToolCall` back to the API in a subsequent turn\nwithin a `Content` message, along with the corresponding `ToolResponse`.", "properties": { "id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Unique identifier of the tool call. The server returns the tool response with the matching `id`.", "title": "Id" }, "toolType": { "anyOf": [ { "$ref": "#/$defs/ToolType" }, { "type": "null" } ], "default": null, "description": "The type of tool that was called." }, "args": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "type": "null" } ], "default": null, "description": "The tool call arguments. Example: {\"arg1\": \"value1\", \"arg2\": \"value2\"}.", "title": "Args" } }, "title": "ToolCall", "type": "object" }, "ToolResponse": { "additionalProperties": false, "description": "The output from a server-side `ToolCall` execution.\n\nThis message contains the results of a tool invocation that was initiated by a\n`ToolCall` from the model. The client should pass this `ToolResponse` back to\nthe API in a subsequent turn within a `Content` message, along with the\ncorresponding `ToolCall`.", "properties": { "id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The identifier of the tool call this response is for.", "title": "Id" }, "toolType": { "anyOf": [ { "$ref": "#/$defs/ToolType" }, { "type": "null" } ], "default": null, "description": "The type of tool that was called, matching the tool_type in the corresponding ToolCall." }, "response": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "type": "null" } ], "default": null, "description": "The tool response.", "title": "Response" } }, "title": "ToolResponse", "type": "object" }, "ToolType": { "description": "The type of tool in the function call.", "enum": [ "TOOL_TYPE_UNSPECIFIED", "GOOGLE_SEARCH_WEB", "GOOGLE_SEARCH_IMAGE", "URL_CONTEXT", "GOOGLE_MAPS", "FILE_SEARCH" ], "title": "ToolType", "type": "string" }, "Transcription": { "additionalProperties": false, "description": "Audio transcription in Server Content.", "properties": { "text": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. Transcription text.", "title": "Text" }, "finished": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "description": "Optional. The bool indicates the end of the transcription.", "title": "Finished" }, "languageCode": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The BCP-47 language code of the transcription.", "title": "Languagecode" }, "speakerLabel": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "A label identifying the speaker of this audio segment (e.g. \"spk_1\", \"spk_2\").\n ", "title": "Speakerlabel" }, "words": { "anyOf": [ { "items": { "$ref": "#/$defs/WordInfo" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Detailed word-level transcriptions and timing details.\n ", "title": "Words" } }, "title": "Transcription", "type": "object" }, "VideoMetadata": { "additionalProperties": false, "description": "Provides metadata for a video, including the start and end offsets for clipping and the frame rate.", "properties": { "endOffset": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. The end offset of the video.", "title": "Endoffset" }, "fps": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Optional. The frame rate of the video sent to the model. If not specified, the default value is 1.0. The valid range is (0.0, 24.0].", "title": "Fps" }, "startOffset": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. The start offset of the video.", "title": "Startoffset" } }, "title": "VideoMetadata", "type": "object" }, "WordInfo": { "additionalProperties": false, "description": "Information about a single recognized word.", "properties": { "word": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Transcript of the word.\n ", "title": "Word" }, "startOffset": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Start offset in time of the word relative to the start of the audio.\n ", "title": "Startoffset" }, "endOffset": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "End offset in time of the word relative to the start of the audio.\n ", "title": "Endoffset" } }, "title": "WordInfo", "type": "object" } } }
- Fields:
activity_end (google.genai.types.ActivityEnd | None)activity_start (google.genai.types.ActivityStart | None)blob (google.genai.types.Blob | None)close (bool)content (google.genai.types.Content | None)partial (bool)state_delta (dict[str, Any] | None)
- field activity_end: Optional[types.ActivityEnd] = None¶
If set, signal the end of user activity to the model.
When multiple fields are set, they are processed by priority (highest first): activity_start > activity_end > blob > content. state_delta, if set, is always applied regardless of the other fields.
- field activity_start: Optional[types.ActivityStart] = None¶
If set, signal the start of user activity to the model.
When multiple fields are set, they are processed by priority (highest first): activity_start > activity_end > blob > content. state_delta, if set, is always applied regardless of the other fields.
- field blob: Optional[types.Blob] = None¶
If set, send the blob to the model in realtime mode.
When multiple fields are set, they are processed by priority (highest first): activity_start > activity_end > blob > content. state_delta, if set, is always applied regardless of the other fields.
- field close: bool = False¶
If set, close the queue. queue.shutdown() is only supported in Python 3.13+.
- field content: Optional[types.Content] = None¶
If set, send the content to the model in turn-by-turn mode.
When multiple fields are set, they are processed by priority (highest first): activity_start > activity_end > blob > content. state_delta, if set, is always applied regardless of the other fields.
- field partial: bool = False¶
If set, the content is a partial turn update that does not complete the current model turn.
- field state_delta: Optional[dict[str, Any]] = None¶
If set, these state changes are applied to the session, so they take effect even when the request carries no content or a partial/ function-response turn.
- class google.adk.agents.LiveRequestQueue¶
Bases:
objectQueue used to send LiveRequest in a live(bidirectional streaming) way.
- close()¶
- Return type:
None
- async get()¶
- Return type:
- send(req)¶
- Return type:
None
- send_activity_end()¶
Sends an activity end signal to mark the end of user input.
- Return type:
None
- send_activity_start()¶
Sends an activity start signal to mark the beginning of user input.
- Return type:
None
- send_content(content, partial=False)¶
- Return type:
None
- send_realtime(blob)¶
- Return type:
None
- pydantic model google.adk.agents.LlmAgent¶
Bases:
BaseAgent,ABCLLM-based Agent.
Show JSON schema
{ "title": "LlmAgent", "type": "object", "properties": { "name": { "title": "Name", "type": "string" }, "description": { "default": "", "title": "Description", "type": "string" }, "rerun_on_resume": { "default": false, "title": "Rerun On Resume", "type": "boolean" }, "wait_for_output": { "default": false, "title": "Wait For Output", "type": "boolean" }, "retry_config": { "anyOf": [ { "$ref": "#/$defs/RetryConfig" }, { "type": "null" } ], "default": null }, "timeout": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "title": "Timeout" }, "input_schema": { "anyOf": [ {}, { "type": "null" } ], "default": null, "title": "Input Schema" }, "output_schema": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "$ref": "#/$defs/Schema" }, { "type": "null" } ], "default": null, "title": "Output Schema" }, "state_schema": { "anyOf": [ {}, { "type": "null" } ], "default": null, "title": "State Schema" }, "parent_agent": { "anyOf": [ { "$ref": "#/$defs/BaseAgent" }, { "type": "null" } ], "default": null }, "sub_agents": { "items": { "$ref": "#/$defs/BaseAgent" }, "title": "Sub Agents", "type": "array" }, "before_agent_callback": { "default": null, "title": "Before Agent Callback", "type": "null" }, "after_agent_callback": { "default": null, "title": "After Agent Callback", "type": "null" }, "model": { "anyOf": [ { "type": "string" }, { "$ref": "#/$defs/BaseLlm" } ], "default": "", "title": "Model" }, "instruction": { "default": "", "title": "Instruction", "type": "string" }, "global_instruction": { "default": "", "title": "Global Instruction", "type": "string" }, "static_instruction": { "anyOf": [ { "$ref": "#/$defs/Content" }, { "type": "string" }, { "$ref": "#/$defs/File" }, { "$ref": "#/$defs/Part" }, { "items": { "anyOf": [ { "type": "string" }, { "$ref": "#/$defs/File" }, { "$ref": "#/$defs/Part" } ] }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Static Instruction" }, "tools": { "items": { "anyOf": [] }, "title": "Tools", "type": "array" }, "generate_content_config": { "default": null, "title": "Generate Content Config" }, "mode": { "anyOf": [ { "enum": [ "chat", "task", "single_turn" ], "type": "string" }, { "type": "null" } ], "default": null, "title": "Mode" }, "parallel_worker": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "title": "Parallel Worker" }, "disallow_transfer_to_parent": { "default": false, "title": "Disallow Transfer To Parent", "type": "boolean" }, "disallow_transfer_to_peers": { "default": false, "title": "Disallow Transfer To Peers", "type": "boolean" }, "include_contents": { "default": "default", "enum": [ "default", "none" ], "title": "Include Contents", "type": "string" }, "output_key": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Output Key" }, "planner": { "default": null, "title": "Planner" }, "code_executor": { "anyOf": [ { "$ref": "#/$defs/BaseCodeExecutor" }, { "type": "null" } ], "default": null }, "before_model_callback": { "default": null, "title": "Before Model Callback", "type": "null" }, "after_model_callback": { "default": null, "title": "After Model Callback", "type": "null" }, "on_model_error_callback": { "default": null, "title": "On Model Error Callback", "type": "null" }, "before_tool_callback": { "default": null, "title": "Before Tool Callback", "type": "null" }, "after_tool_callback": { "default": null, "title": "After Tool Callback", "type": "null" }, "on_tool_error_callback": { "default": null, "title": "On Tool Error Callback", "type": "null" } }, "$defs": { "BaseAgent": { "additionalProperties": false, "description": "Base class for all agents in Agent Development Kit.", "properties": { "name": { "title": "Name", "type": "string" }, "description": { "default": "", "title": "Description", "type": "string" }, "rerun_on_resume": { "default": false, "title": "Rerun On Resume", "type": "boolean" }, "wait_for_output": { "default": false, "title": "Wait For Output", "type": "boolean" }, "retry_config": { "anyOf": [ { "$ref": "#/$defs/RetryConfig" }, { "type": "null" } ], "default": null }, "timeout": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "title": "Timeout" }, "input_schema": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "$ref": "#/$defs/Schema" }, { "type": "null" } ], "default": null, "title": "Input Schema" }, "output_schema": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "$ref": "#/$defs/Schema" }, { "type": "null" } ], "default": null, "title": "Output Schema" }, "state_schema": { "anyOf": [ {}, { "type": "null" } ], "default": null, "title": "State Schema" }, "parent_agent": { "anyOf": [ { "$ref": "#/$defs/BaseAgent" }, { "type": "null" } ], "default": null }, "sub_agents": { "items": { "$ref": "#/$defs/BaseAgent" }, "title": "Sub Agents", "type": "array" }, "before_agent_callback": { "default": null, "title": "Before Agent Callback", "type": "null" }, "after_agent_callback": { "default": null, "title": "After Agent Callback", "type": "null" } }, "required": [ "name" ], "title": "BaseAgent", "type": "object" }, "BaseCodeExecutor": { "description": "Abstract base class for all code executors.\n\nThe code executor allows the agent to execute code blocks from model responses\nand incorporate the execution results into the final response.\n\nAttributes:\n optimize_data_file: If true, extract and process data files from the model\n request and attach them to the code executor. Supported data file\n MimeTypes are [text/csv]. Default to False.\n stateful: Whether the code executor is stateful. Default to False.\n error_retry_attempts: The number of attempts to retry on consecutive code\n execution errors. Default to 2.\n code_block_delimiters: The list of the enclosing delimiters to identify the\n code blocks.\n execution_result_delimiters: The delimiters to format the code execution\n result.\n timeout_seconds: The fallback timeout in seconds for the code execution.", "properties": { "optimize_data_file": { "default": false, "title": "Optimize Data File", "type": "boolean" }, "stateful": { "default": false, "title": "Stateful", "type": "boolean" }, "error_retry_attempts": { "default": 2, "title": "Error Retry Attempts", "type": "integer" }, "code_block_delimiters": { "default": [ [ "```tool_code\n", "\n```" ], [ "```python\n", "\n```" ] ], "items": { "maxItems": 2, "minItems": 2, "prefixItems": [ { "type": "string" }, { "type": "string" } ], "type": "array" }, "title": "Code Block Delimiters", "type": "array" }, "execution_result_delimiters": { "default": [ "```tool_output\n", "\n```" ], "maxItems": 2, "minItems": 2, "prefixItems": [ { "type": "string" }, { "type": "string" } ], "title": "Execution Result Delimiters", "type": "array" }, "timeout_seconds": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Timeout Seconds" } }, "title": "BaseCodeExecutor", "type": "object" }, "BaseLlm": { "description": "The BaseLLM class.", "properties": { "model": { "title": "Model", "type": "string" } }, "required": [ "model" ], "title": "BaseLlm", "type": "object" }, "Blob": { "additionalProperties": false, "description": "A content blob.\n\nA Blob contains data of a specific media type. It is used to represent images,\naudio, and video.", "properties": { "data": { "anyOf": [ { "format": "base64url", "type": "string" }, { "type": "null" } ], "default": null, "description": "Required. The raw bytes of the data.", "title": "Data" }, "displayName": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. The display name of the blob. Used to provide a label or filename to distinguish blobs. This field is only returned in `PromptMessage` for prompt management. It is used in the Gemini calls only when server-side tools (`code_execution`, `google_search`, and `url_context`) are enabled. This field is not supported in Gemini API.", "title": "Displayname" }, "mimeType": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Required. The IANA standard MIME type of the source data.", "title": "Mimetype" } }, "title": "Blob", "type": "object" }, "CodeExecutionResult": { "additionalProperties": false, "description": "Result of executing the ExecutableCode.\n\nGenerated only when the `CodeExecution` tool is used.", "properties": { "outcome": { "anyOf": [ { "$ref": "#/$defs/Outcome" }, { "type": "null" } ], "default": null, "description": "Required. Outcome of the code execution." }, "output": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. Contains stdout when code execution is successful, stderr or other description otherwise.", "title": "Output" }, "id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. The identifier of the `ExecutableCode` part this result is for. Only populated if the corresponding `ExecutableCode` has an id. This field is not supported in Vertex AI.", "title": "Id" } }, "title": "CodeExecutionResult", "type": "object" }, "Content": { "additionalProperties": false, "description": "Contains the multi-part content of a message.", "properties": { "parts": { "anyOf": [ { "items": { "$ref": "#/$defs/Part" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "List of parts that constitute a single message. Each part may have\n a different IANA MIME type.", "title": "Parts" }, "role": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. The producer of the content. Must be either 'user' or 'model'. If not set, the service will default to 'user'.", "title": "Role" } }, "title": "Content", "type": "object" }, "ExecutableCode": { "additionalProperties": false, "description": "Code generated by the model that is meant to be executed, and the result returned to the model.\n\nGenerated when using the `CodeExecution` tool, in which the code will be\nautomatically executed, and a corresponding CodeExecutionResult will also be\ngenerated.", "properties": { "code": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Required. The code to be executed.", "title": "Code" }, "language": { "anyOf": [ { "$ref": "#/$defs/Language" }, { "type": "null" } ], "default": null, "description": "Required. Programming language of the `code`." }, "id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. Unique identifier of the `ExecutableCode` part. The server returns the `CodeExecutionResult` with the matching `id`. This field is not supported in Vertex AI.", "title": "Id" } }, "title": "ExecutableCode", "type": "object" }, "File": { "additionalProperties": false, "description": "A file uploaded to the API.", "properties": { "name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The `File` resource name. The ID (name excluding the \"files/\" prefix) can contain up to 40 characters that are lowercase alphanumeric or dashes (-). The ID cannot start or end with a dash. If the name is empty on create, a unique name will be generated. Example: `files/123-456`", "title": "Name" }, "displayName": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. The human-readable display name for the `File`. The display name must be no more than 512 characters in length, including spaces. Example: 'Welcome Image'", "title": "Displayname" }, "mimeType": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Output only. MIME type of the file.", "title": "Mimetype" }, "sizeBytes": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Output only. Size of the file in bytes.", "title": "Sizebytes" }, "createTime": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "description": "Output only. The timestamp of when the `File` was created.", "title": "Createtime" }, "expirationTime": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "description": "Output only. The timestamp of when the `File` will be deleted. Only set if the `File` is scheduled to expire.", "title": "Expirationtime" }, "updateTime": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "description": "Output only. The timestamp of when the `File` was last updated.", "title": "Updatetime" }, "sha256Hash": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Output only. SHA-256 hash of the uploaded bytes. The hash value is encoded in base64 format.", "title": "Sha256Hash" }, "uri": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Output only. The URI of the `File`.", "title": "Uri" }, "downloadUri": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Output only. The URI of the `File`, only set for downloadable (generated) files.", "title": "Downloaduri" }, "state": { "anyOf": [ { "$ref": "#/$defs/FileState" }, { "type": "null" } ], "default": null, "description": "Output only. Processing state of the File." }, "source": { "anyOf": [ { "$ref": "#/$defs/FileSource" }, { "type": "null" } ], "default": null, "description": "Output only. The source of the `File`." }, "videoMetadata": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "type": "null" } ], "default": null, "description": "Output only. Metadata for a video.", "title": "Videometadata" }, "error": { "anyOf": [ { "$ref": "#/$defs/FileStatus" }, { "type": "null" } ], "default": null, "description": "Output only. Error status if File processing failed." } }, "title": "File", "type": "object" }, "FileData": { "additionalProperties": false, "description": "URI-based data.\n\nA FileData message contains a URI pointing to data of a specific media type.\nIt is used to represent images, audio, and video stored in Google Cloud\nStorage.", "properties": { "displayName": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. The display name of the file. Used to provide a label or filename to distinguish files. This field is only returned in `PromptMessage` for prompt management. It is used in the Gemini calls only when server side tools (`code_execution`, `google_search`, and `url_context`) are enabled. This field is not supported in Gemini API.", "title": "Displayname" }, "fileUri": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Required. The URI of the file in Google Cloud Storage.", "title": "Fileuri" }, "mimeType": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Required. The IANA standard MIME type of the source data.", "title": "Mimetype" } }, "title": "FileData", "type": "object" }, "FileSource": { "description": "Source of the File.", "enum": [ "SOURCE_UNSPECIFIED", "UPLOADED", "GENERATED", "REGISTERED" ], "title": "FileSource", "type": "string" }, "FileState": { "description": "State for the lifecycle of a File.", "enum": [ "STATE_UNSPECIFIED", "PROCESSING", "ACTIVE", "FAILED" ], "title": "FileState", "type": "string" }, "FileStatus": { "additionalProperties": false, "description": "Status of a File that uses a common error model.", "properties": { "details": { "anyOf": [ { "items": { "additionalProperties": true, "type": "object" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "A list of messages that carry the error details. There is a common set of message types for APIs to use.", "title": "Details" }, "message": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "A list of messages that carry the error details. There is a common set of message types for APIs to use.", "title": "Message" }, "code": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "The status code. 0 for OK, 1 for CANCELLED", "title": "Code" } }, "title": "FileStatus", "type": "object" }, "FunctionCall": { "additionalProperties": false, "description": "A predicted FunctionCall returned from the model that contains a string representing the FunctionDeclaration.name and a structured JSON object containing the parameters and their values.", "properties": { "id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. The unique id of the function call. If populated, the client to execute the `function_call` and return the response with the matching `id`.", "title": "Id" }, "args": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "type": "null" } ], "default": null, "description": "Optional. The function parameters and values in JSON object format. See FunctionDeclaration.parameters for parameter details.", "title": "Args" }, "name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. The name of the function to call. Matches FunctionDeclaration.name.", "title": "Name" }, "partialArgs": { "anyOf": [ { "items": { "$ref": "#/$defs/PartialArg" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Optional. The partial argument value of the function call. If provided, represents the arguments/fields that are streamed incrementally. This field is not supported in Gemini API.", "title": "Partialargs" }, "willContinue": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "description": "Optional. Whether this is the last part of the FunctionCall. If true, another partial message for the current FunctionCall is expected to follow. This field is not supported in Gemini API.", "title": "Willcontinue" } }, "title": "FunctionCall", "type": "object" }, "FunctionResponse": { "additionalProperties": false, "description": "The result output from a FunctionCall that contains a string representing the FunctionDeclaration.name and a structured JSON object containing any output from the function is used as context to the model.\n\nThis should contain the result of a `FunctionCall` made based on model\nprediction.", "properties": { "willContinue": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "description": "Optional. Signals that function call continues, and more responses will be returned, turning the function call into a generator. Is only applicable to NON_BLOCKING function calls, is ignored otherwise. If set to false, future responses will not be considered. It is allowed to return empty `response` with `will_continue=False` to signal that the function call is finished. This may still trigger the model generation. To avoid triggering the generation and finish the function call, additionally set `scheduling` to `SILENT`. This field is not supported in Vertex AI.", "title": "Willcontinue" }, "scheduling": { "anyOf": [ { "$ref": "#/$defs/FunctionResponseScheduling" }, { "type": "null" } ], "default": null, "description": "Optional. Specifies how the response should be scheduled in the conversation. Only applicable to NON_BLOCKING function calls, is ignored otherwise. Defaults to WHEN_IDLE." }, "parts": { "anyOf": [ { "items": { "$ref": "#/$defs/FunctionResponsePart" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Optional. Ordered `Parts` that constitute a function response. Parts may have different IANA MIME types.", "title": "Parts" }, "id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. The id of the function call this response is for. Populated by the client to match the corresponding function call `id`.", "title": "Id" }, "name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Required. The name of the function to call. Matches FunctionDeclaration.name and FunctionCall.name.", "title": "Name" }, "response": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "type": "null" } ], "default": null, "description": "Required. The function response in JSON object format. Use \"output\" key to specify function output and \"error\" key to specify error details (if any). If \"output\" and \"error\" keys are not specified, then whole \"response\" is treated as function output.", "title": "Response" } }, "title": "FunctionResponse", "type": "object" }, "FunctionResponseBlob": { "additionalProperties": false, "description": "Raw media bytes for function response.\n\nText should not be sent as raw bytes, use the 'text' field.", "properties": { "mimeType": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Required. The IANA standard MIME type of the source data.", "title": "Mimetype" }, "data": { "anyOf": [ { "format": "base64url", "type": "string" }, { "type": "null" } ], "default": null, "description": "Required. Raw bytes.", "title": "Data" }, "displayName": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. Display name of the blob. Used to provide a label or filename to distinguish blobs. This field is only returned in PromptMessage for prompt management. It is currently used in the Gemini GenerateContent calls only when server side tools (code_execution, google_search, and url_context) are enabled. This field is not supported in Gemini API.", "title": "Displayname" } }, "title": "FunctionResponseBlob", "type": "object" }, "FunctionResponseFileData": { "additionalProperties": false, "description": "URI based data for function response.\n\nThis data type is not supported in Gemini API.", "properties": { "fileUri": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Required. URI.", "title": "Fileuri" }, "mimeType": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Required. The IANA standard MIME type of the source data.", "title": "Mimetype" }, "displayName": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. Display name of the file data. Used to provide a label or filename to distinguish file datas. This field is only returned in PromptMessage for prompt management. It is currently used in the Gemini GenerateContent calls only when server side tools (code_execution, google_search, and url_context) are enabled.", "title": "Displayname" } }, "title": "FunctionResponseFileData", "type": "object" }, "FunctionResponsePart": { "additionalProperties": false, "description": "A datatype containing media that is part of a `FunctionResponse` message.\n\nA `FunctionResponsePart` consists of data which has an associated datatype. A\n`FunctionResponsePart` can only contain one of the accepted types in\n`FunctionResponsePart.data`. A `FunctionResponsePart` must have a fixed IANA\nMIME type identifying the type and subtype of the media if the `inline_data`\nfield is filled with raw bytes.", "properties": { "inlineData": { "anyOf": [ { "$ref": "#/$defs/FunctionResponseBlob" }, { "type": "null" } ], "default": null, "description": "Inline media bytes." }, "fileData": { "anyOf": [ { "$ref": "#/$defs/FunctionResponseFileData" }, { "type": "null" } ], "default": null, "description": "URI based data. This field is not supported in Gemini API." } }, "title": "FunctionResponsePart", "type": "object" }, "FunctionResponseScheduling": { "description": "Specifies how the response should be scheduled in the conversation.\n\nOnly applicable to NON_BLOCKING function calls, is ignored otherwise. Defaults\nto WHEN_IDLE.", "enum": [ "SCHEDULING_UNSPECIFIED", "SILENT", "WHEN_IDLE", "INTERRUPT" ], "title": "FunctionResponseScheduling", "type": "string" }, "Language": { "description": "Programming language of the `code`.", "enum": [ "LANGUAGE_UNSPECIFIED", "PYTHON" ], "title": "Language", "type": "string" }, "Outcome": { "description": "Outcome of the code execution.", "enum": [ "OUTCOME_UNSPECIFIED", "OUTCOME_OK", "OUTCOME_FAILED", "OUTCOME_DEADLINE_EXCEEDED" ], "title": "Outcome", "type": "string" }, "Part": { "additionalProperties": false, "description": "A datatype containing media content.\n\nExactly one field within a Part should be set, representing the specific type\nof content being conveyed. Using multiple fields within the same `Part`\ninstance is considered invalid.", "properties": { "mediaResolution": { "anyOf": [ { "$ref": "#/$defs/PartMediaResolution" }, { "type": "null" } ], "default": null, "description": "Media resolution for the input media.\n " }, "codeExecutionResult": { "anyOf": [ { "$ref": "#/$defs/CodeExecutionResult" }, { "type": "null" } ], "default": null, "description": "Optional. The result of executing the ExecutableCode." }, "executableCode": { "anyOf": [ { "$ref": "#/$defs/ExecutableCode" }, { "type": "null" } ], "default": null, "description": "Optional. Code generated by the model that is intended to be executed." }, "fileData": { "anyOf": [ { "$ref": "#/$defs/FileData" }, { "type": "null" } ], "default": null, "description": "Optional. The URI-based data of the part. This can be used to include files from Google Cloud Storage." }, "functionCall": { "anyOf": [ { "$ref": "#/$defs/FunctionCall" }, { "type": "null" } ], "default": null, "description": "Optional. A predicted function call returned from the model. This contains the name of the function to call and the arguments to pass to the function." }, "functionResponse": { "anyOf": [ { "$ref": "#/$defs/FunctionResponse" }, { "type": "null" } ], "default": null, "description": "Optional. The result of a function call. This is used to provide the model with the result of a function call that it predicted." }, "inlineData": { "anyOf": [ { "$ref": "#/$defs/Blob" }, { "type": "null" } ], "default": null, "description": "Optional. The inline data content of the part. This can be used to include images, audio, or video in a request." }, "text": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. The text content of the part. When sent from the VSCode Gemini Code Assist extension, references to @mentioned items will be converted to markdown boldface text. For example `@my-repo` will be converted to and sent as `**my-repo**` by the IDE agent.", "title": "Text" }, "thought": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "description": "Optional. Indicates whether the `part` represents the model's thought process or reasoning.", "title": "Thought" }, "thoughtSignature": { "anyOf": [ { "format": "base64url", "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. An opaque signature for the thought so it can be reused in subsequent requests.", "title": "Thoughtsignature" }, "videoMetadata": { "anyOf": [ { "$ref": "#/$defs/VideoMetadata" }, { "type": "null" } ], "default": null, "description": "Optional. Video metadata. The metadata should only be specified while the video data is presented in inline_data or file_data." }, "toolCall": { "anyOf": [ { "$ref": "#/$defs/ToolCall" }, { "type": "null" } ], "default": null, "description": "Server-side tool call. This field is populated when the model predicts a tool invocation that should be executed on the server. The client is expected to echo this message back to the API." }, "toolResponse": { "anyOf": [ { "$ref": "#/$defs/ToolResponse" }, { "type": "null" } ], "default": null, "description": "The output from a server-side ToolCall execution. This field is populated by the client with the results of executing the corresponding ToolCall." }, "partMetadata": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "type": "null" } ], "default": null, "description": "Custom metadata associated with the Part. Agents using genai.Part as content representation may need to keep track of the additional information. For example it can be name of a file/source from which the Part originates or a way to multiplex multiple Part streams. This field is not supported in Vertex AI.", "title": "Partmetadata" }, "audioTranscription": { "anyOf": [ { "$ref": "#/$defs/Transcription" }, { "type": "null" } ], "default": null, "description": "Output only. The transcription of the audio part." } }, "title": "Part", "type": "object" }, "PartMediaResolution": { "additionalProperties": false, "description": "Media resolution for the input media.", "properties": { "level": { "anyOf": [ { "$ref": "#/$defs/PartMediaResolutionLevel" }, { "type": "null" } ], "default": null, "description": "The tokenization quality used for given media.\n " }, "numTokens": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Specifies the required sequence length for media tokenization.\n ", "title": "Numtokens" } }, "title": "PartMediaResolution", "type": "object" }, "PartMediaResolutionLevel": { "description": "The tokenization quality used for given media.", "enum": [ "MEDIA_RESOLUTION_UNSPECIFIED", "MEDIA_RESOLUTION_LOW", "MEDIA_RESOLUTION_MEDIUM", "MEDIA_RESOLUTION_HIGH", "MEDIA_RESOLUTION_ULTRA_HIGH" ], "title": "PartMediaResolutionLevel", "type": "string" }, "PartialArg": { "additionalProperties": false, "description": "Partial argument value of the function call.\n\nThis data type is not supported in Gemini API.", "properties": { "boolValue": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "description": "Optional. Represents a boolean value.", "title": "Boolvalue" }, "jsonPath": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Required. A JSON Path (RFC 9535) to the argument being streamed. https://datatracker.ietf.org/doc/html/rfc9535. e.g. \"$.foo.bar[0].data\".", "title": "Jsonpath" }, "nullValue": { "anyOf": [ { "const": "NULL_VALUE", "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. Represents a null value.", "title": "Nullvalue" }, "numberValue": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Optional. Represents a double value.", "title": "Numbervalue" }, "stringValue": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. Represents a string value.", "title": "Stringvalue" }, "willContinue": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "description": "Optional. Whether this is not the last part of the same json_path. If true, another PartialArg message for the current json_path is expected to follow.", "title": "Willcontinue" } }, "title": "PartialArg", "type": "object" }, "RetryConfig": { "description": "Configuration for retrying a node.", "properties": { "max_attempts": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Maximum number of attempts, including the original request.\n If 0 or 1, it means no retries. If not specified, default to 5.", "title": "Max Attempts" }, "initial_delay": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Initial delay before the first retry, in fractions of a second. If not specified, default to 1.0 second.", "title": "Initial Delay" }, "max_delay": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Maximum delay between retries, in fractions of a second. If not specified, default to 60.0 seconds.", "title": "Max Delay" }, "backoff_factor": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Multiplier by which the delay increases after each attempt. If not specified, default to 2.0.", "title": "Backoff Factor" }, "jitter": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Randomness factor for the delay. If not specified, default to 1.0. Otherwise use 0.0 to remove randomness.", "title": "Jitter" }, "exceptions": { "anyOf": [ { "items": { "anyOf": [ { "type": "string" }, {} ] }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Exceptions to retry on. Accepts exception class names as\n strings (e.g. ``['ValueError']``) or exception classes directly (e.g.\n ``[ValueError]``). ``None`` means retry on all exceptions.", "title": "Exceptions" } }, "title": "RetryConfig", "type": "object" }, "Schema": { "additionalProperties": false, "description": "Schema is used to define the format of input/output data.\n\nRepresents a select subset of an [OpenAPI 3.0 schema\nobject](https://spec.openapis.org/oas/v3.0.3#schema-object). More fields may\nbe added in the future as needed.", "properties": { "additionalProperties": { "anyOf": [ {}, { "type": "null" } ], "default": null, "description": "Optional. Can either be a boolean or an object; controls the presence of additional properties.", "title": "Additionalproperties" }, "defs": { "anyOf": [ { "additionalProperties": { "$ref": "#/$defs/Schema" }, "type": "object" }, { "type": "null" } ], "default": null, "description": "Optional. A map of definitions for use by `ref` Only allowed at the root of the schema.", "title": "Defs" }, "ref": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. Allows indirect references between schema nodes. The value should be a valid reference to a child of the root `defs`. For example, the following schema defines a reference to a schema node named \"Pet\": type: object properties: pet: ref: #/defs/Pet defs: Pet: type: object properties: name: type: string The value of the \"pet\" property is a reference to the schema node named \"Pet\". See details in https://json-schema.org/understanding-json-schema/structuring", "title": "Ref" }, "anyOf": { "anyOf": [ { "items": { "$ref": "#/$defs/Schema" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Optional. The instance must be valid against any (one or more) of the subschemas listed in `any_of`.", "title": "Anyof" }, "default": { "anyOf": [ {}, { "type": "null" } ], "default": null, "description": "Optional. Default value to use if the field is not specified.", "title": "Default" }, "description": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. Describes the data. The model uses this field to understand the purpose of the schema and how to use it. It is a best practice to provide a clear and descriptive explanation for the schema and its properties here, rather than in the prompt.", "title": "Description" }, "enum": { "anyOf": [ { "items": { "type": "string" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Optional. Possible values of the field. This field can be used to restrict a value to a fixed set of values. To mark a field as an enum, set `format` to `enum` and provide the list of possible values in `enum`. For example: 1. To define directions: `{type:STRING, format:enum, enum:[\"EAST\", \"NORTH\", \"SOUTH\", \"WEST\"]}` 2. To define apartment numbers: `{type:INTEGER, format:enum, enum:[\"101\", \"201\", \"301\"]}`", "title": "Enum" }, "example": { "anyOf": [ {}, { "type": "null" } ], "default": null, "description": "Optional. Example of an instance of this schema.", "title": "Example" }, "format": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. The format of the data. For `NUMBER` type, format can be `float` or `double`. For `INTEGER` type, format can be `int32` or `int64`. For `STRING` type, format can be `email`, `byte`, `date`, `date-time`, `password`, and other formats to further refine the data type.", "title": "Format" }, "items": { "anyOf": [ { "$ref": "#/$defs/Schema" }, { "type": "null" } ], "default": null, "description": "Optional. If type is `ARRAY`, `items` specifies the schema of elements in the array." }, "maxItems": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Optional. If type is `ARRAY`, `max_items` specifies the maximum number of items in an array.", "title": "Maxitems" }, "maxLength": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Optional. If type is `STRING`, `max_length` specifies the maximum length of the string.", "title": "Maxlength" }, "maxProperties": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Optional. If type is `OBJECT`, `max_properties` specifies the maximum number of properties that can be provided.", "title": "Maxproperties" }, "maximum": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Optional. If type is `INTEGER` or `NUMBER`, `maximum` specifies the maximum allowed value.", "title": "Maximum" }, "minItems": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Optional. If type is `ARRAY`, `min_items` specifies the minimum number of items in an array.", "title": "Minitems" }, "minLength": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Optional. If type is `STRING`, `min_length` specifies the minimum length of the string.", "title": "Minlength" }, "minProperties": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Optional. If type is `OBJECT`, `min_properties` specifies the minimum number of properties that can be provided.", "title": "Minproperties" }, "minimum": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Optional. If type is `INTEGER` or `NUMBER`, `minimum` specifies the minimum allowed value.", "title": "Minimum" }, "nullable": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "description": "Optional. Indicates if the value of this field can be null.", "title": "Nullable" }, "pattern": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. If type is `STRING`, `pattern` specifies a regular expression that the string must match.", "title": "Pattern" }, "properties": { "anyOf": [ { "additionalProperties": { "$ref": "#/$defs/Schema" }, "type": "object" }, { "type": "null" } ], "default": null, "description": "Optional. If type is `OBJECT`, `properties` is a map of property names to schema definitions for each property of the object.", "title": "Properties" }, "propertyOrdering": { "anyOf": [ { "items": { "type": "string" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Optional. Order of properties displayed or used where order matters. This is not a standard field in OpenAPI specification, but can be used to control the order of properties.", "title": "Propertyordering" }, "required": { "anyOf": [ { "items": { "type": "string" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Optional. If type is `OBJECT`, `required` lists the names of properties that must be present.", "title": "Required" }, "title": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. Title for the schema.", "title": "Title" }, "type": { "anyOf": [ { "$ref": "#/$defs/Type" }, { "type": "null" } ], "default": null, "description": "Optional. Data type of the schema field." } }, "title": "Schema", "type": "object" }, "ToolCall": { "additionalProperties": false, "description": "A predicted server-side `ToolCall` returned from the model.\n\nThis message contains information about a tool that the model wants to invoke.\nThe client is NOT expected to execute this `ToolCall`. Instead, the\nclient should pass this `ToolCall` back to the API in a subsequent turn\nwithin a `Content` message, along with the corresponding `ToolResponse`.", "properties": { "id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Unique identifier of the tool call. The server returns the tool response with the matching `id`.", "title": "Id" }, "toolType": { "anyOf": [ { "$ref": "#/$defs/ToolType" }, { "type": "null" } ], "default": null, "description": "The type of tool that was called." }, "args": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "type": "null" } ], "default": null, "description": "The tool call arguments. Example: {\"arg1\": \"value1\", \"arg2\": \"value2\"}.", "title": "Args" } }, "title": "ToolCall", "type": "object" }, "ToolResponse": { "additionalProperties": false, "description": "The output from a server-side `ToolCall` execution.\n\nThis message contains the results of a tool invocation that was initiated by a\n`ToolCall` from the model. The client should pass this `ToolResponse` back to\nthe API in a subsequent turn within a `Content` message, along with the\ncorresponding `ToolCall`.", "properties": { "id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The identifier of the tool call this response is for.", "title": "Id" }, "toolType": { "anyOf": [ { "$ref": "#/$defs/ToolType" }, { "type": "null" } ], "default": null, "description": "The type of tool that was called, matching the tool_type in the corresponding ToolCall." }, "response": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "type": "null" } ], "default": null, "description": "The tool response.", "title": "Response" } }, "title": "ToolResponse", "type": "object" }, "ToolType": { "description": "The type of tool in the function call.", "enum": [ "TOOL_TYPE_UNSPECIFIED", "GOOGLE_SEARCH_WEB", "GOOGLE_SEARCH_IMAGE", "URL_CONTEXT", "GOOGLE_MAPS", "FILE_SEARCH" ], "title": "ToolType", "type": "string" }, "Transcription": { "additionalProperties": false, "description": "Audio transcription in Server Content.", "properties": { "text": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. Transcription text.", "title": "Text" }, "finished": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "description": "Optional. The bool indicates the end of the transcription.", "title": "Finished" }, "languageCode": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The BCP-47 language code of the transcription.", "title": "Languagecode" }, "speakerLabel": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "A label identifying the speaker of this audio segment (e.g. \"spk_1\", \"spk_2\").\n ", "title": "Speakerlabel" }, "words": { "anyOf": [ { "items": { "$ref": "#/$defs/WordInfo" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Detailed word-level transcriptions and timing details.\n ", "title": "Words" } }, "title": "Transcription", "type": "object" }, "Type": { "description": "Data type of the schema field.", "enum": [ "TYPE_UNSPECIFIED", "STRING", "NUMBER", "INTEGER", "BOOLEAN", "ARRAY", "OBJECT", "NULL" ], "title": "Type", "type": "string" }, "VideoMetadata": { "additionalProperties": false, "description": "Provides metadata for a video, including the start and end offsets for clipping and the frame rate.", "properties": { "endOffset": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. The end offset of the video.", "title": "Endoffset" }, "fps": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Optional. The frame rate of the video sent to the model. If not specified, the default value is 1.0. The valid range is (0.0, 24.0].", "title": "Fps" }, "startOffset": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. The start offset of the video.", "title": "Startoffset" } }, "title": "VideoMetadata", "type": "object" }, "WordInfo": { "additionalProperties": false, "description": "Information about a single recognized word.", "properties": { "word": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Transcript of the word.\n ", "title": "Word" }, "startOffset": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Start offset in time of the word relative to the start of the audio.\n ", "title": "Startoffset" }, "endOffset": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "End offset in time of the word relative to the start of the audio.\n ", "title": "Endoffset" } }, "title": "WordInfo", "type": "object" } }, "additionalProperties": false, "required": [ "name" ] }
- Fields:
after_model_callback (Optional[AfterModelCallback])after_tool_callback (Optional[AfterToolCallback])before_model_callback (Optional[BeforeModelCallback])before_tool_callback (Optional[BeforeToolCallback])code_executor (Optional[BaseCodeExecutor])disallow_transfer_to_parent (bool)disallow_transfer_to_peers (bool)generate_content_config (Optional[types.GenerateContentConfig])global_instruction (Union[str, InstructionProvider])include_contents (Literal['default', 'none'])input_schema (Optional[type[BaseModel]])instruction (Union[str, InstructionProvider])mode (Literal['chat', 'task', 'single_turn'] | None)model (Union[str, BaseLlm])on_model_error_callback (Optional[OnModelErrorCallback])on_tool_error_callback (Optional[OnToolErrorCallback])output_key (Optional[str])output_schema (Optional[SchemaType])parallel_worker (bool | None)planner (Optional[BasePlanner])static_instruction (Optional[types.ContentUnion])tools (list[ToolUnion])
- Validators:
__model_validator_after»all fields_pre_validate_tools»all fieldsvalidate_generate_content_config»generate_content_config
- field after_model_callback: Optional[AfterModelCallback] = None¶
Callback or list of callbacks to be called after calling the LLM.
When a list of callbacks is provided, the callbacks will be called in the order they are listed until a callback does not return None.
- Parameters:
callback_context – CallbackContext,
llm_response – LlmResponse, the actual model response.
- Returns:
The content to return to the user. When present, the actual model response will be ignored and the provided content will be returned to user.
- Validated by:
__model_validator_after_pre_validate_tools
- field after_tool_callback: Optional[AfterToolCallback] = None¶
Callback or list of callbacks to be called after calling the tool.
When a list of callbacks is provided, the callbacks will be called in the order they are listed until a callback does not return None.
- Parameters:
tool – The tool to be called.
args – The arguments to the tool.
tool_context – ToolContext,
tool_response – The response from the tool.
- Returns:
When present, the returned dict will be used as tool result.
- Validated by:
__model_validator_after_pre_validate_tools
- field before_model_callback: Optional[BeforeModelCallback] = None¶
Callback or list of callbacks to be called before calling the LLM.
When a list of callbacks is provided, the callbacks will be called in the order they are listed until a callback does not return None.
- Parameters:
callback_context – CallbackContext,
llm_request – LlmRequest, The raw model request. Callback can mutate the
request.
- Returns:
The content to return to the user. When present, the model call will be skipped and the provided content will be returned to user.
- Validated by:
__model_validator_after_pre_validate_tools
- field before_tool_callback: Optional[BeforeToolCallback] = None¶
Callback or list of callbacks to be called before calling the tool.
When a list of callbacks is provided, the callbacks will be called in the order they are listed until a callback does not return None.
- Parameters:
tool – The tool to be called.
args – The arguments to the tool.
tool_context – ToolContext,
- Returns:
The tool response. When present, the returned tool response will be used and the framework will skip calling the actual tool.
- Validated by:
__model_validator_after_pre_validate_tools
- field code_executor: Optional[BaseCodeExecutor] = None¶
Allow agent to execute code blocks from model responses using the provided CodeExecutor.
Check out available code executions in google.adk.code_executor package.
Note
To use model’s built-in code executor, use the BuiltInCodeExecutor.
- Validated by:
__model_validator_after_pre_validate_tools
- field disallow_transfer_to_parent: bool = False¶
Disallows LLM-controlled transferring to the parent agent.
NOTE: Setting this as True also prevents this agent from continuing to reply to the end-user, and will transfer control back to the parent agent in the next turn. This behavior prevents one-way transfer, in which end-user may be stuck with one agent that cannot transfer to other agents in the agent tree.
- Validated by:
__model_validator_after_pre_validate_tools
- field disallow_transfer_to_peers: bool = False¶
Disallows LLM-controlled transferring to the peer agents.
- Validated by:
__model_validator_after_pre_validate_tools
- field generate_content_config: Optional[types.GenerateContentConfig] = None¶
The additional content generation configurations.
NOTE: not all fields are usable, e.g. tools must be configured via tools, thinking_config can be configured here or via the planner. If both are set, the planner’s configuration takes precedence.
For example: use this config to adjust model temperature, configure safety settings, etc.
- Validated by:
__model_validator_after_pre_validate_toolsvalidate_generate_content_config
- field global_instruction: Union[str, InstructionProvider] = ''¶
Instructions for all the agents in the entire agent tree.
DEPRECATED: This field is deprecated and will be removed in a future version. Use GlobalInstructionPlugin instead, which provides the same functionality at the App level. See migration guide for details.
ONLY the global_instruction in root agent will take effect.
For example: use global_instruction to make all agents have a stable identity or personality.
- Validated by:
__model_validator_after_pre_validate_tools
- field include_contents: Literal['default', 'none'] = 'default'¶
Controls content inclusion in model requests.
- Options:
default: Model receives relevant conversation history none: Model receives no prior history, operates solely on current instruction and input
- Validated by:
__model_validator_after_pre_validate_tools
- field input_schema: Optional[type[BaseModel]] = None¶
The input schema when agent is used as a tool.
- Validated by:
__model_validator_after_pre_validate_tools
- field instruction: Union[str, InstructionProvider] = ''¶
Dynamic instructions for the LLM model, guiding the agent’s behavior.
These instructions can contain placeholders like {variable_name} that will be resolved at runtime using session state and context.
Behavior depends on static_instruction: - If static_instruction is None: instruction goes to system_instruction - If static_instruction is set: instruction goes to user content in the request
This allows for context caching optimization where static content (static_instruction) comes first in the prompt, followed by dynamic content (instruction).
- Validated by:
__model_validator_after_pre_validate_tools
- field mode: Literal['chat', 'task', 'single_turn'] | None = None¶
The delegation mode for this agent.
- Options:
chat: Standard chat agent reachable via transfer_to_agent. task: Task agent that chats with the user to accomplish a task. single_turn: Agents that complete a task without chatting with the user.
Default value is chat as a sub-agent, single_turn as a node in a workflow.
- Validated by:
__model_validator_after_pre_validate_tools
- field model: Union[str, BaseLlm] = ''¶
The model to use for the agent.
When not set, the agent will inherit the model from its ancestor. If no ancestor provides a model, the agent uses the default model configured via LlmAgent.set_default_model. The built-in default is gemini-3.5-flash.
- Validated by:
__model_validator_after_pre_validate_tools
- field on_model_error_callback: Optional[OnModelErrorCallback] = None¶
Callback or list of callbacks to be called when a model call encounters an error.
When a list of callbacks is provided, the callbacks will be called in the order they are listed until a callback does not return None.
- Parameters:
callback_context – CallbackContext,
llm_request – LlmRequest, The raw model request.
error – The error from the model call.
- Returns:
The content to return to the user. When present, the error will be ignored and the provided content will be returned to user.
- Validated by:
__model_validator_after_pre_validate_tools
- field on_tool_error_callback: Optional[OnToolErrorCallback] = None¶
Callback or list of callbacks to be called when a tool call encounters an error.
When a list of callbacks is provided, the callbacks will be called in the order they are listed until a callback does not return None.
- Parameters:
tool – The tool to be called.
args – The arguments to the tool.
tool_context – ToolContext,
error – The error from the tool call.
- Returns:
When present, the returned dict will be used as tool result.
- Validated by:
__model_validator_after_pre_validate_tools
- field output_key: Optional[str] = None¶
The key in session state to store the output of the agent.
Typically use cases: - Extracts agent reply for later use, such as in tools, callbacks, etc. - Connects agents to coordinate with each other.
- Validated by:
__model_validator_after_pre_validate_tools
- field output_schema: Optional[SchemaType] = None¶
The output schema when agent replies.
- Supports all schema types that the underlying Google GenAI API supports:
type[BaseModel]: e.g., MySchema
list[type[BaseModel]]: e.g., list[MySchema]
list[primitive]: e.g., list[str], list[int]
dict: Raw dict schemas
Schema: Google’s Schema type
Note
The ADK supports using output_schema and tools together. It works by exposing tools during the thought loop and enforcing structure only on the final output.
- Validated by:
__model_validator_after_pre_validate_tools
- field parallel_worker: bool | None = None¶
Whether to run the agent in parallel worker mode.
- Validated by:
__model_validator_after_pre_validate_tools
- field planner: Optional[BasePlanner] = None¶
Instructs the agent to make a plan and execute it step by step.
Note
To use model’s built-in thinking features, set the thinking_config field in google.adk.planners.built_in_planner.
- Validated by:
__model_validator_after_pre_validate_tools
- field static_instruction: Optional[types.ContentUnion] = None¶
Static instruction content sent literally as system instruction at the beginning.
This field is for content that never changes and doesn’t contain placeholders. It’s sent directly to the model without any processing or variable substitution.
This field is primarily for context caching optimization. Static instructions are sent as system instruction at the beginning of the request, allowing for improved performance when the static portion remains unchanged. Live API has its own cache mechanism, thus this field doesn’t work with Live API.
Impact on instruction field: - When static_instruction is None: instruction → system_instruction - When static_instruction is set: instruction → user content (after static content)
Context Caching: - Implicit Cache: Automatic caching by model providers (no config needed) - Explicit Cache: Cache explicitly created by user for instructions, tools and contents
See below for more information of Implicit Cache and Explicit Cache Gemini API: https://ai.google.dev/gemini-api/docs/caching?lang=python Vertex API: https://cloud.google.com/vertex-ai/generative-ai/docs/context-cache/context-cache-overview
Setting static_instruction alone does NOT enable caching automatically. For explicit caching control, configure context_cache_config at App level.
Content Support: Accepts types.ContentUnion which includes: - str: Simple text instruction - types.Content: Rich content object - types.Part: Single part (text, inline_data, file_data, etc.) - PIL.Image.Image: Image object - types.File: File reference - list[PartUnion]: List of parts
Examples: ```python # Simple string instruction static_instruction = “You are a helpful assistant.”
# Rich content with files static_instruction = types.Content(
role=’user’, parts=[
types.Part(text=’You are a helpful assistant.’), types.Part(file_data=types.FileData(…))
]
)¶
- Validated by:
__model_validator_after_pre_validate_tools
- field tools: list[ToolUnion] [Optional]¶
Tools available to this agent.
- Validated by:
__model_validator_after_pre_validate_tools
- config_type¶
alias of
LlmAgentConfig
- classmethod set_default_live_model(model)¶
Overrides the default model used for live mode when an agent has no model set.
- Return type:
None
- classmethod set_default_model(model)¶
Overrides the default model used when an agent has no model set.
- Return type:
None
- validator validate_generate_content_config » generate_content_config¶
- Return type:
GenerateContentConfig
- async canonical_global_instruction(ctx)¶
The resolved self.instruction field to construct global instruction.
This method is only for use by Agent Development Kit.
- Return type:
tuple[str,bool]- Parameters:
ctx – The context to retrieve the session state.
- Returns:
A tuple of (instruction, bypass_state_injection). instruction: The resolved self.global_instruction field. bypass_state_injection: Whether the instruction is based on InstructionProvider.
- async canonical_instruction(ctx)¶
The resolved self.instruction field to construct instruction for this agent.
This method is only for use by Agent Development Kit.
- Return type:
tuple[str,bool]- Parameters:
ctx – The context to retrieve the session state.
- Returns:
A tuple of (instruction, bypass_state_injection). instruction: The resolved self.instruction field. bypass_state_injection: Whether the instruction is based on InstructionProvider.
- async canonical_tools(ctx=None)¶
The resolved self.tools field as a list of BaseTool based on the context.
This method is only for use by Agent Development Kit.
- Return type:
list[BaseTool]
- model_post_init(_LlmAgent__context)¶
Provides a warning if multiple thinking configurations are found.
- Return type:
None
- DEFAULT_LIVE_MODEL: ClassVar[str] = 'gemini-live-2.5-flash-native-audio'¶
System default model used for live mode when no model is set on an agent.
- DEFAULT_MODEL: ClassVar[str] = 'gemini-3.5-flash'¶
System default model used when no model is set on an agent.
- property canonical_after_model_callbacks: list[Callable[[Context, LlmResponse], Awaitable[LlmResponse | None] | LlmResponse | None]]¶
The resolved self.after_model_callback field as a list of _SingleAfterModelCallback.
This method is only for use by Agent Development Kit.
- property canonical_after_tool_callbacks: list[Callable[[BaseTool, dict[str, Any], Context, dict], Awaitable[dict | None] | dict | None] | list[Callable[[BaseTool, dict[str, Any], Context, dict], Awaitable[dict | None] | dict | None]]]¶
The resolved self.after_tool_callback field as a list of AfterToolCallback.
This method is only for use by Agent Development Kit.
- property canonical_before_model_callbacks: list[Callable[[Context, LlmRequest], Awaitable[LlmResponse | None] | LlmResponse | None]]¶
The resolved self.before_model_callback field as a list of _SingleBeforeModelCallback.
This method is only for use by Agent Development Kit.
- property canonical_before_tool_callbacks: list[Callable[[BaseTool, dict[str, Any], Context], Awaitable[dict | None] | dict | None] | list[Callable[[BaseTool, dict[str, Any], Context], Awaitable[dict | None] | dict | None]]]¶
The resolved self.before_tool_callback field as a list of BeforeToolCallback.
This method is only for use by Agent Development Kit.
- property canonical_live_model: BaseLlm¶
The resolved self.model field as BaseLlm for live mode.
This method is only for use by Agent Development Kit.
- property canonical_model: BaseLlm¶
The resolved self.model field as BaseLlm.
This method is only for use by Agent Development Kit.
- property canonical_on_model_error_callbacks: list[Callable[[Context, LlmRequest, Exception], Awaitable[LlmResponse | None] | LlmResponse | None]]¶
The resolved self.on_model_error_callback field as a list of _SingleOnModelErrorCallback.
This method is only for use by Agent Development Kit.
- property canonical_on_tool_error_callbacks: list[Callable[[BaseTool, dict[str, Any], Context, Exception], Awaitable[dict | None] | dict | None] | list[Callable[[BaseTool, dict[str, Any], Context, Exception], Awaitable[dict | None] | dict | None]]]¶
The resolved self.on_tool_error_callback field as a list of OnToolErrorCallback.
This method is only for use by Agent Development Kit.
- pydantic model google.adk.agents.LlmAgentConfig¶
Bases:
BaseAgentConfigThe config for the YAML schema of a LlmAgent.
Show JSON schema
{ "title": "LlmAgentConfig", "type": "object", "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.", "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" }, "sub_agents": { "anyOf": [ { "items": { "$ref": "#/$defs/AgentRefConfig" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Optional. The sub-agents of the agent.", "title": "Sub Agents" }, "before_agent_callbacks": { "anyOf": [ { "items": { "$ref": "#/$defs/CodeConfig" }, "type": "array" }, { "type": "null" } ], "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": { "anyOf": [ { "items": { "$ref": "#/$defs/CodeConfig" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Optional. The after_agent_callbacks of the agent.", "title": "After Agent Callbacks" }, "model": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. LlmAgent.model. Provide a model name string (e.g. \"gemini-3.5-flash\"). If not set, the model will be inherited from the ancestor or fall back to the system default (gemini-3.5-flash unless overridden via LlmAgent.set_default_model). To construct a model instance from code, use model_code.", "title": "Model" }, "model_code": { "anyOf": [ { "$ref": "#/$defs/CodeConfig" }, { "type": "null" } ], "default": null, "description": "Optional. A CodeConfig that instantiates a BaseLlm implementation such as LiteLlm with custom arguments (API base, fallbacks, etc.). Cannot be set together with `model`." }, "instruction": { "description": "Required. LlmAgent.instruction. Dynamic instructions with placeholder support. Behavior: if static_instruction is None, goes to system_instruction; if static_instruction is set, goes to user content after static content.", "title": "Instruction", "type": "string" }, "static_instruction": { "anyOf": [ { "$ref": "#/$defs/Content" }, { "type": "string" }, { "$ref": "#/$defs/File" }, { "$ref": "#/$defs/Part" }, { "items": { "anyOf": [ { "type": "string" }, { "$ref": "#/$defs/File" }, { "$ref": "#/$defs/Part" } ] }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Optional. LlmAgent.static_instruction. Static content sent literally at position 0 without placeholder processing. When set, changes instruction behavior to go to user content instead of system_instruction. Supports context caching. Accepts types.ContentUnion (str, types.Content, types.Part, PIL.Image.Image, types.File, or list[PartUnion]).", "title": "Static Instruction" }, "disallow_transfer_to_parent": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "description": "Optional. LlmAgent.disallow_transfer_to_parent.", "title": "Disallow Transfer To Parent" }, "disallow_transfer_to_peers": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "description": "Optional. LlmAgent.disallow_transfer_to_peers.", "title": "Disallow Transfer To Peers" }, "input_schema": { "anyOf": [ { "$ref": "#/$defs/CodeConfig" }, { "type": "null" } ], "default": null, "description": "Optional. LlmAgent.input_schema." }, "output_schema": { "anyOf": [ { "$ref": "#/$defs/CodeConfig" }, { "type": "null" } ], "default": null, "description": "Optional. LlmAgent.output_schema." }, "output_key": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. LlmAgent.output_key.", "title": "Output Key" }, "include_contents": { "default": "default", "description": "Optional. LlmAgent.include_contents.", "enum": [ "default", "none" ], "title": "Include Contents", "type": "string" }, "tools": { "anyOf": [ { "items": { "$ref": "#/$defs/ToolConfig" }, "type": "array" }, { "type": "null" } ], "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": { "anyOf": [ { "items": { "$ref": "#/$defs/CodeConfig" }, "type": "array" }, { "type": "null" } ], "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": { "anyOf": [ { "items": { "$ref": "#/$defs/CodeConfig" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Optional. LlmAgent.after_model_callbacks.", "title": "After Model Callbacks" }, "before_tool_callbacks": { "anyOf": [ { "items": { "$ref": "#/$defs/CodeConfig" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Optional. LlmAgent.before_tool_callbacks.", "title": "Before Tool Callbacks" }, "after_tool_callbacks": { "anyOf": [ { "items": { "$ref": "#/$defs/CodeConfig" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Optional. LlmAgent.after_tool_callbacks.", "title": "After Tool Callbacks" }, "generate_content_config": { "default": null, "title": "Generate Content Config" } }, "$defs": { "AgentRefConfig": { "additionalProperties": false, "description": "The config for the reference to another agent.", "properties": { "config_path": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Config Path" }, "code": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Code" } }, "title": "AgentRefConfig", "type": "object" }, "Blob": { "additionalProperties": false, "description": "A content blob.\n\nA Blob contains data of a specific media type. It is used to represent images,\naudio, and video.", "properties": { "data": { "anyOf": [ { "format": "base64url", "type": "string" }, { "type": "null" } ], "default": null, "description": "Required. The raw bytes of the data.", "title": "Data" }, "displayName": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. The display name of the blob. Used to provide a label or filename to distinguish blobs. This field is only returned in `PromptMessage` for prompt management. It is used in the Gemini calls only when server-side tools (`code_execution`, `google_search`, and `url_context`) are enabled. This field is not supported in Gemini API.", "title": "Displayname" }, "mimeType": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Required. The IANA standard MIME type of the source data.", "title": "Mimetype" } }, "title": "Blob", "type": "object" }, "CodeConfig": { "additionalProperties": false, "description": "Code reference config for a variable, a function, or a class.\n\nOnly references an object by name. YAML cannot pass constructor args; to\nuse a configured object, build it in Python and reference its FQN here.", "properties": { "name": { "title": "Name", "type": "string" } }, "required": [ "name" ], "title": "CodeConfig", "type": "object" }, "CodeExecutionResult": { "additionalProperties": false, "description": "Result of executing the ExecutableCode.\n\nGenerated only when the `CodeExecution` tool is used.", "properties": { "outcome": { "anyOf": [ { "$ref": "#/$defs/Outcome" }, { "type": "null" } ], "default": null, "description": "Required. Outcome of the code execution." }, "output": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. Contains stdout when code execution is successful, stderr or other description otherwise.", "title": "Output" }, "id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. The identifier of the `ExecutableCode` part this result is for. Only populated if the corresponding `ExecutableCode` has an id. This field is not supported in Vertex AI.", "title": "Id" } }, "title": "CodeExecutionResult", "type": "object" }, "Content": { "additionalProperties": false, "description": "Contains the multi-part content of a message.", "properties": { "parts": { "anyOf": [ { "items": { "$ref": "#/$defs/Part" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "List of parts that constitute a single message. Each part may have\n a different IANA MIME type.", "title": "Parts" }, "role": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. The producer of the content. Must be either 'user' or 'model'. If not set, the service will default to 'user'.", "title": "Role" } }, "title": "Content", "type": "object" }, "ExecutableCode": { "additionalProperties": false, "description": "Code generated by the model that is meant to be executed, and the result returned to the model.\n\nGenerated when using the `CodeExecution` tool, in which the code will be\nautomatically executed, and a corresponding CodeExecutionResult will also be\ngenerated.", "properties": { "code": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Required. The code to be executed.", "title": "Code" }, "language": { "anyOf": [ { "$ref": "#/$defs/Language" }, { "type": "null" } ], "default": null, "description": "Required. Programming language of the `code`." }, "id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. Unique identifier of the `ExecutableCode` part. The server returns the `CodeExecutionResult` with the matching `id`. This field is not supported in Vertex AI.", "title": "Id" } }, "title": "ExecutableCode", "type": "object" }, "File": { "additionalProperties": false, "description": "A file uploaded to the API.", "properties": { "name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The `File` resource name. The ID (name excluding the \"files/\" prefix) can contain up to 40 characters that are lowercase alphanumeric or dashes (-). The ID cannot start or end with a dash. If the name is empty on create, a unique name will be generated. Example: `files/123-456`", "title": "Name" }, "displayName": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. The human-readable display name for the `File`. The display name must be no more than 512 characters in length, including spaces. Example: 'Welcome Image'", "title": "Displayname" }, "mimeType": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Output only. MIME type of the file.", "title": "Mimetype" }, "sizeBytes": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Output only. Size of the file in bytes.", "title": "Sizebytes" }, "createTime": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "description": "Output only. The timestamp of when the `File` was created.", "title": "Createtime" }, "expirationTime": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "description": "Output only. The timestamp of when the `File` will be deleted. Only set if the `File` is scheduled to expire.", "title": "Expirationtime" }, "updateTime": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "description": "Output only. The timestamp of when the `File` was last updated.", "title": "Updatetime" }, "sha256Hash": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Output only. SHA-256 hash of the uploaded bytes. The hash value is encoded in base64 format.", "title": "Sha256Hash" }, "uri": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Output only. The URI of the `File`.", "title": "Uri" }, "downloadUri": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Output only. The URI of the `File`, only set for downloadable (generated) files.", "title": "Downloaduri" }, "state": { "anyOf": [ { "$ref": "#/$defs/FileState" }, { "type": "null" } ], "default": null, "description": "Output only. Processing state of the File." }, "source": { "anyOf": [ { "$ref": "#/$defs/FileSource" }, { "type": "null" } ], "default": null, "description": "Output only. The source of the `File`." }, "videoMetadata": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "type": "null" } ], "default": null, "description": "Output only. Metadata for a video.", "title": "Videometadata" }, "error": { "anyOf": [ { "$ref": "#/$defs/FileStatus" }, { "type": "null" } ], "default": null, "description": "Output only. Error status if File processing failed." } }, "title": "File", "type": "object" }, "FileData": { "additionalProperties": false, "description": "URI-based data.\n\nA FileData message contains a URI pointing to data of a specific media type.\nIt is used to represent images, audio, and video stored in Google Cloud\nStorage.", "properties": { "displayName": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. The display name of the file. Used to provide a label or filename to distinguish files. This field is only returned in `PromptMessage` for prompt management. It is used in the Gemini calls only when server side tools (`code_execution`, `google_search`, and `url_context`) are enabled. This field is not supported in Gemini API.", "title": "Displayname" }, "fileUri": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Required. The URI of the file in Google Cloud Storage.", "title": "Fileuri" }, "mimeType": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Required. The IANA standard MIME type of the source data.", "title": "Mimetype" } }, "title": "FileData", "type": "object" }, "FileSource": { "description": "Source of the File.", "enum": [ "SOURCE_UNSPECIFIED", "UPLOADED", "GENERATED", "REGISTERED" ], "title": "FileSource", "type": "string" }, "FileState": { "description": "State for the lifecycle of a File.", "enum": [ "STATE_UNSPECIFIED", "PROCESSING", "ACTIVE", "FAILED" ], "title": "FileState", "type": "string" }, "FileStatus": { "additionalProperties": false, "description": "Status of a File that uses a common error model.", "properties": { "details": { "anyOf": [ { "items": { "additionalProperties": true, "type": "object" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "A list of messages that carry the error details. There is a common set of message types for APIs to use.", "title": "Details" }, "message": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "A list of messages that carry the error details. There is a common set of message types for APIs to use.", "title": "Message" }, "code": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "The status code. 0 for OK, 1 for CANCELLED", "title": "Code" } }, "title": "FileStatus", "type": "object" }, "FunctionCall": { "additionalProperties": false, "description": "A predicted FunctionCall returned from the model that contains a string representing the FunctionDeclaration.name and a structured JSON object containing the parameters and their values.", "properties": { "id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. The unique id of the function call. If populated, the client to execute the `function_call` and return the response with the matching `id`.", "title": "Id" }, "args": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "type": "null" } ], "default": null, "description": "Optional. The function parameters and values in JSON object format. See FunctionDeclaration.parameters for parameter details.", "title": "Args" }, "name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. The name of the function to call. Matches FunctionDeclaration.name.", "title": "Name" }, "partialArgs": { "anyOf": [ { "items": { "$ref": "#/$defs/PartialArg" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Optional. The partial argument value of the function call. If provided, represents the arguments/fields that are streamed incrementally. This field is not supported in Gemini API.", "title": "Partialargs" }, "willContinue": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "description": "Optional. Whether this is the last part of the FunctionCall. If true, another partial message for the current FunctionCall is expected to follow. This field is not supported in Gemini API.", "title": "Willcontinue" } }, "title": "FunctionCall", "type": "object" }, "FunctionResponse": { "additionalProperties": false, "description": "The result output from a FunctionCall that contains a string representing the FunctionDeclaration.name and a structured JSON object containing any output from the function is used as context to the model.\n\nThis should contain the result of a `FunctionCall` made based on model\nprediction.", "properties": { "willContinue": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "description": "Optional. Signals that function call continues, and more responses will be returned, turning the function call into a generator. Is only applicable to NON_BLOCKING function calls, is ignored otherwise. If set to false, future responses will not be considered. It is allowed to return empty `response` with `will_continue=False` to signal that the function call is finished. This may still trigger the model generation. To avoid triggering the generation and finish the function call, additionally set `scheduling` to `SILENT`. This field is not supported in Vertex AI.", "title": "Willcontinue" }, "scheduling": { "anyOf": [ { "$ref": "#/$defs/FunctionResponseScheduling" }, { "type": "null" } ], "default": null, "description": "Optional. Specifies how the response should be scheduled in the conversation. Only applicable to NON_BLOCKING function calls, is ignored otherwise. Defaults to WHEN_IDLE." }, "parts": { "anyOf": [ { "items": { "$ref": "#/$defs/FunctionResponsePart" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Optional. Ordered `Parts` that constitute a function response. Parts may have different IANA MIME types.", "title": "Parts" }, "id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. The id of the function call this response is for. Populated by the client to match the corresponding function call `id`.", "title": "Id" }, "name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Required. The name of the function to call. Matches FunctionDeclaration.name and FunctionCall.name.", "title": "Name" }, "response": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "type": "null" } ], "default": null, "description": "Required. The function response in JSON object format. Use \"output\" key to specify function output and \"error\" key to specify error details (if any). If \"output\" and \"error\" keys are not specified, then whole \"response\" is treated as function output.", "title": "Response" } }, "title": "FunctionResponse", "type": "object" }, "FunctionResponseBlob": { "additionalProperties": false, "description": "Raw media bytes for function response.\n\nText should not be sent as raw bytes, use the 'text' field.", "properties": { "mimeType": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Required. The IANA standard MIME type of the source data.", "title": "Mimetype" }, "data": { "anyOf": [ { "format": "base64url", "type": "string" }, { "type": "null" } ], "default": null, "description": "Required. Raw bytes.", "title": "Data" }, "displayName": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. Display name of the blob. Used to provide a label or filename to distinguish blobs. This field is only returned in PromptMessage for prompt management. It is currently used in the Gemini GenerateContent calls only when server side tools (code_execution, google_search, and url_context) are enabled. This field is not supported in Gemini API.", "title": "Displayname" } }, "title": "FunctionResponseBlob", "type": "object" }, "FunctionResponseFileData": { "additionalProperties": false, "description": "URI based data for function response.\n\nThis data type is not supported in Gemini API.", "properties": { "fileUri": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Required. URI.", "title": "Fileuri" }, "mimeType": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Required. The IANA standard MIME type of the source data.", "title": "Mimetype" }, "displayName": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. Display name of the file data. Used to provide a label or filename to distinguish file datas. This field is only returned in PromptMessage for prompt management. It is currently used in the Gemini GenerateContent calls only when server side tools (code_execution, google_search, and url_context) are enabled.", "title": "Displayname" } }, "title": "FunctionResponseFileData", "type": "object" }, "FunctionResponsePart": { "additionalProperties": false, "description": "A datatype containing media that is part of a `FunctionResponse` message.\n\nA `FunctionResponsePart` consists of data which has an associated datatype. A\n`FunctionResponsePart` can only contain one of the accepted types in\n`FunctionResponsePart.data`. A `FunctionResponsePart` must have a fixed IANA\nMIME type identifying the type and subtype of the media if the `inline_data`\nfield is filled with raw bytes.", "properties": { "inlineData": { "anyOf": [ { "$ref": "#/$defs/FunctionResponseBlob" }, { "type": "null" } ], "default": null, "description": "Inline media bytes." }, "fileData": { "anyOf": [ { "$ref": "#/$defs/FunctionResponseFileData" }, { "type": "null" } ], "default": null, "description": "URI based data. This field is not supported in Gemini API." } }, "title": "FunctionResponsePart", "type": "object" }, "FunctionResponseScheduling": { "description": "Specifies how the response should be scheduled in the conversation.\n\nOnly applicable to NON_BLOCKING function calls, is ignored otherwise. Defaults\nto WHEN_IDLE.", "enum": [ "SCHEDULING_UNSPECIFIED", "SILENT", "WHEN_IDLE", "INTERRUPT" ], "title": "FunctionResponseScheduling", "type": "string" }, "Language": { "description": "Programming language of the `code`.", "enum": [ "LANGUAGE_UNSPECIFIED", "PYTHON" ], "title": "Language", "type": "string" }, "Outcome": { "description": "Outcome of the code execution.", "enum": [ "OUTCOME_UNSPECIFIED", "OUTCOME_OK", "OUTCOME_FAILED", "OUTCOME_DEADLINE_EXCEEDED" ], "title": "Outcome", "type": "string" }, "Part": { "additionalProperties": false, "description": "A datatype containing media content.\n\nExactly one field within a Part should be set, representing the specific type\nof content being conveyed. Using multiple fields within the same `Part`\ninstance is considered invalid.", "properties": { "mediaResolution": { "anyOf": [ { "$ref": "#/$defs/PartMediaResolution" }, { "type": "null" } ], "default": null, "description": "Media resolution for the input media.\n " }, "codeExecutionResult": { "anyOf": [ { "$ref": "#/$defs/CodeExecutionResult" }, { "type": "null" } ], "default": null, "description": "Optional. The result of executing the ExecutableCode." }, "executableCode": { "anyOf": [ { "$ref": "#/$defs/ExecutableCode" }, { "type": "null" } ], "default": null, "description": "Optional. Code generated by the model that is intended to be executed." }, "fileData": { "anyOf": [ { "$ref": "#/$defs/FileData" }, { "type": "null" } ], "default": null, "description": "Optional. The URI-based data of the part. This can be used to include files from Google Cloud Storage." }, "functionCall": { "anyOf": [ { "$ref": "#/$defs/FunctionCall" }, { "type": "null" } ], "default": null, "description": "Optional. A predicted function call returned from the model. This contains the name of the function to call and the arguments to pass to the function." }, "functionResponse": { "anyOf": [ { "$ref": "#/$defs/FunctionResponse" }, { "type": "null" } ], "default": null, "description": "Optional. The result of a function call. This is used to provide the model with the result of a function call that it predicted." }, "inlineData": { "anyOf": [ { "$ref": "#/$defs/Blob" }, { "type": "null" } ], "default": null, "description": "Optional. The inline data content of the part. This can be used to include images, audio, or video in a request." }, "text": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. The text content of the part. When sent from the VSCode Gemini Code Assist extension, references to @mentioned items will be converted to markdown boldface text. For example `@my-repo` will be converted to and sent as `**my-repo**` by the IDE agent.", "title": "Text" }, "thought": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "description": "Optional. Indicates whether the `part` represents the model's thought process or reasoning.", "title": "Thought" }, "thoughtSignature": { "anyOf": [ { "format": "base64url", "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. An opaque signature for the thought so it can be reused in subsequent requests.", "title": "Thoughtsignature" }, "videoMetadata": { "anyOf": [ { "$ref": "#/$defs/VideoMetadata" }, { "type": "null" } ], "default": null, "description": "Optional. Video metadata. The metadata should only be specified while the video data is presented in inline_data or file_data." }, "toolCall": { "anyOf": [ { "$ref": "#/$defs/ToolCall" }, { "type": "null" } ], "default": null, "description": "Server-side tool call. This field is populated when the model predicts a tool invocation that should be executed on the server. The client is expected to echo this message back to the API." }, "toolResponse": { "anyOf": [ { "$ref": "#/$defs/ToolResponse" }, { "type": "null" } ], "default": null, "description": "The output from a server-side ToolCall execution. This field is populated by the client with the results of executing the corresponding ToolCall." }, "partMetadata": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "type": "null" } ], "default": null, "description": "Custom metadata associated with the Part. Agents using genai.Part as content representation may need to keep track of the additional information. For example it can be name of a file/source from which the Part originates or a way to multiplex multiple Part streams. This field is not supported in Vertex AI.", "title": "Partmetadata" }, "audioTranscription": { "anyOf": [ { "$ref": "#/$defs/Transcription" }, { "type": "null" } ], "default": null, "description": "Output only. The transcription of the audio part." } }, "title": "Part", "type": "object" }, "PartMediaResolution": { "additionalProperties": false, "description": "Media resolution for the input media.", "properties": { "level": { "anyOf": [ { "$ref": "#/$defs/PartMediaResolutionLevel" }, { "type": "null" } ], "default": null, "description": "The tokenization quality used for given media.\n " }, "numTokens": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Specifies the required sequence length for media tokenization.\n ", "title": "Numtokens" } }, "title": "PartMediaResolution", "type": "object" }, "PartMediaResolutionLevel": { "description": "The tokenization quality used for given media.", "enum": [ "MEDIA_RESOLUTION_UNSPECIFIED", "MEDIA_RESOLUTION_LOW", "MEDIA_RESOLUTION_MEDIUM", "MEDIA_RESOLUTION_HIGH", "MEDIA_RESOLUTION_ULTRA_HIGH" ], "title": "PartMediaResolutionLevel", "type": "string" }, "PartialArg": { "additionalProperties": false, "description": "Partial argument value of the function call.\n\nThis data type is not supported in Gemini API.", "properties": { "boolValue": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "description": "Optional. Represents a boolean value.", "title": "Boolvalue" }, "jsonPath": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Required. A JSON Path (RFC 9535) to the argument being streamed. https://datatracker.ietf.org/doc/html/rfc9535. e.g. \"$.foo.bar[0].data\".", "title": "Jsonpath" }, "nullValue": { "anyOf": [ { "const": "NULL_VALUE", "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. Represents a null value.", "title": "Nullvalue" }, "numberValue": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Optional. Represents a double value.", "title": "Numbervalue" }, "stringValue": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. Represents a string value.", "title": "Stringvalue" }, "willContinue": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "description": "Optional. Whether this is not the last part of the same json_path. If true, another PartialArg message for the current json_path is expected to follow.", "title": "Willcontinue" } }, "title": "PartialArg", "type": "object" }, "ToolArgsConfig": { "additionalProperties": true, "description": "Config to host free key-value pairs for the args in ToolConfig.", "properties": {}, "title": "ToolArgsConfig", "type": "object" }, "ToolCall": { "additionalProperties": false, "description": "A predicted server-side `ToolCall` returned from the model.\n\nThis message contains information about a tool that the model wants to invoke.\nThe client is NOT expected to execute this `ToolCall`. Instead, the\nclient should pass this `ToolCall` back to the API in a subsequent turn\nwithin a `Content` message, along with the corresponding `ToolResponse`.", "properties": { "id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Unique identifier of the tool call. The server returns the tool response with the matching `id`.", "title": "Id" }, "toolType": { "anyOf": [ { "$ref": "#/$defs/ToolType" }, { "type": "null" } ], "default": null, "description": "The type of tool that was called." }, "args": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "type": "null" } ], "default": null, "description": "The tool call arguments. Example: {\"arg1\": \"value1\", \"arg2\": \"value2\"}.", "title": "Args" } }, "title": "ToolCall", "type": "object" }, "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 `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" }, "args": { "anyOf": [ { "$ref": "#/$defs/ToolArgsConfig" }, { "type": "null" } ], "default": null, "description": "The args for the tool." } }, "required": [ "name" ], "title": "ToolConfig", "type": "object" }, "ToolResponse": { "additionalProperties": false, "description": "The output from a server-side `ToolCall` execution.\n\nThis message contains the results of a tool invocation that was initiated by a\n`ToolCall` from the model. The client should pass this `ToolResponse` back to\nthe API in a subsequent turn within a `Content` message, along with the\ncorresponding `ToolCall`.", "properties": { "id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The identifier of the tool call this response is for.", "title": "Id" }, "toolType": { "anyOf": [ { "$ref": "#/$defs/ToolType" }, { "type": "null" } ], "default": null, "description": "The type of tool that was called, matching the tool_type in the corresponding ToolCall." }, "response": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "type": "null" } ], "default": null, "description": "The tool response.", "title": "Response" } }, "title": "ToolResponse", "type": "object" }, "ToolType": { "description": "The type of tool in the function call.", "enum": [ "TOOL_TYPE_UNSPECIFIED", "GOOGLE_SEARCH_WEB", "GOOGLE_SEARCH_IMAGE", "URL_CONTEXT", "GOOGLE_MAPS", "FILE_SEARCH" ], "title": "ToolType", "type": "string" }, "Transcription": { "additionalProperties": false, "description": "Audio transcription in Server Content.", "properties": { "text": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. Transcription text.", "title": "Text" }, "finished": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "description": "Optional. The bool indicates the end of the transcription.", "title": "Finished" }, "languageCode": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The BCP-47 language code of the transcription.", "title": "Languagecode" }, "speakerLabel": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "A label identifying the speaker of this audio segment (e.g. \"spk_1\", \"spk_2\").\n ", "title": "Speakerlabel" }, "words": { "anyOf": [ { "items": { "$ref": "#/$defs/WordInfo" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Detailed word-level transcriptions and timing details.\n ", "title": "Words" } }, "title": "Transcription", "type": "object" }, "VideoMetadata": { "additionalProperties": false, "description": "Provides metadata for a video, including the start and end offsets for clipping and the frame rate.", "properties": { "endOffset": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. The end offset of the video.", "title": "Endoffset" }, "fps": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Optional. The frame rate of the video sent to the model. If not specified, the default value is 1.0. The valid range is (0.0, 24.0].", "title": "Fps" }, "startOffset": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. The start offset of the video.", "title": "Startoffset" } }, "title": "VideoMetadata", "type": "object" }, "WordInfo": { "additionalProperties": false, "description": "Information about a single recognized word.", "properties": { "word": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Transcript of the word.\n ", "title": "Word" }, "startOffset": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Start offset in time of the word relative to the start of the audio.\n ", "title": "Startoffset" }, "endOffset": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "End offset in time of the word relative to the start of the audio.\n ", "title": "Endoffset" } }, "title": "WordInfo", "type": "object" } }, "additionalProperties": false, "deprecated": true, "required": [ "name", "instruction" ] }
- Fields:
after_model_callbacks (Optional[List[CodeConfig]])after_tool_callbacks (Optional[List[CodeConfig]])agent_class (str)before_model_callbacks (Optional[List[CodeConfig]])before_tool_callbacks (Optional[List[CodeConfig]])disallow_transfer_to_parent (Optional[bool])disallow_transfer_to_peers (Optional[bool])generate_content_config (Optional[types.GenerateContentConfig])include_contents (Literal['default', 'none'])input_schema (Optional[CodeConfig])instruction (str)model (Optional[str])model_code (Optional[CodeConfig])output_key (Optional[str])output_schema (Optional[CodeConfig])static_instruction (Optional[types.ContentUnion])tools (Optional[list[ToolConfig]])
- Validators:
_validate_model_sources»all fields
- field after_model_callbacks: Optional[List[CodeConfig]] = None¶
Optional. LlmAgent.after_model_callbacks.
- Validated by:
_validate_model_sources
- field after_tool_callbacks: Optional[List[CodeConfig]] = None¶
Optional. LlmAgent.after_tool_callbacks.
- Validated by:
_validate_model_sources
- field agent_class: str = 'LlmAgent'¶
The value is used to uniquely identify the LlmAgent class. If it is empty, it is by default an LlmAgent.
- Validated by:
_validate_model_sources
- field before_model_callbacks: Optional[List[CodeConfig]] = None¶
Optional. LlmAgent.before_model_callbacks.
Example:
- Validated by:
_validate_model_sources
- field before_tool_callbacks: Optional[List[CodeConfig]] = None¶
Optional. LlmAgent.before_tool_callbacks.
- Validated by:
_validate_model_sources
- field disallow_transfer_to_parent: Optional[bool] = None¶
Optional. LlmAgent.disallow_transfer_to_parent.
- Validated by:
_validate_model_sources
- field disallow_transfer_to_peers: Optional[bool] = None¶
Optional. LlmAgent.disallow_transfer_to_peers.
- Validated by:
_validate_model_sources
- field generate_content_config: Optional[types.GenerateContentConfig] = None¶
Optional. LlmAgent.generate_content_config.
- Validated by:
_validate_model_sources
- field include_contents: Literal['default', 'none'] = 'default'¶
Optional. LlmAgent.include_contents.
- Validated by:
_validate_model_sources
- field input_schema: Optional[CodeConfig] = None¶
Optional. LlmAgent.input_schema.
- Validated by:
_validate_model_sources
- field instruction: str [Required]¶
Required. LlmAgent.instruction. Dynamic instructions with placeholder support. Behavior: if static_instruction is None, goes to system_instruction; if static_instruction is set, goes to user content after static content.
- Validated by:
_validate_model_sources
- field model: Optional[str] = None¶
Optional. LlmAgent.model. Provide a model name string (e.g. “gemini-3.5-flash”). If not set, the model will be inherited from the ancestor or fall back to the system default (gemini-3.5-flash unless overridden via LlmAgent.set_default_model). To construct a model instance from code, use model_code.
- Validated by:
_validate_model_sources
- field model_code: Optional[CodeConfig] = None¶
Optional. A CodeConfig that instantiates a BaseLlm implementation such as LiteLlm with custom arguments (API base, fallbacks, etc.). Cannot be set together with model.
- Validated by:
_validate_model_sources
- field output_key: Optional[str] = None¶
Optional. LlmAgent.output_key.
- Validated by:
_validate_model_sources
- field output_schema: Optional[CodeConfig] = None¶
Optional. LlmAgent.output_schema.
- Validated by:
_validate_model_sources
- field static_instruction: Optional[types.ContentUnion] = None¶
Optional. LlmAgent.static_instruction. Static content sent literally at position 0 without placeholder processing. When set, changes instruction behavior to go to user content instead of system_instruction. Supports context caching. Accepts types.ContentUnion (str, types.Content, types.Part, PIL.Image.Image, types.File, or list[PartUnion]).
- Validated by:
_validate_model_sources
- field tools: Optional[list[ToolConfig]] = None¶
Optional. LlmAgent.tools.
Examples:
For ADK built-in tools in google.adk.tools package, they can be referenced directly with the name:
For user-defined tools, they can be referenced with fully qualified name:
For tools that needs to be created via functions:
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:
``` tools:
name: tools.my_mcp_toolset
- Validated by:
_validate_model_sources
- pydantic model google.adk.agents.LoopAgent¶
Bases:
BaseAgentA shell agent that run its sub-agents in a loop.
When sub-agent generates an event with escalate or max_iterations are reached, the loop agent will stop.
Deprecated since version LoopAgent: is deprecated in favor of Workflow and will be removed in a future version. Workflow cannot yet be used as an LlmAgent sub-agent.
Show JSON schema
{ "title": "LoopAgent", "description": "A shell agent that run its sub-agents in a loop.\n\nWhen sub-agent generates an event with escalate or max_iterations are\nreached, the loop agent will stop.\n\n.. deprecated::\n LoopAgent is deprecated in favor of Workflow and will be removed in a\n future version. Workflow cannot yet be used as an LlmAgent sub-agent.", "type": "object", "properties": { "name": { "title": "Name", "type": "string" }, "description": { "default": "", "title": "Description", "type": "string" }, "rerun_on_resume": { "default": false, "title": "Rerun On Resume", "type": "boolean" }, "wait_for_output": { "default": false, "title": "Wait For Output", "type": "boolean" }, "retry_config": { "anyOf": [ { "$ref": "#/$defs/RetryConfig" }, { "type": "null" } ], "default": null }, "timeout": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "title": "Timeout" }, "input_schema": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "$ref": "#/$defs/Schema" }, { "type": "null" } ], "default": null, "title": "Input Schema" }, "output_schema": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "$ref": "#/$defs/Schema" }, { "type": "null" } ], "default": null, "title": "Output Schema" }, "state_schema": { "anyOf": [ {}, { "type": "null" } ], "default": null, "title": "State Schema" }, "parent_agent": { "anyOf": [ { "$ref": "#/$defs/BaseAgent" }, { "type": "null" } ], "default": null }, "sub_agents": { "items": { "$ref": "#/$defs/BaseAgent" }, "title": "Sub Agents", "type": "array" }, "before_agent_callback": { "default": null, "title": "Before Agent Callback", "type": "null" }, "after_agent_callback": { "default": null, "title": "After Agent Callback", "type": "null" }, "max_iterations": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Max Iterations" } }, "$defs": { "BaseAgent": { "additionalProperties": false, "description": "Base class for all agents in Agent Development Kit.", "properties": { "name": { "title": "Name", "type": "string" }, "description": { "default": "", "title": "Description", "type": "string" }, "rerun_on_resume": { "default": false, "title": "Rerun On Resume", "type": "boolean" }, "wait_for_output": { "default": false, "title": "Wait For Output", "type": "boolean" }, "retry_config": { "anyOf": [ { "$ref": "#/$defs/RetryConfig" }, { "type": "null" } ], "default": null }, "timeout": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "title": "Timeout" }, "input_schema": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "$ref": "#/$defs/Schema" }, { "type": "null" } ], "default": null, "title": "Input Schema" }, "output_schema": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "$ref": "#/$defs/Schema" }, { "type": "null" } ], "default": null, "title": "Output Schema" }, "state_schema": { "anyOf": [ {}, { "type": "null" } ], "default": null, "title": "State Schema" }, "parent_agent": { "anyOf": [ { "$ref": "#/$defs/BaseAgent" }, { "type": "null" } ], "default": null }, "sub_agents": { "items": { "$ref": "#/$defs/BaseAgent" }, "title": "Sub Agents", "type": "array" }, "before_agent_callback": { "default": null, "title": "Before Agent Callback", "type": "null" }, "after_agent_callback": { "default": null, "title": "After Agent Callback", "type": "null" } }, "required": [ "name" ], "title": "BaseAgent", "type": "object" }, "RetryConfig": { "description": "Configuration for retrying a node.", "properties": { "max_attempts": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Maximum number of attempts, including the original request.\n If 0 or 1, it means no retries. If not specified, default to 5.", "title": "Max Attempts" }, "initial_delay": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Initial delay before the first retry, in fractions of a second. If not specified, default to 1.0 second.", "title": "Initial Delay" }, "max_delay": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Maximum delay between retries, in fractions of a second. If not specified, default to 60.0 seconds.", "title": "Max Delay" }, "backoff_factor": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Multiplier by which the delay increases after each attempt. If not specified, default to 2.0.", "title": "Backoff Factor" }, "jitter": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Randomness factor for the delay. If not specified, default to 1.0. Otherwise use 0.0 to remove randomness.", "title": "Jitter" }, "exceptions": { "anyOf": [ { "items": { "anyOf": [ { "type": "string" }, {} ] }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Exceptions to retry on. Accepts exception class names as\n strings (e.g. ``['ValueError']``) or exception classes directly (e.g.\n ``[ValueError]``). ``None`` means retry on all exceptions.", "title": "Exceptions" } }, "title": "RetryConfig", "type": "object" }, "Schema": { "additionalProperties": false, "description": "Schema is used to define the format of input/output data.\n\nRepresents a select subset of an [OpenAPI 3.0 schema\nobject](https://spec.openapis.org/oas/v3.0.3#schema-object). More fields may\nbe added in the future as needed.", "properties": { "additionalProperties": { "anyOf": [ {}, { "type": "null" } ], "default": null, "description": "Optional. Can either be a boolean or an object; controls the presence of additional properties.", "title": "Additionalproperties" }, "defs": { "anyOf": [ { "additionalProperties": { "$ref": "#/$defs/Schema" }, "type": "object" }, { "type": "null" } ], "default": null, "description": "Optional. A map of definitions for use by `ref` Only allowed at the root of the schema.", "title": "Defs" }, "ref": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. Allows indirect references between schema nodes. The value should be a valid reference to a child of the root `defs`. For example, the following schema defines a reference to a schema node named \"Pet\": type: object properties: pet: ref: #/defs/Pet defs: Pet: type: object properties: name: type: string The value of the \"pet\" property is a reference to the schema node named \"Pet\". See details in https://json-schema.org/understanding-json-schema/structuring", "title": "Ref" }, "anyOf": { "anyOf": [ { "items": { "$ref": "#/$defs/Schema" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Optional. The instance must be valid against any (one or more) of the subschemas listed in `any_of`.", "title": "Anyof" }, "default": { "anyOf": [ {}, { "type": "null" } ], "default": null, "description": "Optional. Default value to use if the field is not specified.", "title": "Default" }, "description": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. Describes the data. The model uses this field to understand the purpose of the schema and how to use it. It is a best practice to provide a clear and descriptive explanation for the schema and its properties here, rather than in the prompt.", "title": "Description" }, "enum": { "anyOf": [ { "items": { "type": "string" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Optional. Possible values of the field. This field can be used to restrict a value to a fixed set of values. To mark a field as an enum, set `format` to `enum` and provide the list of possible values in `enum`. For example: 1. To define directions: `{type:STRING, format:enum, enum:[\"EAST\", \"NORTH\", \"SOUTH\", \"WEST\"]}` 2. To define apartment numbers: `{type:INTEGER, format:enum, enum:[\"101\", \"201\", \"301\"]}`", "title": "Enum" }, "example": { "anyOf": [ {}, { "type": "null" } ], "default": null, "description": "Optional. Example of an instance of this schema.", "title": "Example" }, "format": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. The format of the data. For `NUMBER` type, format can be `float` or `double`. For `INTEGER` type, format can be `int32` or `int64`. For `STRING` type, format can be `email`, `byte`, `date`, `date-time`, `password`, and other formats to further refine the data type.", "title": "Format" }, "items": { "anyOf": [ { "$ref": "#/$defs/Schema" }, { "type": "null" } ], "default": null, "description": "Optional. If type is `ARRAY`, `items` specifies the schema of elements in the array." }, "maxItems": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Optional. If type is `ARRAY`, `max_items` specifies the maximum number of items in an array.", "title": "Maxitems" }, "maxLength": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Optional. If type is `STRING`, `max_length` specifies the maximum length of the string.", "title": "Maxlength" }, "maxProperties": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Optional. If type is `OBJECT`, `max_properties` specifies the maximum number of properties that can be provided.", "title": "Maxproperties" }, "maximum": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Optional. If type is `INTEGER` or `NUMBER`, `maximum` specifies the maximum allowed value.", "title": "Maximum" }, "minItems": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Optional. If type is `ARRAY`, `min_items` specifies the minimum number of items in an array.", "title": "Minitems" }, "minLength": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Optional. If type is `STRING`, `min_length` specifies the minimum length of the string.", "title": "Minlength" }, "minProperties": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Optional. If type is `OBJECT`, `min_properties` specifies the minimum number of properties that can be provided.", "title": "Minproperties" }, "minimum": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Optional. If type is `INTEGER` or `NUMBER`, `minimum` specifies the minimum allowed value.", "title": "Minimum" }, "nullable": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "description": "Optional. Indicates if the value of this field can be null.", "title": "Nullable" }, "pattern": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. If type is `STRING`, `pattern` specifies a regular expression that the string must match.", "title": "Pattern" }, "properties": { "anyOf": [ { "additionalProperties": { "$ref": "#/$defs/Schema" }, "type": "object" }, { "type": "null" } ], "default": null, "description": "Optional. If type is `OBJECT`, `properties` is a map of property names to schema definitions for each property of the object.", "title": "Properties" }, "propertyOrdering": { "anyOf": [ { "items": { "type": "string" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Optional. Order of properties displayed or used where order matters. This is not a standard field in OpenAPI specification, but can be used to control the order of properties.", "title": "Propertyordering" }, "required": { "anyOf": [ { "items": { "type": "string" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Optional. If type is `OBJECT`, `required` lists the names of properties that must be present.", "title": "Required" }, "title": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. Title for the schema.", "title": "Title" }, "type": { "anyOf": [ { "$ref": "#/$defs/Type" }, { "type": "null" } ], "default": null, "description": "Optional. Data type of the schema field." } }, "title": "Schema", "type": "object" }, "Type": { "description": "Data type of the schema field.", "enum": [ "TYPE_UNSPECIFIED", "STRING", "NUMBER", "INTEGER", "BOOLEAN", "ARRAY", "OBJECT", "NULL" ], "title": "Type", "type": "string" } }, "additionalProperties": false, "deprecated": true, "required": [ "name" ] }
- Fields:
max_iterations (Optional[int])
- Validators:
- field max_iterations: Optional[int] = None¶
The maximum number of iterations to run the loop agent.
If not set, the loop agent will run indefinitely until a sub-agent escalates.
- config_type¶
alias of
LoopAgentConfig
- pydantic model google.adk.agents.LoopAgentConfig¶
Bases:
BaseAgentConfigThe config for the YAML schema of a LoopAgent.
Show JSON schema
{ "title": "LoopAgentConfig", "description": "The config for the YAML schema of a LoopAgent.", "type": "object", "properties": { "agent_class": { "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" }, "sub_agents": { "anyOf": [ { "items": { "$ref": "#/$defs/AgentRefConfig" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Optional. The sub-agents of the agent.", "title": "Sub Agents" }, "before_agent_callbacks": { "anyOf": [ { "items": { "$ref": "#/$defs/CodeConfig" }, "type": "array" }, { "type": "null" } ], "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": { "anyOf": [ { "items": { "$ref": "#/$defs/CodeConfig" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Optional. The after_agent_callbacks of the agent.", "title": "After Agent Callbacks" }, "max_iterations": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Optional. LoopAgent.max_iterations.", "title": "Max Iterations" } }, "$defs": { "AgentRefConfig": { "additionalProperties": false, "description": "The config for the reference to another agent.", "properties": { "config_path": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Config Path" }, "code": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Code" } }, "title": "AgentRefConfig", "type": "object" }, "CodeConfig": { "additionalProperties": false, "description": "Code reference config for a variable, a function, or a class.\n\nOnly references an object by name. YAML cannot pass constructor args; to\nuse a configured object, build it in Python and reference its FQN here.", "properties": { "name": { "title": "Name", "type": "string" } }, "required": [ "name" ], "title": "CodeConfig", "type": "object" } }, "additionalProperties": false, "deprecated": true, "required": [ "name" ] }
- Fields:
agent_class (str)max_iterations (Optional[int])
- field agent_class: str = 'LoopAgent'¶
The value is used to uniquely identify the LoopAgent class.
- field max_iterations: Optional[int] = None¶
Optional. LoopAgent.max_iterations.
- pydantic model google.adk.agents.ManagedAgent¶
Bases:
BaseAgentAn agent backed by the Managed Agents API (interactions.create).
This agent calls the Managed Agents API directly from its execution loop. Only server-side tools are supported: ADK built-in tools, raw
google.genai.types.Toolconfigs (the kinds the interactions converter understands), and server-side remote MCP servers declared asRemoteMcpServerspecs (forwarded to the backend as anMCPServerParam). Client-executed tools (FunctionTool/callables) and rawtypes.Tool.mcp_serversconfigs are not supported and are rejected.ManagedAgent supports streaming interactions only. Interactions are always created with
background=True(required by the Managed Agents workflow) and consumed over the streaming connection; non-streaming / background-polling execution is not yet supported.Show JSON schema
{ "title": "ManagedAgent", "description": "An agent backed by the Managed Agents API (interactions.create).\n\nThis agent calls the Managed Agents API directly from its execution loop.\nOnly server-side tools are supported: ADK built-in tools, raw\n``google.genai.types.Tool`` configs (the kinds the interactions converter\nunderstands), and server-side remote MCP servers declared as\n``RemoteMcpServer`` specs (forwarded to the backend as an ``MCPServerParam``).\nClient-executed tools (FunctionTool/callables) and raw\n``types.Tool.mcp_servers`` configs are not supported and are rejected.\n\nManagedAgent supports streaming interactions only. Interactions are always\ncreated with ``background=True`` (required by the Managed Agents workflow) and\nconsumed over the streaming connection; non-streaming / background-polling\nexecution is not yet supported.", "type": "object", "properties": { "name": { "title": "Name", "type": "string" }, "description": { "default": "", "title": "Description", "type": "string" }, "rerun_on_resume": { "default": false, "title": "Rerun On Resume", "type": "boolean" }, "wait_for_output": { "default": false, "title": "Wait For Output", "type": "boolean" }, "retry_config": { "anyOf": [ { "$ref": "#/$defs/RetryConfig" }, { "type": "null" } ], "default": null }, "timeout": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "title": "Timeout" }, "input_schema": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "$ref": "#/$defs/Schema" }, { "type": "null" } ], "default": null, "title": "Input Schema" }, "output_schema": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "$ref": "#/$defs/Schema" }, { "type": "null" } ], "default": null, "title": "Output Schema" }, "state_schema": { "anyOf": [ {}, { "type": "null" } ], "default": null, "title": "State Schema" }, "parent_agent": { "anyOf": [ { "$ref": "#/$defs/BaseAgent" }, { "type": "null" } ], "default": null }, "sub_agents": { "items": { "$ref": "#/$defs/BaseAgent" }, "title": "Sub Agents", "type": "array" }, "before_agent_callback": { "default": null, "title": "Before Agent Callback", "type": "null" }, "after_agent_callback": { "default": null, "title": "After Agent Callback", "type": "null" }, "agent_id": { "title": "Agent Id", "type": "string" }, "environment": { "anyOf": [ { "$ref": "#/$defs/CreateAgentInteractionEnvironmentParam" }, { "type": "null" } ], "default": null }, "agent_config": { "anyOf": [ { "$ref": "#/$defs/CreateAgentInteractionAgentConfigParam" }, { "type": "null" } ], "default": null }, "instruction": { "default": "", "title": "Instruction", "type": "string" }, "tools": { "items": { "$ref": "#/$defs/Tool" }, "title": "Tools", "type": "array" }, "mode": { "anyOf": [ { "const": "single_turn", "type": "string" }, { "type": "null" } ], "default": null, "title": "Mode" } }, "$defs": { "AllowlistEntryParam": { "additionalProperties": false, "description": "A single domain allowlist rule with optional header injection.", "properties": { "domain": { "title": "Domain", "type": "string" }, "transform": { "$ref": "#/$defs/TransformParam" } }, "required": [ "domain" ], "title": "AllowlistEntryParam", "type": "object" }, "AllowlistParam": { "additionalProperties": false, "description": "Outbound networking configuration for the sandbox. When specified, restricts which external domains the sandbox can reach. Omit entirely to allow all outbound traffic with no header injection.", "properties": { "allowlist": { "items": { "$ref": "#/$defs/AllowlistEntryParam" }, "title": "Allowlist", "type": "array" } }, "title": "AllowlistParam", "type": "object" }, "AntigravityAgentConfigParam": { "additionalProperties": false, "description": "Configuration for the Antigravity agent runtime.\nProvides server-side control over the agent's execution environment\nand tool configuration.", "properties": { "max_total_tokens": { "title": "Max Total Tokens", "type": "integer" }, "model": { "title": "Model", "type": "string" }, "type": { "const": "antigravity", "title": "Type", "type": "string" } }, "required": [ "type" ], "title": "AntigravityAgentConfigParam", "type": "object" }, "ApiAuth": { "additionalProperties": false, "description": "The generic reusable api auth config.\n\nDeprecated. Please use AuthConfig (google/cloud/aiplatform/master/auth.proto)\ninstead. This data type is not supported in Gemini API.", "properties": { "apiKeyConfig": { "anyOf": [ { "$ref": "#/$defs/ApiAuthApiKeyConfig" }, { "type": "null" } ], "default": null, "description": "The API secret." } }, "title": "ApiAuth", "type": "object" }, "ApiAuthApiKeyConfig": { "additionalProperties": false, "description": "The API secret. This data type is not supported in Gemini API.", "properties": { "apiKeySecretVersion": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Required. The SecretManager secret version resource name storing API key. e.g. projects/{project}/secrets/{secret}/versions/{version}", "title": "Apikeysecretversion" }, "apiKeyString": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The API key string. Either this or `api_key_secret_version` must be set.", "title": "Apikeystring" } }, "title": "ApiAuthApiKeyConfig", "type": "object" }, "ApiKeyConfig": { "additionalProperties": false, "description": "Config for authentication with API key.\n\nThis data type is not supported in Gemini API.", "properties": { "apiKeySecret": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. The name of the SecretManager secret version resource storing the API key. Format: `projects/{project}/secrets/{secrete}/versions/{version}` - If both `api_key_secret` and `api_key_string` are specified, this field takes precedence over `api_key_string`. - If specified, the `secretmanager.versions.access` permission should be granted to Vertex AI Extension Service Agent (https://cloud.google.com/vertex-ai/docs/general/access-control#service-agents) on the specified resource.", "title": "Apikeysecret" }, "apiKeyString": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. The API key to be used in the request directly.", "title": "Apikeystring" }, "httpElementLocation": { "anyOf": [ { "$ref": "#/$defs/HttpElementLocation" }, { "type": "null" } ], "default": null, "description": "Optional. The location of the API key." }, "name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. The parameter name of the API key. E.g. If the API request is \"https://example.com/act?api_key=\", \"api_key\" would be the parameter name.", "title": "Name" } }, "title": "ApiKeyConfig", "type": "object" }, "ApiSpec": { "description": "The API spec that the external API implements.\n\nThis enum is not supported in Gemini API.", "enum": [ "API_SPEC_UNSPECIFIED", "SIMPLE_SEARCH", "ELASTIC_SEARCH" ], "title": "ApiSpec", "type": "string" }, "AuthConfig": { "additionalProperties": false, "description": "The authentication config to access the API.", "properties": { "apiKey": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The authentication config to access the API. Only API key is supported. This field is not supported in Gemini API.", "title": "Apikey" }, "apiKeyConfig": { "anyOf": [ { "$ref": "#/$defs/ApiKeyConfig" }, { "type": "null" } ], "default": null, "description": "Config for API key auth." }, "authType": { "anyOf": [ { "$ref": "#/$defs/AuthType" }, { "type": "null" } ], "default": null, "description": "Type of auth scheme." }, "googleServiceAccountConfig": { "anyOf": [ { "$ref": "#/$defs/AuthConfigGoogleServiceAccountConfig" }, { "type": "null" } ], "default": null, "description": "Config for Google Service Account auth." }, "httpBasicAuthConfig": { "anyOf": [ { "$ref": "#/$defs/AuthConfigHttpBasicAuthConfig" }, { "type": "null" } ], "default": null, "description": "Config for HTTP Basic auth." }, "oauthConfig": { "anyOf": [ { "$ref": "#/$defs/AuthConfigOauthConfig" }, { "type": "null" } ], "default": null, "description": "Config for user oauth." }, "oidcConfig": { "anyOf": [ { "$ref": "#/$defs/AuthConfigOidcConfig" }, { "type": "null" } ], "default": null, "description": "Config for user OIDC auth." } }, "title": "AuthConfig", "type": "object" }, "AuthConfigGoogleServiceAccountConfig": { "additionalProperties": false, "description": "Config for Google Service Account Authentication.\n\nThis data type is not supported in Gemini API.", "properties": { "serviceAccount": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. The service account that the extension execution service runs as. - If the service account is specified, the `iam.serviceAccounts.getAccessToken` permission should be granted to Vertex AI Extension Service Agent (https://cloud.google.com/vertex-ai/docs/general/access-control#service-agents) on the specified service account. - If not specified, the Vertex AI Extension Service Agent will be used to execute the Extension.", "title": "Serviceaccount" } }, "title": "AuthConfigGoogleServiceAccountConfig", "type": "object" }, "AuthConfigHttpBasicAuthConfig": { "additionalProperties": false, "description": "Config for HTTP Basic Authentication.\n\nThis data type is not supported in Gemini API.", "properties": { "credentialSecret": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Required. The name of the SecretManager secret version resource storing the base64 encoded credentials. Format: `projects/{project}/secrets/{secrete}/versions/{version}` - If specified, the `secretmanager.versions.access` permission should be granted to Vertex AI Extension Service Agent (https://cloud.google.com/vertex-ai/docs/general/access-control#service-agents) on the specified resource.", "title": "Credentialsecret" } }, "title": "AuthConfigHttpBasicAuthConfig", "type": "object" }, "AuthConfigOauthConfig": { "additionalProperties": false, "description": "Config for user oauth. This data type is not supported in Gemini API.", "properties": { "accessToken": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Access token for extension endpoint. Only used to propagate token from [[ExecuteExtensionRequest.runtime_auth_config]] at request time.", "title": "Accesstoken" }, "serviceAccount": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The service account used to generate access tokens for executing the Extension. - If the service account is specified, the `iam.serviceAccounts.getAccessToken` permission should be granted to Vertex AI Extension Service Agent (https://cloud.google.com/vertex-ai/docs/general/access-control#service-agents) on the provided service account.", "title": "Serviceaccount" } }, "title": "AuthConfigOauthConfig", "type": "object" }, "AuthConfigOidcConfig": { "additionalProperties": false, "description": "Config for user OIDC auth.\n\nThis data type is not supported in Gemini API.", "properties": { "idToken": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "OpenID Connect formatted ID token for extension endpoint. Only used to propagate token from [[ExecuteExtensionRequest.runtime_auth_config]] at request time.", "title": "Idtoken" }, "serviceAccount": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The service account used to generate an OpenID Connect (OIDC)-compatible JWT token signed by the Google OIDC Provider (accounts.google.com) for extension endpoint (https://cloud.google.com/iam/docs/create-short-lived-credentials-direct#sa-credentials-oidc). - The audience for the token will be set to the URL in the server url defined in the OpenApi spec. - If the service account is provided, the service account should grant `iam.serviceAccounts.getOpenIdToken` permission to Vertex AI Extension Service Agent (https://cloud.google.com/vertex-ai/docs/general/access-control#service-agents).", "title": "Serviceaccount" } }, "title": "AuthConfigOidcConfig", "type": "object" }, "AuthType": { "description": "Type of auth scheme. This enum is not supported in Gemini API.", "enum": [ "AUTH_TYPE_UNSPECIFIED", "NO_AUTH", "API_KEY_AUTH", "HTTP_BASIC_AUTH", "GOOGLE_SERVICE_ACCOUNT_AUTH", "OAUTH", "OIDC_AUTH" ], "title": "AuthType", "type": "string" }, "BaseAgent": { "additionalProperties": false, "description": "Base class for all agents in Agent Development Kit.", "properties": { "name": { "title": "Name", "type": "string" }, "description": { "default": "", "title": "Description", "type": "string" }, "rerun_on_resume": { "default": false, "title": "Rerun On Resume", "type": "boolean" }, "wait_for_output": { "default": false, "title": "Wait For Output", "type": "boolean" }, "retry_config": { "anyOf": [ { "$ref": "#/$defs/RetryConfig" }, { "type": "null" } ], "default": null }, "timeout": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "title": "Timeout" }, "input_schema": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "$ref": "#/$defs/Schema" }, { "type": "null" } ], "default": null, "title": "Input Schema" }, "output_schema": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "$ref": "#/$defs/Schema" }, { "type": "null" } ], "default": null, "title": "Output Schema" }, "state_schema": { "anyOf": [ {}, { "type": "null" } ], "default": null, "title": "State Schema" }, "parent_agent": { "anyOf": [ { "$ref": "#/$defs/BaseAgent" }, { "type": "null" } ], "default": null }, "sub_agents": { "items": { "$ref": "#/$defs/BaseAgent" }, "title": "Sub Agents", "type": "array" }, "before_agent_callback": { "default": null, "title": "Before Agent Callback", "type": "null" }, "after_agent_callback": { "default": null, "title": "After Agent Callback", "type": "null" } }, "required": [ "name" ], "title": "BaseAgent", "type": "object" }, "Behavior": { "description": "Specifies the function Behavior.\n\nIf not specified, the system keeps the current function call behavior. This\nfield is currently only supported by the BidiGenerateContent method.", "enum": [ "UNSPECIFIED", "BLOCKING", "NON_BLOCKING" ], "title": "Behavior", "type": "string" }, "CodeMenderAgentConfigParam": { "additionalProperties": false, "description": "Configuration for the CodeMender agent.", "properties": { "find_request": { "$ref": "#/$defs/FindRequestParam" }, "fix_request": { "$ref": "#/$defs/FixRequestParam" }, "model": { "title": "Model", "type": "string" }, "session_config": { "$ref": "#/$defs/SessionConfigParam" }, "session_id": { "title": "Session Id", "type": "string" }, "type": { "const": "code-mender", "title": "Type", "type": "string" } }, "required": [ "type" ], "title": "CodeMenderAgentConfigParam", "type": "object" }, "ComputerUse": { "additionalProperties": false, "description": "Tool to support computer use.", "properties": { "environment": { "anyOf": [ { "$ref": "#/$defs/Environment" }, { "type": "null" } ], "default": null, "description": "Required. The environment being operated." }, "excludedPredefinedFunctions": { "anyOf": [ { "items": { "type": "string" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Optional. By default, [predefined functions](https://cloud.google.com/vertex-ai/generative-ai/docs/computer-use#supported-actions) are included in the final model call. Some of them can be explicitly excluded from being automatically included. This can serve two purposes: 1. Using a more restricted / different action space. 2. Improving the definitions / instructions of predefined functions.", "title": "Excludedpredefinedfunctions" }, "enablePromptInjectionDetection": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "description": "Optional. Enables the prompt injection detection check on computer-use request.", "title": "Enablepromptinjectiondetection" }, "disabledSafetyPolicies": { "anyOf": [ { "items": { "$ref": "#/$defs/SafetyPolicy" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Optional. Disabled safety policies for computer use. This field is not supported in Vertex AI.", "title": "Disabledsafetypolicies" } }, "title": "ComputerUse", "type": "object" }, "CreateAgentInteractionAgentConfigParam": { "anyOf": [ { "$ref": "#/$defs/DynamicAgentConfigParam" }, { "$ref": "#/$defs/AntigravityAgentConfigParam" }, { "$ref": "#/$defs/DeepResearchAgentConfigParam" }, { "$ref": "#/$defs/CodeMenderAgentConfigParam" } ] }, "CreateAgentInteractionEnvironmentParam": { "anyOf": [ { "$ref": "#/$defs/EnvironmentParam" }, { "type": "string" } ] }, "DeepResearchAgentConfigParam": { "additionalProperties": false, "description": "Configuration for the Deep Research agent.", "properties": { "collaborative_planning": { "title": "Collaborative Planning", "type": "boolean" }, "enable_bigquery_tool": { "title": "Enable Bigquery Tool", "type": "boolean" }, "thinking_summaries": { "anyOf": [ { "enum": [ "auto", "none" ], "type": "string" }, { "type": "string" } ], "title": "Thinking Summaries" }, "type": { "const": "deep-research", "title": "Type", "type": "string" }, "visualization": { "anyOf": [ { "enum": [ "off", "auto" ], "type": "string" }, { "type": "string" } ], "title": "Visualization" } }, "required": [ "type" ], "title": "DeepResearchAgentConfigParam", "type": "object" }, "DynamicAgentConfigParam": { "additionalProperties": false, "description": "Configuration for dynamic agents.", "properties": { "type": { "const": "dynamic", "title": "Type", "type": "string" } }, "required": [ "type" ], "title": "DynamicAgentConfigParam", "type": "object" }, "DynamicRetrievalConfig": { "additionalProperties": false, "description": "Describes the options to customize dynamic retrieval.", "properties": { "dynamicThreshold": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Optional. The threshold to be used in dynamic retrieval. If not set, a system default value is used.", "title": "Dynamicthreshold" }, "mode": { "anyOf": [ { "$ref": "#/$defs/DynamicRetrievalConfigMode" }, { "type": "null" } ], "default": null, "description": "The mode of the predictor to be used in dynamic retrieval." } }, "title": "DynamicRetrievalConfig", "type": "object" }, "DynamicRetrievalConfigMode": { "description": "The mode of the predictor to be used in dynamic retrieval.", "enum": [ "MODE_UNSPECIFIED", "MODE_DYNAMIC" ], "title": "DynamicRetrievalConfigMode", "type": "string" }, "EnterpriseWebSearch": { "additionalProperties": false, "description": "Tool to search public web data, powered by Vertex AI Search and Sec4 compliance.\n\nThis data type is not supported in Gemini API.", "properties": { "blockingConfidence": { "anyOf": [ { "$ref": "#/$defs/PhishBlockThreshold" }, { "type": "null" } ], "default": null, "description": "Optional. Sites with confidence level chosen & above this value will be blocked from the search results." }, "excludeDomains": { "anyOf": [ { "items": { "type": "string" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Optional. List of domains to be excluded from the search results. The default limit is 2000 domains.", "title": "Excludedomains" } }, "title": "EnterpriseWebSearch", "type": "object" }, "Environment": { "description": "The environment being operated.", "enum": [ "ENVIRONMENT_UNSPECIFIED", "ENVIRONMENT_BROWSER", "ENVIRONMENT_MOBILE", "ENVIRONMENT_DESKTOP" ], "title": "Environment", "type": "string" }, "EnvironmentNetworkEgressAllowlistParam": { "anyOf": [ { "$ref": "#/$defs/AllowlistParam" }, { "const": "disabled", "type": "string" } ] }, "EnvironmentParam": { "additionalProperties": false, "description": "Configuration for a custom environment.", "properties": { "environment_id": { "title": "Environment Id", "type": "string" }, "network": { "$ref": "#/$defs/NetworkParam" }, "sources": { "items": { "$ref": "#/$defs/SourceParam" }, "title": "Sources", "type": "array" }, "type": { "const": "remote", "title": "Type", "type": "string" } }, "required": [ "type" ], "title": "EnvironmentParam", "type": "object" }, "ExternalApi": { "additionalProperties": false, "description": "Retrieve from data source powered by external API for grounding.\n\nThe external API is not owned by Google, but need to follow the pre-defined\nAPI spec. This data type is not supported in Gemini API.", "properties": { "apiAuth": { "anyOf": [ { "$ref": "#/$defs/ApiAuth" }, { "type": "null" } ], "default": null, "description": "The authentication config to access the API. Deprecated. Please use auth_config instead." }, "apiSpec": { "anyOf": [ { "$ref": "#/$defs/ApiSpec" }, { "type": "null" } ], "default": null, "description": "The API spec that the external API implements." }, "authConfig": { "anyOf": [ { "$ref": "#/$defs/AuthConfig" }, { "type": "null" } ], "default": null, "description": "The authentication config to access the API." }, "elasticSearchParams": { "anyOf": [ { "$ref": "#/$defs/ExternalApiElasticSearchParams" }, { "type": "null" } ], "default": null, "description": "Parameters for the elastic search API." }, "endpoint": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The endpoint of the external API. The system will call the API at this endpoint to retrieve the data for grounding. Example: https://acme.com:443/search", "title": "Endpoint" }, "simpleSearchParams": { "anyOf": [ { "$ref": "#/$defs/ExternalApiSimpleSearchParams" }, { "type": "null" } ], "default": null, "description": "Parameters for the simple search API." } }, "title": "ExternalApi", "type": "object" }, "ExternalApiElasticSearchParams": { "additionalProperties": false, "description": "The search parameters to use for the ELASTIC_SEARCH spec.\n\nThis data type is not supported in Gemini API.", "properties": { "index": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The ElasticSearch index to use.", "title": "Index" }, "numHits": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Optional. Number of hits (chunks) to request. When specified, it is passed to Elasticsearch as the `num_hits` param.", "title": "Numhits" }, "searchTemplate": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The ElasticSearch search template to use.", "title": "Searchtemplate" } }, "title": "ExternalApiElasticSearchParams", "type": "object" }, "ExternalApiSimpleSearchParams": { "additionalProperties": false, "description": "The search parameters to use for SIMPLE_SEARCH spec.\n\nThis data type is not supported in Gemini API.", "properties": {}, "title": "ExternalApiSimpleSearchParams", "type": "object" }, "FileContentParam": { "additionalProperties": false, "description": "Content of a single file in the codebase.", "properties": { "content": { "title": "Content", "type": "string" }, "path": { "title": "Path", "type": "string" } }, "title": "FileContentParam", "type": "object" }, "FileSearch": { "additionalProperties": false, "description": "The FileSearch tool that retrieves knowledge from Semantic Retrieval corpora.\n\nFiles are imported to Semantic Retrieval corpora using the ImportFile API.\nThis data type is not supported in Vertex AI.", "properties": { "fileSearchStoreNames": { "anyOf": [ { "items": { "type": "string" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Required. The names of the file_search_stores to retrieve from. Example: `fileSearchStores/my-file-search-store-123`", "title": "Filesearchstorenames" }, "topK": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Optional. The number of semantic retrieval chunks to retrieve.", "title": "Topk" }, "metadataFilter": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. Metadata filter to apply to the semantic retrieval documents and chunks.", "title": "Metadatafilter" } }, "title": "FileSearch", "type": "object" }, "FindRequestParam": { "additionalProperties": false, "description": "Request parameters specific to FIND sessions, used for discovering\nvulnerabilities in a codebase.", "properties": { "description": { "title": "Description", "type": "string" }, "finding_id": { "title": "Finding Id", "type": "string" }, "mode": { "anyOf": [ { "enum": [ "scan", "verify" ], "type": "string" }, { "type": "string" } ], "title": "Mode" }, "source_files": { "items": { "$ref": "#/$defs/FileContentParam" }, "title": "Source Files", "type": "array" } }, "title": "FindRequestParam", "type": "object" }, "FixRequestParam": { "additionalProperties": false, "description": "Request parameters specific to FIX sessions, used for generating and\nvalidating security patches.", "properties": { "description": { "title": "Description", "type": "string" }, "finding_id": { "title": "Finding Id", "type": "string" }, "source_files": { "items": { "$ref": "#/$defs/FileContentParam" }, "title": "Source Files", "type": "array" } }, "title": "FixRequestParam", "type": "object" }, "FunctionDeclaration": { "additionalProperties": false, "description": "Structured representation of a function declaration as defined by the [OpenAPI 3.0 specification](https://spec.openapis.org/oas/v3.0.3).\n\nIncluded in this declaration are the function name, description, parameters\nand response type. This FunctionDeclaration is a representation of a block of\ncode that can be used as a `Tool` by the model and executed by the client.", "properties": { "description": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. Description and purpose of the function. Model uses it to decide how and whether to call the function.", "title": "Description" }, "name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Required. The name of the function to call. Must start with a letter or an underscore. Must be a-z, A-Z, 0-9, or contain underscores, dots, colons and dashes, with a maximum length of 128.", "title": "Name" }, "parameters": { "anyOf": [ { "$ref": "#/$defs/Schema" }, { "type": "null" } ], "default": null, "description": "Optional. Describes the parameters to this function in JSON Schema Object format. Reflects the Open API 3.03 Parameter Object. string Key: the name of the parameter. Parameter names are case sensitive. Schema Value: the Schema defining the type used for the parameter. For function with no parameters, this can be left unset. Parameter names must start with a letter or an underscore and must only contain chars a-z, A-Z, 0-9, or underscores with a maximum length of 64. Example with 1 required and 1 optional parameter: type: OBJECT properties: param1: type: STRING param2: type: INTEGER required: - param1" }, "parametersJsonSchema": { "anyOf": [ {}, { "type": "null" } ], "default": null, "description": "Optional. Describes the parameters to the function in JSON Schema format. The schema must describe an object where the properties are the parameters to the function. For example: ``` { \"type\": \"object\", \"properties\": { \"name\": { \"type\": \"string\" }, \"age\": { \"type\": \"integer\" } }, \"additionalProperties\": false, \"required\": [\"name\", \"age\"], \"propertyOrdering\": [\"name\", \"age\"] } ``` This field is mutually exclusive with `parameters`.", "title": "Parametersjsonschema" }, "response": { "anyOf": [ { "$ref": "#/$defs/Schema" }, { "type": "null" } ], "default": null, "description": "Optional. Describes the output from this function in JSON Schema format. Reflects the Open API 3.03 Response Object. The Schema defines the type used for the response value of the function." }, "responseJsonSchema": { "anyOf": [ {}, { "type": "null" } ], "default": null, "description": "Optional. Describes the output from this function in JSON Schema format. The value specified by the schema is the response value of the function. This field is mutually exclusive with `response`.", "title": "Responsejsonschema" }, "behavior": { "anyOf": [ { "$ref": "#/$defs/Behavior" }, { "type": "null" } ], "default": null, "description": "Optional. Specifies the function Behavior. If not specified, the system keeps the current function call behavior. This field is currently only supported by the BidiGenerateContent method." } }, "title": "FunctionDeclaration", "type": "object" }, "GoogleMaps": { "additionalProperties": false, "description": "Tool to retrieve knowledge from Google Maps.", "properties": { "authConfig": { "anyOf": [ { "$ref": "#/$defs/AuthConfig" }, { "type": "null" } ], "default": null, "description": "The authentication config to access the API. Only API key is supported. This field is not supported in Gemini API." }, "enableWidget": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "description": "Deprecated. The Google Maps contextual widget behavior in Grounding with Google Maps is being deprecated; this field is planned for removal and no longer has any effect once removed. Optional. Whether to return a widget context token in the GroundingMetadata of the response.", "title": "Enablewidget" }, "groundingTypes": { "anyOf": [ { "$ref": "#/$defs/GoogleMapsGroundingTypes" }, { "type": "null" } ], "default": null, "description": "Optional. Specifies the types of Google Maps grounding to enable. This field is not supported in Gemini API." } }, "title": "GoogleMaps", "type": "object" }, "GoogleMapsGroundingTypes": { "additionalProperties": false, "description": "Defines the types of Google Maps grounding that can be enabled and their configurations.\n\nThis data type is not supported in Gemini AP