Submodules

google.adk.a2a module

google.adk.agents module

google.adk.agents.Agent

alias of LlmAgent

pydantic model google.adk.agents.BaseAgent

Bases: BaseModel

Base 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"
            },
            "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"
      }
   },
   "$ref": "#/$defs/BaseAgent"
}

Fields:
  • after_agent_callback (Callable[[google.adk.agents.callback_context.CallbackContext], Awaitable[google.genai.types.Content | None] | google.genai.types.Content | None] | list[Callable[[google.adk.agents.callback_context.CallbackContext], Awaitable[google.genai.types.Content | None] | google.genai.types.Content | None]] | None)

  • before_agent_callback (Callable[[google.adk.agents.callback_context.CallbackContext], Awaitable[google.genai.types.Content | None] | google.genai.types.Content | None] | list[Callable[[google.adk.agents.callback_context.CallbackContext], 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 » name

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, the provided content will be used as agent response and appended to event history as 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_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.

config_type

alias of BaseAgentConfig

classmethod from_config(cls, config, config_abs_path)

Creates an agent from a config.

If sub-classes uses a custom agent config, override _from_config_kwargs method to return an updated kwargs for agent construstor.

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
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[[CallbackContext], 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.

property canonical_before_agent_callbacks: list[Callable[[CallbackContext], Awaitable[Content | None] | Content | None]]

The resolved self.before_agent_callback field as a list of _SingleAgentCallback.

This method is only for use by Agent Development Kit.

property root_agent: BaseAgent

Gets the root agent of this agent.

pydantic model google.adk.agents.InvocationContext

Bases: BaseModel

An invocation context represents the data of a single invocation of an agent.

An invocation:
  1. Starts with a user message and ends with a final response.

  2. Can contain one or multiple agent calls.

  3. Is handled by runner.run_async().

An invocation runs an agent until it does not request to transfer to another agent.

An agent call:
  1. Is handled by agent.run().

  2. 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:
  1. A final response is generated.

  2. The agent transfers to another agent.

  3. The end_invocation is set to true by any callbacks or tools.

A step:
  1. Calls the LLM only once and yields its response.

  2. 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"
      },
      "invocation_id": {
         "title": "Invocation Id",
         "type": "string"
      },
      "branch": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Branch"
      },
      "agent": {
         "$ref": "#/$defs/BaseAgent"
      },
      "user_content": {
         "anyOf": [
            {
               "$ref": "#/$defs/Content"
            },
            {
               "type": "null"
            }
         ],
         "default": null
      },
      "session": {
         "$ref": "#/$defs/Session"
      },
      "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"
      },
      "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": {
         "anyOf": [
            {
               "$ref": "#/$defs/RunConfig"
            },
            {
               "type": "null"
            }
         ],
         "default": null
      },
      "plugin_manager": {
         "default": null,
         "title": "Plugin Manager"
      }
   },
   "$defs": {
      "APIKey": {
         "additionalProperties": true,
         "properties": {
            "type": {
               "$ref": "#/$defs/SecuritySchemeType",
               "default": "apiKey"
            },
            "description": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Description"
            },
            "in": {
               "$ref": "#/$defs/APIKeyIn"
            },
            "name": {
               "title": "Name",
               "type": "string"
            }
         },
         "required": [
            "in",
            "name"
         ],
         "title": "APIKey",
         "type": "object"
      },
      "APIKeyIn": {
         "enum": [
            "query",
            "header",
            "cookie"
         ],
         "title": "APIKeyIn",
         "type": "string"
      },
      "ActivityHandling": {
         "description": "The different ways of handling user activity.",
         "enum": [
            "ACTIVITY_HANDLING_UNSPECIFIED",
            "START_OF_ACTIVITY_INTERRUPTS",
            "NO_INTERRUPTION"
         ],
         "title": "ActivityHandling",
         "type": "string"
      },
      "AudioTranscriptionConfig": {
         "additionalProperties": false,
         "description": "The audio transcription configuration in Setup.",
         "properties": {},
         "title": "AudioTranscriptionConfig",
         "type": "object"
      },
      "AuthConfig": {
         "additionalProperties": true,
         "description": "The auth config sent by tool asking client to collect auth credentials and\n\nadk and client will help to fill in the response",
         "properties": {
            "authScheme": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/APIKey"
                  },
                  {
                     "$ref": "#/$defs/HTTPBase"
                  },
                  {
                     "$ref": "#/$defs/OAuth2"
                  },
                  {
                     "$ref": "#/$defs/OpenIdConnect"
                  },
                  {
                     "$ref": "#/$defs/HTTPBearer"
                  },
                  {
                     "$ref": "#/$defs/OpenIdConnectWithConfig"
                  }
               ],
               "title": "Authscheme"
            },
            "rawAuthCredential": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/AuthCredential"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "exchangedAuthCredential": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/AuthCredential"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "credentialKey": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Credentialkey"
            }
         },
         "required": [
            "authScheme"
         ],
         "title": "AuthConfig",
         "type": "object"
      },
      "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"
      },
      "AutomaticActivityDetection": {
         "additionalProperties": false,
         "description": "Configures automatic detection of activity.",
         "properties": {
            "disabled": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "If enabled, detected voice and text input count as activity. If disabled, the client must send activity signals.",
               "title": "Disabled"
            },
            "startOfSpeechSensitivity": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/StartSensitivity"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Determines how likely speech is to be detected."
            },
            "endOfSpeechSensitivity": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/EndSensitivity"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Determines how likely detected speech is ended."
            },
            "prefixPaddingMs": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The required duration of detected speech before start-of-speech is committed. The lower this value the more sensitive the start-of-speech detection is and the shorter speech can be recognized. However, this also increases the probability of false positives.",
               "title": "Prefixpaddingms"
            },
            "silenceDurationMs": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The required duration of detected non-speech (e.g. silence) before end-of-speech is committed. The larger this value, the longer speech gaps can be without interrupting the user's activity but this will increase the model's latency.",
               "title": "Silencedurationms"
            }
         },
         "title": "AutomaticActivityDetection",
         "type": "object"
      },
      "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"
            },
            "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"
      },
      "Blob": {
         "additionalProperties": false,
         "description": "Content blob.",
         "properties": {
            "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 not currently used in the Gemini GenerateContent calls.",
               "title": "Displayname"
            },
            "data": {
               "anyOf": [
                  {
                     "format": "base64url",
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Required. Raw bytes.",
               "title": "Data"
            },
            "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\nOnly generated when using the [CodeExecution] tool, and always follows a\n`part` containing the [ExecutableCode].",
         "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"
            }
         },
         "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\n      'model'. Useful to set for multi-turn conversations, otherwise can be\n      empty. If role is not specified, SDK will determine the role.",
               "title": "Role"
            }
         },
         "title": "Content",
         "type": "object"
      },
      "EndSensitivity": {
         "description": "End of speech sensitivity.",
         "enum": [
            "END_SENSITIVITY_UNSPECIFIED",
            "END_SENSITIVITY_HIGH",
            "END_SENSITIVITY_LOW"
         ],
         "title": "EndSensitivity",
         "type": "string"
      },
      "Event": {
         "additionalProperties": false,
         "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.\n\nAttributes:\n  invocation_id: Required. The invocation ID of the event. Should be non-empty\n    before appending to a session.\n  author: Required. \"user\" or the name of the agent, indicating who appended\n    the event to the session.\n  actions: The actions taken by the agent.\n  long_running_tool_ids: The ids of the long running function calls.\n  branch: The branch of the event.\n  id: The unique identifier of the event.\n  timestamp: The timestamp of the event.\n  get_function_calls: Returns the function calls in the event.",
         "properties": {
            "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"
            },
            "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
            },
            "inputTranscription": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/Transcription"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "outputTranscription": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/Transcription"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "invocationId": {
               "default": "",
               "title": "Invocationid",
               "type": "string"
            },
            "author": {
               "title": "Author",
               "type": "string"
            },
            "actions": {
               "$ref": "#/$defs/EventActions"
            },
            "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"
            },
            "id": {
               "default": "",
               "title": "Id",
               "type": "string"
            },
            "timestamp": {
               "title": "Timestamp",
               "type": "number"
            }
         },
         "required": [
            "author"
         ],
         "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": {
                  "$ref": "#/$defs/AuthConfig"
               },
               "title": "Requestedauthconfigs",
               "type": "object"
            },
            "requestedToolConfirmations": {
               "additionalProperties": {
                  "$ref": "#/$defs/ToolConfirmation"
               },
               "title": "Requestedtoolconfirmations",
               "type": "object"
            }
         },
         "title": "EventActions",
         "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`."
            }
         },
         "title": "ExecutableCode",
         "type": "object"
      },
      "FileData": {
         "additionalProperties": false,
         "description": "URI based data.",
         "properties": {
            "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. It is not currently used in the Gemini GenerateContent calls.",
               "title": "Displayname"
            },
            "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"
            }
         },
         "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"
         ],
         "title": "FinishReason",
         "type": "string"
      },
      "FunctionCall": {
         "additionalProperties": false,
         "description": "A function call.",
         "properties": {
            "id": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The unique id of the function call. If populated, the client to execute the\n   `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": "Required. The name of the function to call. Matches [FunctionDeclaration.name].",
               "title": "Name"
            }
         },
         "title": "FunctionCall",
         "type": "object"
      },
      "FunctionResponse": {
         "additionalProperties": false,
         "description": "A function response.",
         "properties": {
            "willContinue": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "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 (see FunctionDeclaration.behavior for details), ignored otherwise. If false, the default, future responses will not be considered. 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.",
               "title": "Willcontinue"
            },
            "scheduling": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/FunctionResponseScheduling"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Specifies how the response should be scheduled in the conversation. Only applicable to NON_BLOCKING function calls, is ignored otherwise. Defaults to WHEN_IDLE."
            },
            "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"
      },
      "FunctionResponseScheduling": {
         "description": "Specifies how the response should be scheduled in the conversation.",
         "enum": [
            "SCHEDULING_UNSPECIFIED",
            "SILENT",
            "WHEN_IDLE",
            "INTERRUPT"
         ],
         "title": "FunctionResponseScheduling",
         "type": "string"
      },
      "GenerateContentResponseUsageMetadata": {
         "additionalProperties": false,
         "description": "Usage metadata about response(s).",
         "properties": {
            "cacheTokensDetails": {
               "anyOf": [
                  {
                     "items": {
                        "$ref": "#/$defs/ModalityTokenCount"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Output only. List of modalities of the cached content in the request input.",
               "title": "Cachetokensdetails"
            },
            "cachedContentTokenCount": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Output only. Number of tokens in the cached part in the input (the cached content).",
               "title": "Cachedcontenttokencount"
            },
            "candidatesTokenCount": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Number of tokens in the response(s).",
               "title": "Candidatestokencount"
            },
            "candidatesTokensDetails": {
               "anyOf": [
                  {
                     "items": {
                        "$ref": "#/$defs/ModalityTokenCount"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Output only. List of modalities that were returned in the response.",
               "title": "Candidatestokensdetails"
            },
            "promptTokenCount": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Number of tokens in the request. When `cached_content` is set, this is still the total effective prompt size meaning this 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. List of modalities that were processed in the request input.",
               "title": "Prompttokensdetails"
            },
            "thoughtsTokenCount": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Output only. Number of tokens present in thoughts output.",
               "title": "Thoughtstokencount"
            },
            "toolUsePromptTokenCount": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Output only. Number of tokens present in tool-use prompt(s).",
               "title": "Tooluseprompttokencount"
            },
            "toolUsePromptTokensDetails": {
               "anyOf": [
                  {
                     "items": {
                        "$ref": "#/$defs/ModalityTokenCount"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Output only. List of modalities that were processed for tool-use request inputs.",
               "title": "Tooluseprompttokensdetails"
            },
            "totalTokenCount": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Total token count for prompt, response candidates, and tool-use prompts (if present).",
               "title": "Totaltokencount"
            },
            "trafficType": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/TrafficType"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Output only. Traffic type. This shows whether a request consumes Pay-As-You-Go or Provisioned Throughput quota."
            }
         },
         "title": "GenerateContentResponseUsageMetadata",
         "type": "object"
      },
      "GroundingChunk": {
         "additionalProperties": false,
         "description": "Grounding chunk.",
         "properties": {
            "maps": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/GroundingChunkMaps"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Grounding chunk from Google Maps."
            },
            "retrievedContext": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/GroundingChunkRetrievedContext"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Grounding chunk from context retrieved by the retrieval tools."
            },
            "web": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/GroundingChunkWeb"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Grounding chunk from the web."
            }
         },
         "title": "GroundingChunk",
         "type": "object"
      },
      "GroundingChunkMaps": {
         "additionalProperties": false,
         "description": "Chunk from Google Maps.",
         "properties": {
            "placeAnswerSources": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/GroundingChunkMapsPlaceAnswerSources"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Sources used to generate the place answer. This includes review snippets and photos that were used to generate the 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. Can be used to look up the Place.",
               "title": "Placeid"
            },
            "text": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Text of the chunk.",
               "title": "Text"
            },
            "title": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Title of the chunk.",
               "title": "Title"
            },
            "uri": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "URI reference of the chunk.",
               "title": "Uri"
            }
         },
         "title": "GroundingChunkMaps",
         "type": "object"
      },
      "GroundingChunkMapsPlaceAnswerSources": {
         "additionalProperties": false,
         "description": "Sources used to generate the place answer.",
         "properties": {
            "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 are 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"
            }
         },
         "title": "GroundingChunkMapsPlaceAnswerSourcesReviewSnippet",
         "type": "object"
      },
      "GroundingChunkRetrievedContext": {
         "additionalProperties": false,
         "description": "Chunk from context retrieved by the retrieval tools.",
         "properties": {
            "documentName": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Output only. The full document name for the referenced Vertex AI Search document.",
               "title": "Documentname"
            },
            "ragChunk": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/RagChunk"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Additional context for the RAG retrieval result. This is only populated when using the RAG retrieval tool."
            },
            "text": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Text of the attribution.",
               "title": "Text"
            },
            "title": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Title of the attribution.",
               "title": "Title"
            },
            "uri": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "URI reference of the attribution.",
               "title": "Uri"
            }
         },
         "title": "GroundingChunkRetrievedContext",
         "type": "object"
      },
      "GroundingChunkWeb": {
         "additionalProperties": false,
         "description": "Chunk from the web.",
         "properties": {
            "domain": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Domain of the (original) URI.",
               "title": "Domain"
            },
            "title": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Title of the chunk.",
               "title": "Title"
            },
            "uri": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "URI reference of the chunk.",
               "title": "Uri"
            }
         },
         "title": "GroundingChunkWeb",
         "type": "object"
      },
      "GroundingMetadata": {
         "additionalProperties": false,
         "description": "Metadata returned to client when grounding is enabled.",
         "properties": {
            "googleMapsWidgetContextToken": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Output only. Resource name of the Google Maps widget context token to be used with the PlacesContextElement widget to render contextual data. This is populated only for Google Maps grounding.",
               "title": "Googlemapswidgetcontexttoken"
            },
            "groundingChunks": {
               "anyOf": [
                  {
                     "items": {
                        "$ref": "#/$defs/GroundingChunk"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "List of supporting references retrieved from specified grounding source.",
               "title": "Groundingchunks"
            },
            "groundingSupports": {
               "anyOf": [
                  {
                     "items": {
                        "$ref": "#/$defs/GroundingSupport"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. List of grounding support.",
               "title": "Groundingsupports"
            },
            "retrievalMetadata": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/RetrievalMetadata"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Output only. Retrieval metadata."
            },
            "retrievalQueries": {
               "anyOf": [
                  {
                     "items": {
                        "type": "string"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Queries executed by the retrieval tools.",
               "title": "Retrievalqueries"
            },
            "searchEntryPoint": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/SearchEntryPoint"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Google search entry for the following-up web searches."
            },
            "webSearchQueries": {
               "anyOf": [
                  {
                     "items": {
                        "type": "string"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Web search queries for the following-up web search.",
               "title": "Websearchqueries"
            }
         },
         "title": "GroundingMetadata",
         "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. Ranges from 0 to 1. 1 is the most confident. For Gemini 2.0 and before, this list must have the same size as the grounding_chunk_indices. For Gemini 2.5 and after, this list will be empty and should be ignored.",
               "title": "Confidencescores"
            },
            "groundingChunkIndices": {
               "anyOf": [
                  {
                     "items": {
                        "type": "integer"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "A list of indices (into 'grounding_chunk') specifying the citations associated with the claim. For instance [1,3,4] means that grounding_chunk[1], grounding_chunk[3], grounding_chunk[4] are the 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."
            }
         },
         "title": "GroundingSupport",
         "type": "object"
      },
      "HTTPBase": {
         "additionalProperties": true,
         "properties": {
            "type": {
               "$ref": "#/$defs/SecuritySchemeType",
               "default": "http"
            },
            "description": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Description"
            },
            "scheme": {
               "title": "Scheme",
               "type": "string"
            }
         },
         "required": [
            "scheme"
         ],
         "title": "HTTPBase",
         "type": "object"
      },
      "HTTPBearer": {
         "additionalProperties": true,
         "properties": {
            "type": {
               "$ref": "#/$defs/SecuritySchemeType",
               "default": "http"
            },
            "description": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Description"
            },
            "scheme": {
               "const": "bearer",
               "default": "bearer",
               "title": "Scheme",
               "type": "string"
            },
            "bearerFormat": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Bearerformat"
            }
         },
         "title": "HTTPBearer",
         "type": "object"
      },
      "HttpAuth": {
         "additionalProperties": true,
         "description": "The credentials and metadata for HTTP authentication.",
         "properties": {
            "scheme": {
               "title": "Scheme",
               "type": "string"
            },
            "credentials": {
               "$ref": "#/$defs/HttpCredentials"
            }
         },
         "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": "Required. Programming language of the `code`.",
         "enum": [
            "LANGUAGE_UNSPECIFIED",
            "PYTHON"
         ],
         "title": "Language",
         "type": "string"
      },
      "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 `SessionResmumptionTokenUpdate`. 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 arelikely not needed.",
               "title": "Lastconsumedclientmessageindex"
            }
         },
         "title": "LiveServerSessionResumptionUpdate",
         "type": "object"
      },
      "MediaModality": {
         "description": "Server content modalities.",
         "enum": [
            "MODALITY_UNSPECIFIED",
            "TEXT",
            "IMAGE",
            "VIDEO",
            "AUDIO",
            "DOCUMENT"
         ],
         "title": "MediaModality",
         "type": "string"
      },
      "ModalityTokenCount": {
         "additionalProperties": false,
         "description": "Represents token counting info for a single modality.",
         "properties": {
            "modality": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/MediaModality"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The modality associated with this token count."
            },
            "tokenCount": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Number of tokens.",
               "title": "Tokencount"
            }
         },
         "title": "ModalityTokenCount",
         "type": "object"
      },
      "MultiSpeakerVoiceConfig": {
         "additionalProperties": false,
         "description": "The configuration for the multi-speaker setup.",
         "properties": {
            "speakerVoiceConfigs": {
               "anyOf": [
                  {
                     "items": {
                        "$ref": "#/$defs/SpeakerVoiceConfig"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The configuration for the speaker to use.",
               "title": "Speakervoiceconfigs"
            }
         },
         "title": "MultiSpeakerVoiceConfig",
         "type": "object"
      },
      "OAuth2": {
         "additionalProperties": true,
         "properties": {
            "type": {
               "$ref": "#/$defs/SecuritySchemeType",
               "default": "oauth2"
            },
            "description": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Description"
            },
            "flows": {
               "$ref": "#/$defs/OAuthFlows"
            }
         },
         "required": [
            "flows"
         ],
         "title": "OAuth2",
         "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"
            },
            "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"
            },
            "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"
            }
         },
         "title": "OAuth2Auth",
         "type": "object"
      },
      "OAuthFlowAuthorizationCode": {
         "additionalProperties": true,
         "properties": {
            "refreshUrl": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Refreshurl"
            },
            "scopes": {
               "additionalProperties": {
                  "type": "string"
               },
               "default": {},
               "title": "Scopes",
               "type": "object"
            },
            "authorizationUrl": {
               "title": "Authorizationurl",
               "type": "string"
            },
            "tokenUrl": {
               "title": "Tokenurl",
               "type": "string"
            }
         },
         "required": [
            "authorizationUrl",
            "tokenUrl"
         ],
         "title": "OAuthFlowAuthorizationCode",
         "type": "object"
      },
      "OAuthFlowClientCredentials": {
         "additionalProperties": true,
         "properties": {
            "refreshUrl": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Refreshurl"
            },
            "scopes": {
               "additionalProperties": {
                  "type": "string"
               },
               "default": {},
               "title": "Scopes",
               "type": "object"
            },
            "tokenUrl": {
               "title": "Tokenurl",
               "type": "string"
            }
         },
         "required": [
            "tokenUrl"
         ],
         "title": "OAuthFlowClientCredentials",
         "type": "object"
      },
      "OAuthFlowImplicit": {
         "additionalProperties": true,
         "properties": {
            "refreshUrl": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Refreshurl"
            },
            "scopes": {
               "additionalProperties": {
                  "type": "string"
               },
               "default": {},
               "title": "Scopes",
               "type": "object"
            },
            "authorizationUrl": {
               "title": "Authorizationurl",
               "type": "string"
            }
         },
         "required": [
            "authorizationUrl"
         ],
         "title": "OAuthFlowImplicit",
         "type": "object"
      },
      "OAuthFlowPassword": {
         "additionalProperties": true,
         "properties": {
            "refreshUrl": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Refreshurl"
            },
            "scopes": {
               "additionalProperties": {
                  "type": "string"
               },
               "default": {},
               "title": "Scopes",
               "type": "object"
            },
            "tokenUrl": {
               "title": "Tokenurl",
               "type": "string"
            }
         },
         "required": [
            "tokenUrl"
         ],
         "title": "OAuthFlowPassword",
         "type": "object"
      },
      "OAuthFlows": {
         "additionalProperties": true,
         "properties": {
            "implicit": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/OAuthFlowImplicit"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "password": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/OAuthFlowPassword"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "clientCredentials": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/OAuthFlowClientCredentials"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "authorizationCode": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/OAuthFlowAuthorizationCode"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            }
         },
         "title": "OAuthFlows",
         "type": "object"
      },
      "OpenIdConnect": {
         "additionalProperties": true,
         "properties": {
            "type": {
               "$ref": "#/$defs/SecuritySchemeType",
               "default": "openIdConnect"
            },
            "description": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Description"
            },
            "openIdConnectUrl": {
               "title": "Openidconnecturl",
               "type": "string"
            }
         },
         "required": [
            "openIdConnectUrl"
         ],
         "title": "OpenIdConnect",
         "type": "object"
      },
      "OpenIdConnectWithConfig": {
         "additionalProperties": true,
         "properties": {
            "type": {
               "$ref": "#/$defs/SecuritySchemeType",
               "default": "openIdConnect"
            },
            "description": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Description"
            },
            "authorization_endpoint": {
               "title": "Authorization Endpoint",
               "type": "string"
            },
            "token_endpoint": {
               "title": "Token Endpoint",
               "type": "string"
            },
            "userinfo_endpoint": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Userinfo Endpoint"
            },
            "revocation_endpoint": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Revocation Endpoint"
            },
            "token_endpoint_auth_methods_supported": {
               "anyOf": [
                  {
                     "items": {
                        "type": "string"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Token Endpoint Auth Methods Supported"
            },
            "grant_types_supported": {
               "anyOf": [
                  {
                     "items": {
                        "type": "string"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Grant Types Supported"
            },
            "scopes": {
               "anyOf": [
                  {
                     "items": {
                        "type": "string"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Scopes"
            }
         },
         "required": [
            "authorization_endpoint",
            "token_endpoint"
         ],
         "title": "OpenIdConnectWithConfig",
         "type": "object"
      },
      "Outcome": {
         "description": "Required. 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": {
            "videoMetadata": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/VideoMetadata"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Metadata for a given video."
            },
            "thought": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Indicates if the part is thought from the model.",
               "title": "Thought"
            },
            "inlineData": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/Blob"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Inlined bytes data."
            },
            "fileData": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/FileData"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. URI based data."
            },
            "thoughtSignature": {
               "anyOf": [
                  {
                     "format": "base64url",
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "An opaque signature for the thought so it can be reused in subsequent requests.",
               "title": "Thoughtsignature"
            },
            "codeExecutionResult": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/CodeExecutionResult"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Result of executing the [ExecutableCode]."
            },
            "executableCode": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/ExecutableCode"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Code generated by the model that is meant to be executed."
            },
            "functionCall": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/FunctionCall"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. A predicted [FunctionCall] returned from the model that contains a string representing the [FunctionDeclaration.name] with the parameters and their values."
            },
            "functionResponse": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/FunctionResponse"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. The result output of a [FunctionCall] that contains a string representing the [FunctionDeclaration.name] and a structured JSON object containing any output from the function call. It is used as context to the model."
            },
            "text": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Text part (can be code).",
               "title": "Text"
            }
         },
         "title": "Part",
         "type": "object"
      },
      "PrebuiltVoiceConfig": {
         "additionalProperties": false,
         "description": "The configuration for the prebuilt speaker to use.",
         "properties": {
            "voiceName": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The name of the prebuilt voice to use.",
               "title": "Voicename"
            }
         },
         "title": "PrebuiltVoiceConfig",
         "type": "object"
      },
      "ProactivityConfig": {
         "additionalProperties": false,
         "description": "Config for proactivity features.",
         "properties": {
            "proactiveAudio": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "If enabled, the model can reject responding to the last prompt. For\n        example, this allows the model to ignore out of context speech or to stay\n        silent if the user did not make a request, yet.",
               "title": "Proactiveaudio"
            }
         },
         "title": "ProactivityConfig",
         "type": "object"
      },
      "RagChunk": {
         "additionalProperties": false,
         "description": "A RagChunk includes the content of a chunk of a RagFile, and associated metadata.",
         "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"
            }
         },
         "title": "RagChunk",
         "type": "object"
      },
      "RagChunkPageSpan": {
         "additionalProperties": false,
         "description": "Represents where the chunk starts and ends in the document.",
         "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"
      },
      "RealtimeInputConfig": {
         "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": {
            "automaticActivityDetection": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/AutomaticActivityDetection"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "If not set, automatic activity detection is enabled by default. If automatic voice detection is disabled, the client must send activity signals."
            },
            "activityHandling": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/ActivityHandling"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Defines what effect activity has."
            },
            "turnCoverage": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/TurnCoverage"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Defines which input is included in the user's turn."
            }
         },
         "title": "RealtimeInputConfig",
         "type": "object"
      },
      "RetrievalMetadata": {
         "additionalProperties": false,
         "description": "Metadata related to retrieval in the grounding flow.",
         "properties": {
            "googleSearchDynamicRetrievalScore": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Score indicating how likely information from Google Search could help answer the prompt. The score is in the range `[0, 1]`, where 0 is the least likely and 1 is the most likely. This score is only populated when Google Search grounding and dynamic retrieval is enabled. It will be compared to the threshold to determine whether to trigger Google Search.",
               "title": "Googlesearchdynamicretrievalscore"
            }
         },
         "title": "RetrievalMetadata",
         "type": "object"
      },
      "RunConfig": {
         "additionalProperties": false,
         "description": "Configs for runtime behavior of agents.",
         "properties": {
            "speech_config": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/SpeechConfig"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "response_modalities": {
               "anyOf": [
                  {
                     "items": {
                        "type": "string"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Response Modalities"
            },
            "save_input_blobs_as_artifacts": {
               "default": false,
               "title": "Save Input Blobs As Artifacts",
               "type": "boolean"
            },
            "support_cfc": {
               "default": false,
               "title": "Support Cfc",
               "type": "boolean"
            },
            "streaming_mode": {
               "$ref": "#/$defs/StreamingMode",
               "default": null
            },
            "output_audio_transcription": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/AudioTranscriptionConfig"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "input_audio_transcription": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/AudioTranscriptionConfig"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "realtime_input_config": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/RealtimeInputConfig"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "enable_affective_dialog": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Enable Affective Dialog"
            },
            "proactivity": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/ProactivityConfig"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "session_resumption": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/SessionResumptionConfig"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "max_llm_calls": {
               "default": 500,
               "title": "Max Llm Calls",
               "type": "integer"
            }
         },
         "title": "RunConfig",
         "type": "object"
      },
      "SearchEntryPoint": {
         "additionalProperties": false,
         "description": "Google search entry point.",
         "properties": {
            "renderedContent": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Web content snippet that can be embedded in a web page or an app webview.",
               "title": "Renderedcontent"
            },
            "sdkBlob": {
               "anyOf": [
                  {
                     "format": "base64url",
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Base64 encoded JSON representing array of tuple.",
               "title": "Sdkblob"
            }
         },
         "title": "SearchEntryPoint",
         "type": "object"
      },
      "SecuritySchemeType": {
         "enum": [
            "apiKey",
            "http",
            "oauth2",
            "openIdConnect"
         ],
         "title": "SecuritySchemeType",
         "type": "string"
      },
      "Segment": {
         "additionalProperties": false,
         "description": "Segment of the content.",
         "properties": {
            "endIndex": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Output only. End index in the given Part, measured in bytes. 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 Content object.",
               "title": "Partindex"
            },
            "startIndex": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Output only. Start index in the given Part, measured in bytes. Offset from the start of the Part, inclusive, starting at zero.",
               "title": "Startindex"
            },
            "text": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Output only. The text corresponding to the segment from the response.",
               "title": "Text"
            }
         },
         "title": "Segment",
         "type": "object"
      },
      "ServiceAccount": {
         "additionalProperties": true,
         "description": "Represents Google Service Account configuration.",
         "properties": {
            "serviceAccountCredential": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/ServiceAccountCredential"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "scopes": {
               "items": {
                  "type": "string"
               },
               "title": "Scopes",
               "type": "array"
            },
            "useDefaultCredential": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": false,
               "title": "Usedefaultcredential"
            }
         },
         "required": [
            "scopes"
         ],
         "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.\n\nAttributes:\n  id: The unique identifier of the session.\n  app_name: The name of the app.\n  user_id: The id of the user.\n  state: The state of the session.\n  events: The events of the session, e.g. user input, model response, function\n    call/response, etc.\n  last_update_time: The last update time of the session.",
         "properties": {
            "id": {
               "title": "Id",
               "type": "string"
            },
            "appName": {
               "title": "Appname",
               "type": "string"
            },
            "userId": {
               "title": "Userid",
               "type": "string"
            },
            "state": {
               "additionalProperties": true,
               "title": "State",
               "type": "object"
            },
            "events": {
               "items": {
                  "$ref": "#/$defs/Event"
               },
               "title": "Events",
               "type": "array"
            },
            "lastUpdateTime": {
               "default": 0.0,
               "title": "Lastupdatetime",
               "type": "number"
            }
         },
         "required": [
            "id",
            "appName",
            "userId"
         ],
         "title": "Session",
         "type": "object"
      },
      "SessionResumptionConfig": {
         "additionalProperties": false,
         "description": "Configuration of session resumption mechanism.\n\nIncluded in `LiveConnectConfig.session_resumption`. If included server\nwill send `LiveServerSessionResumptionUpdate` messages.",
         "properties": {
            "handle": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Session resumption handle of previous session (session to restore).\n\nIf not present new session will be started.",
               "title": "Handle"
            },
            "transparent": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "If set the server will send `last_consumed_client_message_index` in the `session_resumption_update` messages to allow for transparent reconnections.",
               "title": "Transparent"
            }
         },
         "title": "SessionResumptionConfig",
         "type": "object"
      },
      "SpeakerVoiceConfig": {
         "additionalProperties": false,
         "description": "The configuration for the speaker to use.",
         "properties": {
            "speaker": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The name of the speaker to use. Should be the same as in the\n          prompt.",
               "title": "Speaker"
            },
            "voiceConfig": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/VoiceConfig"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The configuration for the voice to use."
            }
         },
         "title": "SpeakerVoiceConfig",
         "type": "object"
      },
      "SpeechConfig": {
         "additionalProperties": false,
         "description": "The speech generation configuration.",
         "properties": {
            "voiceConfig": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/VoiceConfig"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The configuration for the speaker to use.\n      "
            },
            "multiSpeakerVoiceConfig": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/MultiSpeakerVoiceConfig"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The configuration for the multi-speaker setup.\n          It is mutually exclusive with the voice_config field.\n          "
            },
            "languageCode": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Language code (ISO 639. e.g. en-US) for the speech synthesization.\n      Only available for Live API.\n      ",
               "title": "Languagecode"
            }
         },
         "title": "SpeechConfig",
         "type": "object"
      },
      "StartSensitivity": {
         "description": "Start of speech sensitivity.",
         "enum": [
            "START_SENSITIVITY_UNSPECIFIED",
            "START_SENSITIVITY_HIGH",
            "START_SENSITIVITY_LOW"
         ],
         "title": "StartSensitivity",
         "type": "string"
      },
      "StreamingMode": {
         "enum": [
            null,
            "sse",
            "bidi"
         ],
         "title": "StreamingMode"
      },
      "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"
      },
      "TrafficType": {
         "description": "Output only.\n\nTraffic type. This shows whether a request consumes Pay-As-You-Go or\nProvisioned Throughput quota.",
         "enum": [
            "TRAFFIC_TYPE_UNSPECIFIED",
            "ON_DEMAND",
            "PROVISIONED_THROUGHPUT"
         ],
         "title": "TrafficType",
         "type": "string"
      },
      "Transcription": {
         "additionalProperties": false,
         "description": "Audio transcription in Server Conent.",
         "properties": {
            "text": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Transcription text.\n      ",
               "title": "Text"
            },
            "finished": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The bool indicates the end of the transcription.\n      ",
               "title": "Finished"
            }
         },
         "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"
      },
      "TurnCoverage": {
         "description": "Options about which input is included in the user's turn.",
         "enum": [
            "TURN_COVERAGE_UNSPECIFIED",
            "TURN_INCLUDES_ONLY_ACTIVITY",
            "TURN_INCLUDES_ALL_INPUT"
         ],
         "title": "TurnCoverage",
         "type": "string"
      },
      "VideoMetadata": {
         "additionalProperties": false,
         "description": "Describes how the video in the Part should be used by the model.",
         "properties": {
            "fps": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The frame rate of the video sent to the model. If not specified, the\n        default value will be 1.0. The fps range is (0.0, 24.0].",
               "title": "Fps"
            },
            "endOffset": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. The end offset of the video.",
               "title": "Endoffset"
            },
            "startOffset": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. The start offset of the video.",
               "title": "Startoffset"
            }
         },
         "title": "VideoMetadata",
         "type": "object"
      },
      "VoiceConfig": {
         "additionalProperties": false,
         "description": "The configuration for the voice to use.",
         "properties": {
            "prebuiltVoiceConfig": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/PrebuiltVoiceConfig"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The configuration for the speaker to use.\n      "
            }
         },
         "title": "VoiceConfig",
         "type": "object"
      }
   },
   "additionalProperties": false,
   "required": [
      "invocation_id",
      "agent",
      "session"
   ]
}

Fields:
  • active_streaming_tools (dict[str, google.adk.agents.active_streaming_tool.ActiveStreamingTool] | None)

  • agent (google.adk.agents.base_agent.BaseAgent)

  • artifact_service (google.adk.artifacts.base_artifact_service.BaseArtifactService | None)

  • branch (str | None)

  • credential_service (google.adk.auth.credential_service.base_credential_service.BaseCredentialService | None)

  • end_invocation (bool)

  • input_realtime_cache (list[google.adk.agents.invocation_context.RealtimeCacheEntry] | None)

  • invocation_id (str)

  • 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)

  • output_realtime_cache (list[google.adk.agents.invocation_context.RealtimeCacheEntry] | None)

  • plugin_manager (google.adk.plugins.plugin_manager.PluginManager)

  • run_config (google.adk.agents.run_config.RunConfig | None)

  • session (google.adk.sessions.session.Session)

  • session_service (google.adk.sessions.base_session_service.BaseSessionService)

  • transcription_cache (list[google.adk.agents.transcription_entry.TranscriptionEntry] | None)

  • user_content (google.genai.types.Content | None)

field active_streaming_tools: Optional[dict[str, ActiveStreamingTool]] = None

The running streaming tools of this invocation.

field agent: BaseAgent [Required]

The current agent of this invocation context. Readonly.

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 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 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 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 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 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 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.

Raises:

LlmCallsLimitExceededError – If number of llm calls made exceed the set threshold.

model_post_init(context, /)

This function is meant to behave like a BaseModel method to initialise private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Return type:

None

Parameters:
  • self – The BaseModel instance.

  • context – The context.

property app_name: str
property user_id: str
pydantic model google.adk.agents.LiveRequest

Bases: BaseModel

Request 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"
      }
   },
   "$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": "Content blob.",
         "properties": {
            "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 not currently used in the Gemini GenerateContent calls.",
               "title": "Displayname"
            },
            "data": {
               "anyOf": [
                  {
                     "format": "base64url",
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Required. Raw bytes.",
               "title": "Data"
            },
            "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\nOnly generated when using the [CodeExecution] tool, and always follows a\n`part` containing the [ExecutableCode].",
         "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"
            }
         },
         "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\n      'model'. Useful to set for multi-turn conversations, otherwise can be\n      empty. If role is not specified, SDK will determine the role.",
               "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`."
            }
         },
         "title": "ExecutableCode",
         "type": "object"
      },
      "FileData": {
         "additionalProperties": false,
         "description": "URI based data.",
         "properties": {
            "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. It is not currently used in the Gemini GenerateContent calls.",
               "title": "Displayname"
            },
            "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"
            }
         },
         "title": "FileData",
         "type": "object"
      },
      "FunctionCall": {
         "additionalProperties": false,
         "description": "A function call.",
         "properties": {
            "id": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The unique id of the function call. If populated, the client to execute the\n   `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": "Required. The name of the function to call. Matches [FunctionDeclaration.name].",
               "title": "Name"
            }
         },
         "title": "FunctionCall",
         "type": "object"
      },
      "FunctionResponse": {
         "additionalProperties": false,
         "description": "A function response.",
         "properties": {
            "willContinue": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "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 (see FunctionDeclaration.behavior for details), ignored otherwise. If false, the default, future responses will not be considered. 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.",
               "title": "Willcontinue"
            },
            "scheduling": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/FunctionResponseScheduling"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Specifies how the response should be scheduled in the conversation. Only applicable to NON_BLOCKING function calls, is ignored otherwise. Defaults to WHEN_IDLE."
            },
            "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"
      },
      "FunctionResponseScheduling": {
         "description": "Specifies how the response should be scheduled in the conversation.",
         "enum": [
            "SCHEDULING_UNSPECIFIED",
            "SILENT",
            "WHEN_IDLE",
            "INTERRUPT"
         ],
         "title": "FunctionResponseScheduling",
         "type": "string"
      },
      "Language": {
         "description": "Required. Programming language of the `code`.",
         "enum": [
            "LANGUAGE_UNSPECIFIED",
            "PYTHON"
         ],
         "title": "Language",
         "type": "string"
      },
      "Outcome": {
         "description": "Required. 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": {
            "videoMetadata": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/VideoMetadata"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Metadata for a given video."
            },
            "thought": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Indicates if the part is thought from the model.",
               "title": "Thought"
            },
            "inlineData": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/Blob"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Inlined bytes data."
            },
            "fileData": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/FileData"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. URI based data."
            },
            "thoughtSignature": {
               "anyOf": [
                  {
                     "format": "base64url",
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "An opaque signature for the thought so it can be reused in subsequent requests.",
               "title": "Thoughtsignature"
            },
            "codeExecutionResult": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/CodeExecutionResult"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Result of executing the [ExecutableCode]."
            },
            "executableCode": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/ExecutableCode"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Code generated by the model that is meant to be executed."
            },
            "functionCall": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/FunctionCall"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. A predicted [FunctionCall] returned from the model that contains a string representing the [FunctionDeclaration.name] with the parameters and their values."
            },
            "functionResponse": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/FunctionResponse"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. The result output of a [FunctionCall] that contains a string representing the [FunctionDeclaration.name] and a structured JSON object containing any output from the function call. It is used as context to the model."
            },
            "text": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Text part (can be code).",
               "title": "Text"
            }
         },
         "title": "Part",
         "type": "object"
      },
      "VideoMetadata": {
         "additionalProperties": false,
         "description": "Describes how the video in the Part should be used by the model.",
         "properties": {
            "fps": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The frame rate of the video sent to the model. If not specified, the\n        default value will be 1.0. The fps range is (0.0, 24.0].",
               "title": "Fps"
            },
            "endOffset": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. The end offset of the video.",
               "title": "Endoffset"
            },
            "startOffset": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. The start offset of the video.",
               "title": "Startoffset"
            }
         },
         "title": "VideoMetadata",
         "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)

field activity_end: Optional[types.ActivityEnd] = None

If set, signal the end of user activity to the model.

field activity_start: Optional[types.ActivityStart] = None

If set, signal the start of user activity to the model.

field blob: Optional[types.Blob] = None

If set, send the blob to the model in realtime mode.

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.

class google.adk.agents.LiveRequestQueue

Bases: object

Queue used to send LiveRequest in a live(bidirectional streaming) way.

close()
async get()
Return type:

LiveRequest

send(req)
send_activity_end()

Sends an activity end signal to mark the end of user input.

send_activity_start()

Sends an activity start signal to mark the beginning of user input.

send_content(content)
send_realtime(blob)
pydantic model google.adk.agents.LlmAgent

Bases: BaseAgent

LLM-based Agent.

Show JSON schema
{
   "title": "LlmAgent",
   "type": "object",
   "properties": {
      "name": {
         "title": "Name",
         "type": "string"
      },
      "description": {
         "default": "",
         "title": "Description",
         "type": "string"
      },
      "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"
      },
      "tools": {
         "items": {
            "anyOf": []
         },
         "title": "Tools",
         "type": "array"
      },
      "generate_content_config": {
         "anyOf": [
            {
               "$ref": "#/$defs/GenerateContentConfig"
            },
            {
               "type": "null"
            }
         ],
         "default": null
      },
      "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"
      },
      "input_schema": {
         "anyOf": [
            {},
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Input Schema"
      },
      "output_schema": {
         "anyOf": [
            {},
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Output Schema"
      },
      "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"
      },
      "before_tool_callback": {
         "default": null,
         "title": "Before Tool Callback",
         "type": "null"
      },
      "after_tool_callback": {
         "default": null,
         "title": "After Tool Callback",
         "type": "null"
      }
   },
   "$defs": {
      "ApiAuth": {
         "additionalProperties": false,
         "description": "The generic reusable api auth config.\n\nDeprecated. Please use AuthConfig (google/cloud/aiplatform/master/auth.proto)\ninstead.",
         "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.",
         "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.",
         "properties": {
            "apiKeyString": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The API key to be used in the request directly.",
               "title": "Apikeystring"
            }
         },
         "title": "ApiKeyConfig",
         "type": "object"
      },
      "ApiSpec": {
         "description": "The API spec that the external API implements.",
         "enum": [
            "API_SPEC_UNSPECIFIED",
            "SIMPLE_SEARCH",
            "ELASTIC_SEARCH"
         ],
         "title": "ApiSpec",
         "type": "string"
      },
      "AuthConfig": {
         "additionalProperties": false,
         "description": "Auth configuration to run the extension.",
         "properties": {
            "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.",
         "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.",
         "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.",
         "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.",
         "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.",
         "enum": [
            "AUTH_TYPE_UNSPECIFIED",
            "NO_AUTH",
            "API_KEY_AUTH",
            "HTTP_BASIC_AUTH",
            "GOOGLE_SERVICE_ACCOUNT_AUTH",
            "OAUTH",
            "OIDC_AUTH"
         ],
         "title": "AuthType",
         "type": "string"
      },
      "AutomaticFunctionCallingConfig": {
         "additionalProperties": false,
         "description": "The configuration for automatic function calling.",
         "properties": {
            "disable": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Whether to disable automatic function calling.\n      If not set or set to False, will enable automatic function calling.\n      If set to True, will disable automatic function calling.\n      ",
               "title": "Disable"
            },
            "maximumRemoteCalls": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": 10,
               "description": "If automatic function calling is enabled,\n      maximum number of remote calls for automatic function calling.\n      This number should be a positive integer.\n      If not set, SDK will set maximum number of remote calls to 10.\n      ",
               "title": "Maximumremotecalls"
            },
            "ignoreCallHistory": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "If automatic function calling is enabled,\n      whether to ignore call history to the response.\n      If not set, SDK will set ignore_call_history to false,\n      and will append the call history to\n      GenerateContentResponse.automatic_function_calling_history.\n      ",
               "title": "Ignorecallhistory"
            }
         },
         "title": "AutomaticFunctionCallingConfig",
         "type": "object"
      },
      "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"
            },
            "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.",
         "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"
            }
         },
         "title": "BaseCodeExecutor",
         "type": "object"
      },
      "BaseLlm": {
         "description": "The BaseLLM class.\n\nAttributes:\n  model: The name of the LLM, e.g. gemini-1.5-flash or gemini-1.5-flash-001.",
         "properties": {
            "model": {
               "title": "Model",
               "type": "string"
            }
         },
         "required": [
            "model"
         ],
         "title": "BaseLlm",
         "type": "object"
      },
      "Behavior": {
         "description": "Defines the function behavior. Defaults to `BLOCKING`.",
         "enum": [
            "UNSPECIFIED",
            "BLOCKING",
            "NON_BLOCKING"
         ],
         "title": "Behavior",
         "type": "string"
      },
      "Blob": {
         "additionalProperties": false,
         "description": "Content blob.",
         "properties": {
            "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 not currently used in the Gemini GenerateContent calls.",
               "title": "Displayname"
            },
            "data": {
               "anyOf": [
                  {
                     "format": "base64url",
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Required. Raw bytes.",
               "title": "Data"
            },
            "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\nOnly generated when using the [CodeExecution] tool, and always follows a\n`part` containing the [ExecutableCode].",
         "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"
            }
         },
         "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\n      'model'. Useful to set for multi-turn conversations, otherwise can be\n      empty. If role is not specified, SDK will determine the role.",
               "title": "Role"
            }
         },
         "title": "Content",
         "type": "object"
      },
      "DynamicRetrievalConfig": {
         "additionalProperties": false,
         "description": "Describes the options to customize dynamic retrieval.",
         "properties": {
            "mode": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/DynamicRetrievalConfigMode"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The mode of the predictor to be used in dynamic retrieval."
            },
            "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"
            }
         },
         "title": "DynamicRetrievalConfig",
         "type": "object"
      },
      "DynamicRetrievalConfigMode": {
         "description": "Config for the dynamic retrieval config mode.",
         "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.",
         "properties": {
            "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"
         ],
         "title": "Environment",
         "type": "string"
      },
      "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`."
            }
         },
         "title": "ExecutableCode",
         "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.",
         "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.",
         "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.",
         "properties": {},
         "title": "ExternalApiSimpleSearchParams",
         "type": "object"
      },
      "FeatureSelectionPreference": {
         "description": "Options for feature selection preference.",
         "enum": [
            "FEATURE_SELECTION_PREFERENCE_UNSPECIFIED",
            "PRIORITIZE_QUALITY",
            "BALANCED",
            "PRIORITIZE_COST"
         ],
         "title": "FeatureSelectionPreference",
         "type": "string"
      },
      "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.",
         "properties": {
            "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. It is not currently used in the Gemini GenerateContent calls.",
               "title": "Displayname"
            },
            "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"
            }
         },
         "title": "FileData",
         "type": "object"
      },
      "FileSource": {
         "description": "Source of the File.",
         "enum": [
            "SOURCE_UNSPECIFIED",
            "UPLOADED",
            "GENERATED"
         ],
         "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 function call.",
         "properties": {
            "id": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The unique id of the function call. If populated, the client to execute the\n   `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": "Required. The name of the function to call. Matches [FunctionDeclaration.name].",
               "title": "Name"
            }
         },
         "title": "FunctionCall",
         "type": "object"
      },
      "FunctionCallingConfig": {
         "additionalProperties": false,
         "description": "Function calling config.",
         "properties": {
            "mode": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/FunctionCallingConfigMode"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Function calling mode."
            },
            "allowedFunctionNames": {
               "anyOf": [
                  {
                     "items": {
                        "type": "string"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Function names to call. Only set when the Mode is ANY. Function names should match [FunctionDeclaration.name]. With mode set to ANY, model will predict a function call from the set of function names provided.",
               "title": "Allowedfunctionnames"
            }
         },
         "title": "FunctionCallingConfig",
         "type": "object"
      },
      "FunctionCallingConfigMode": {
         "description": "Config for the function calling config mode.",
         "enum": [
            "MODE_UNSPECIFIED",
            "AUTO",
            "ANY",
            "NONE",
            "VALIDATED"
         ],
         "title": "FunctionCallingConfigMode",
         "type": "string"
      },
      "FunctionDeclaration": {
         "additionalProperties": false,
         "description": "Defines a function that the model can generate JSON inputs for.\n\nThe inputs are based on `OpenAPI 3.0 specifications\n<https://spec.openapis.org/oas/v3.0.3>`_.",
         "properties": {
            "behavior": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/Behavior"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Defines the function behavior."
            },
            "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 and dashes, with a maximum length of 64.",
               "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"
            }
         },
         "title": "FunctionDeclaration",
         "type": "object"
      },
      "FunctionResponse": {
         "additionalProperties": false,
         "description": "A function response.",
         "properties": {
            "willContinue": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "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 (see FunctionDeclaration.behavior for details), ignored otherwise. If false, the default, future responses will not be considered. 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.",
               "title": "Willcontinue"
            },
            "scheduling": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/FunctionResponseScheduling"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Specifies how the response should be scheduled in the conversation. Only applicable to NON_BLOCKING function calls, is ignored otherwise. Defaults to WHEN_IDLE."
            },
            "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"
      },
      "FunctionResponseScheduling": {
         "description": "Specifies how the response should be scheduled in the conversation.",
         "enum": [
            "SCHEDULING_UNSPECIFIED",
            "SILENT",
            "WHEN_IDLE",
            "INTERRUPT"
         ],
         "title": "FunctionResponseScheduling",
         "type": "string"
      },
      "GenerateContentConfig": {
         "additionalProperties": false,
         "description": "Optional model configuration parameters.\n\nFor more information, see `Content generation parameters\n<https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/content-generation-parameters>`_.",
         "properties": {
            "httpOptions": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/HttpOptions"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Used to override HTTP request options."
            },
            "systemInstruction": {
               "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": "Instructions for the model to steer it toward better performance.\n      For example, \"Answer as concisely as possible\" or \"Don't use technical\n      terms in your response\".\n      ",
               "title": "Systeminstruction"
            },
            "temperature": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Value that controls the degree of randomness in token selection.\n      Lower temperatures are good for prompts that require a less open-ended or\n      creative response, while higher temperatures can lead to more diverse or\n      creative results.\n      ",
               "title": "Temperature"
            },
            "topP": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Tokens are selected from the most to least probable until the sum\n      of their probabilities equals this value. Use a lower value for less\n      random responses and a higher value for more random responses.\n      ",
               "title": "Topp"
            },
            "topK": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "For each token selection step, the ``top_k`` tokens with the\n      highest probabilities are sampled. Then tokens are further filtered based\n      on ``top_p`` with the final token selected using temperature sampling. Use\n      a lower number for less random responses and a higher number for more\n      random responses.\n      ",
               "title": "Topk"
            },
            "candidateCount": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Number of response variations to return.\n      ",
               "title": "Candidatecount"
            },
            "maxOutputTokens": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Maximum number of tokens that can be generated in the response.\n      ",
               "title": "Maxoutputtokens"
            },
            "stopSequences": {
               "anyOf": [
                  {
                     "items": {
                        "type": "string"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "List of strings that tells the model to stop generating text if one\n      of the strings is encountered in the response.\n      ",
               "title": "Stopsequences"
            },
            "responseLogprobs": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Whether to return the log probabilities of the tokens that were\n      chosen by the model at each step.\n      ",
               "title": "Responselogprobs"
            },
            "logprobs": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Number of top candidate tokens to return the log probabilities for\n      at each generation step.\n      ",
               "title": "Logprobs"
            },
            "presencePenalty": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Positive values penalize tokens that already appear in the\n      generated text, increasing the probability of generating more diverse\n      content.\n      ",
               "title": "Presencepenalty"
            },
            "frequencyPenalty": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Positive values penalize tokens that repeatedly appear in the\n      generated text, increasing the probability of generating more diverse\n      content.\n      ",
               "title": "Frequencypenalty"
            },
            "seed": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "When ``seed`` is fixed to a specific number, the model makes a best\n      effort to provide the same response for repeated requests. By default, a\n      random number is used.\n      ",
               "title": "Seed"
            },
            "responseMimeType": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Output response mimetype of the generated candidate text.\n      Supported mimetype:\n        - `text/plain`: (default) Text output.\n        - `application/json`: JSON response in the candidates.\n      The model needs to be prompted to output the appropriate response type,\n      otherwise the behavior is undefined.\n      This is a preview feature.\n      ",
               "title": "Responsemimetype"
            },
            "responseSchema": {
               "anyOf": [
                  {
                     "additionalProperties": true,
                     "type": "object"
                  },
                  {
                     "$ref": "#/$defs/Schema"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The `Schema` object allows the definition of input and output data types.\n      These types can be objects, but also primitives and arrays.\n      Represents a select subset of an [OpenAPI 3.0 schema\n      object](https://spec.openapis.org/oas/v3.0.3#schema).\n      If set, a compatible response_mime_type must also be set.\n      Compatible mimetypes: `application/json`: Schema for JSON response.\n      ",
               "title": "Responseschema"
            },
            "responseJsonSchema": {
               "anyOf": [
                  {},
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Output schema of the generated response.\n      This is an alternative to `response_schema` that accepts [JSON\n      Schema](https://json-schema.org/). If set, `response_schema` must be\n      omitted, but `response_mime_type` is required. While the full JSON Schema\n      may be sent, not all features are supported. Specifically, only the\n      following properties are supported: - `$id` - `$defs` - `$ref` - `$anchor`\n      - `type` - `format` - `title` - `description` - `enum` (for strings and\n      numbers) - `items` - `prefixItems` - `minItems` - `maxItems` - `minimum` -\n      `maximum` - `anyOf` - `oneOf` (interpreted the same as `anyOf`) -\n      `properties` - `additionalProperties` - `required` The non-standard\n      `propertyOrdering` property may also be set. Cyclic references are\n      unrolled to a limited degree and, as such, may only be used within\n      non-required properties. (Nullable properties are not sufficient.) If\n      `$ref` is set on a sub-schema, no other properties, except for than those\n      starting as a `$`, may be set.",
               "title": "Responsejsonschema"
            },
            "routingConfig": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/GenerationConfigRoutingConfig"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Configuration for model router requests.\n      "
            },
            "modelSelectionConfig": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/ModelSelectionConfig"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Configuration for model selection.\n      "
            },
            "safetySettings": {
               "anyOf": [
                  {
                     "items": {
                        "$ref": "#/$defs/SafetySetting"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Safety settings in the request to block unsafe content in the\n      response.\n      ",
               "title": "Safetysettings"
            },
            "tools": {
               "anyOf": [
                  {
                     "items": {
                        "anyOf": [
                           {
                              "$ref": "#/$defs/google__genai__types__Tool"
                           },
                           {
                              "$ref": "#/$defs/mcp__types__Tool"
                           }
                        ]
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Code that enables the system to interact with external systems to\n      perform an action outside of the knowledge and scope of the model.\n      ",
               "title": "Tools"
            },
            "toolConfig": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/ToolConfig"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Associates model output to a specific function call.\n      "
            },
            "labels": {
               "anyOf": [
                  {
                     "additionalProperties": {
                        "type": "string"
                     },
                     "type": "object"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Labels with user-defined metadata to break down billed charges.",
               "title": "Labels"
            },
            "cachedContent": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Resource name of a context cache that can be used in subsequent\n      requests.\n      ",
               "title": "Cachedcontent"
            },
            "responseModalities": {
               "anyOf": [
                  {
                     "items": {
                        "type": "string"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The requested modalities of the response. Represents the set of\n      modalities that the model can return.\n      ",
               "title": "Responsemodalities"
            },
            "mediaResolution": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/MediaResolution"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "If specified, the media resolution specified will be used.\n    "
            },
            "speechConfig": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "$ref": "#/$defs/SpeechConfig"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The speech generation configuration.\n      ",
               "title": "Speechconfig"
            },
            "audioTimestamp": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "If enabled, audio timestamp will be included in the request to the\n       model.\n      ",
               "title": "Audiotimestamp"
            },
            "automaticFunctionCalling": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/AutomaticFunctionCallingConfig"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The configuration for automatic function calling.\n      "
            },
            "thinkingConfig": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/ThinkingConfig"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The thinking features configuration.\n      "
            }
         },
         "title": "GenerateContentConfig",
         "type": "object"
      },
      "GenerationConfigRoutingConfig": {
         "additionalProperties": false,
         "description": "The configuration for routing the request to a specific model.",
         "properties": {
            "autoMode": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/GenerationConfigRoutingConfigAutoRoutingMode"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Automated routing."
            },
            "manualMode": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/GenerationConfigRoutingConfigManualRoutingMode"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Manual routing."
            }
         },
         "title": "GenerationConfigRoutingConfig",
         "type": "object"
      },
      "GenerationConfigRoutingConfigAutoRoutingMode": {
         "additionalProperties": false,
         "description": "When automated routing is specified, the routing will be determined by the pretrained routing model and customer provided model routing preference.",
         "properties": {
            "modelRoutingPreference": {
               "anyOf": [
                  {
                     "enum": [
                        "UNKNOWN",
                        "PRIORITIZE_QUALITY",
                        "BALANCED",
                        "PRIORITIZE_COST"
                     ],
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The model routing preference.",
               "title": "Modelroutingpreference"
            }
         },
         "title": "GenerationConfigRoutingConfigAutoRoutingMode",
         "type": "object"
      },
      "GenerationConfigRoutingConfigManualRoutingMode": {
         "additionalProperties": false,
         "description": "When manual routing is set, the specified model will be used directly.",
         "properties": {
            "modelName": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The model name to use. Only the public LLM models are accepted. See [Supported models](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/inference#supported-models).",
               "title": "Modelname"
            }
         },
         "title": "GenerationConfigRoutingConfigManualRoutingMode",
         "type": "object"
      },
      "GoogleMaps": {
         "additionalProperties": false,
         "description": "Tool to support Google Maps in Model.",
         "properties": {
            "authConfig": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/AuthConfig"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Auth config for the Google Maps tool."
            }
         },
         "title": "GoogleMaps",
         "type": "object"
      },
      "GoogleSearch": {
         "additionalProperties": false,
         "description": "Tool to support Google Search in Model. Powered by Google.",
         "properties": {
            "timeRangeFilter": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/Interval"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Filter search results to a specific time range.\n      If customers set a start time, they must set an end time (and vice versa).\n      "
            },
            "excludeDomains": {
               "anyOf": [
                  {
                     "items": {
                        "type": "string"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. List of domains to be excluded from the search results.\n      The default limit is 2000 domains.",
               "title": "Excludedomains"
            }
         },
         "title": "GoogleSearch",
         "type": "object"
      },
      "GoogleSearchRetrieval": {
         "additionalProperties": false,
         "description": "Tool to retrieve public web data for grounding, powered by Google.",
         "properties": {
            "dynamicRetrievalConfig": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/DynamicRetrievalConfig"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Specifies the dynamic retrieval configuration for the given source."
            }
         },
         "title": "GoogleSearchRetrieval",
         "type": "object"
      },
      "HarmBlockMethod": {
         "description": "Optional.\n\nSpecify if the threshold is used for probability or severity score. If not\nspecified, the threshold is used for probability score.",
         "enum": [
            "HARM_BLOCK_METHOD_UNSPECIFIED",
            "SEVERITY",
            "PROBABILITY"
         ],
         "title": "HarmBlockMethod",
         "type": "string"
      },
      "HarmBlockThreshold": {
         "description": "Required. The harm block threshold.",
         "enum": [
            "HARM_BLOCK_THRESHOLD_UNSPECIFIED",
            "BLOCK_LOW_AND_ABOVE",
            "BLOCK_MEDIUM_AND_ABOVE",
            "BLOCK_ONLY_HIGH",
            "BLOCK_NONE",
            "OFF"
         ],
         "title": "HarmBlockThreshold",
         "type": "string"
      },
      "HarmCategory": {
         "description": "Required. Harm category.",
         "enum": [
            "HARM_CATEGORY_UNSPECIFIED",
            "HARM_CATEGORY_HATE_SPEECH",
            "HARM_CATEGORY_DANGEROUS_CONTENT",
            "HARM_CATEGORY_HARASSMENT",
            "HARM_CATEGORY_SEXUALLY_EXPLICIT",
            "HARM_CATEGORY_CIVIC_INTEGRITY",
            "HARM_CATEGORY_IMAGE_HATE",
            "HARM_CATEGORY_IMAGE_DANGEROUS_CONTENT",
            "HARM_CATEGORY_IMAGE_HARASSMENT",
            "HARM_CATEGORY_IMAGE_SEXUALLY_EXPLICIT"
         ],
         "title": "HarmCategory",
         "type": "string"
      },
      "HttpOptions": {
         "additionalProperties": false,
         "description": "HTTP options to be used in each of the requests.",
         "properties": {
            "baseUrl": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The base URL for the AI platform service endpoint.",
               "title": "Baseurl"
            },
            "apiVersion": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Specifies the version of the API to use.",
               "title": "Apiversion"
            },
            "headers": {
               "anyOf": [
                  {
                     "additionalProperties": {
                        "type": "string"
                     },
                     "type": "object"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Additional HTTP headers to be sent with the request.",
               "title": "Headers"
            },
            "timeout": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Timeout for the request in milliseconds.",
               "title": "Timeout"
            },
            "clientArgs": {
               "anyOf": [
                  {
                     "additionalProperties": true,
                     "type": "object"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Args passed to the HTTP client.",
               "title": "Clientargs"
            },
            "asyncClientArgs": {
               "anyOf": [
                  {
                     "additionalProperties": true,
                     "type": "object"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Args passed to the async HTTP client.",
               "title": "Asyncclientargs"
            },
            "extraBody": {
               "anyOf": [
                  {
                     "additionalProperties": true,
                     "type": "object"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Extra parameters to add to the request body.\n      The structure must match the backend API's request structure.\n      - VertexAI backend API docs: https://cloud.google.com/vertex-ai/docs/reference/rest\n      - GeminiAPI backend API docs: https://ai.google.dev/api/rest",
               "title": "Extrabody"
            },
            "retryOptions": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/HttpRetryOptions"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "HTTP retry options for the request."
            }
         },
         "title": "HttpOptions",
         "type": "object"
      },
      "HttpRetryOptions": {
         "additionalProperties": false,
         "description": "HTTP retry options to be used in each of the requests.",
         "properties": {
            "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.",
               "title": "Attempts"
            },
            "initialDelay": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Initial delay before the first retry, in fractions of a second.",
               "title": "Initialdelay"
            },
            "maxDelay": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Maximum delay between retries, in fractions of a second.",
               "title": "Maxdelay"
            },
            "expBase": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Multiplier by which the delay increases after each attempt.",
               "title": "Expbase"
            },
            "jitter": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Randomness factor for the delay.",
               "title": "Jitter"
            },
            "httpStatusCodes": {
               "anyOf": [
                  {
                     "items": {
                        "type": "integer"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "List of HTTP status codes that should trigger a retry.\n      If not specified, a default set of retryable codes may be used.",
               "title": "Httpstatuscodes"
            }
         },
         "title": "HttpRetryOptions",
         "type": "object"
      },
      "Interval": {
         "additionalProperties": false,
         "description": "Represents a time interval, encoded as a start time (inclusive) and an end time (exclusive).\n\nThe start time must be less than or equal to the end time.\nWhen the start equals the end time, the interval is an empty interval.\n(matches no time)\nWhen both start and end are unspecified, the interval matches any time.",
         "properties": {
            "startTime": {
               "anyOf": [
                  {
                     "format": "date-time",
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The start time of the interval.",
               "title": "Starttime"
            },
            "endTime": {
               "anyOf": [
                  {
                     "format": "date-time",
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The end time of the interval.",
               "title": "Endtime"
            }
         },
         "title": "Interval",
         "type": "object"
      },
      "Language": {
         "description": "Required. Programming language of the `code`.",
         "enum": [
            "LANGUAGE_UNSPECIFIED",
            "PYTHON"
         ],
         "title": "Language",
         "type": "string"
      },
      "LatLng": {
         "additionalProperties": false,
         "description": "An object that represents a latitude/longitude pair.\n\nThis is expressed as a pair of doubles to represent degrees latitude and\ndegrees longitude. Unless specified otherwise, this object must conform to the\n<a href=\"https://en.wikipedia.org/wiki/World_Geodetic_System#1984_version\">\nWGS84 standard</a>. Values must be within normalized ranges.",
         "properties": {
            "latitude": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The latitude in degrees. It must be in the range [-90.0, +90.0].",
               "title": "Latitude"
            },
            "longitude": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The longitude in degrees. It must be in the range [-180.0, +180.0]",
               "title": "Longitude"
            }
         },
         "title": "LatLng",
         "type": "object"
      },
      "MediaResolution": {
         "description": "The media resolution to use.",
         "enum": [
            "MEDIA_RESOLUTION_UNSPECIFIED",
            "MEDIA_RESOLUTION_LOW",
            "MEDIA_RESOLUTION_MEDIUM",
            "MEDIA_RESOLUTION_HIGH"
         ],
         "title": "MediaResolution",
         "type": "string"
      },
      "ModelSelectionConfig": {
         "additionalProperties": false,
         "description": "Config for model selection.",
         "properties": {
            "featureSelectionPreference": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/FeatureSelectionPreference"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Options for feature selection preference."
            }
         },
         "title": "ModelSelectionConfig",
         "type": "object"
      },
      "MultiSpeakerVoiceConfig": {
         "additionalProperties": false,
         "description": "The configuration for the multi-speaker setup.",
         "properties": {
            "speakerVoiceConfigs": {
               "anyOf": [
                  {
                     "items": {
                        "$ref": "#/$defs/SpeakerVoiceConfig"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The configuration for the speaker to use.",
               "title": "Speakervoiceconfigs"
            }
         },
         "title": "MultiSpeakerVoiceConfig",
         "type": "object"
      },
      "Outcome": {
         "description": "Required. 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": {
            "videoMetadata": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/VideoMetadata"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Metadata for a given video."
            },
            "thought": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Indicates if the part is thought from the model.",
               "title": "Thought"
            },
            "inlineData": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/Blob"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Inlined bytes data."
            },
            "fileData": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/FileData"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. URI based data."
            },
            "thoughtSignature": {
               "anyOf": [
                  {
                     "format": "base64url",
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "An opaque signature for the thought so it can be reused in subsequent requests.",
               "title": "Thoughtsignature"
            },
            "codeExecutionResult": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/CodeExecutionResult"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Result of executing the [ExecutableCode]."
            },
            "executableCode": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/ExecutableCode"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Code generated by the model that is meant to be executed."
            },
            "functionCall": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/FunctionCall"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. A predicted [FunctionCall] returned from the model that contains a string representing the [FunctionDeclaration.name] with the parameters and their values."
            },
            "functionResponse": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/FunctionResponse"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. The result output of a [FunctionCall] that contains a string representing the [FunctionDeclaration.name] and a structured JSON object containing any output from the function call. It is used as context to the model."
            },
            "text": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Text part (can be code).",
               "title": "Text"
            }
         },
         "title": "Part",
         "type": "object"
      },
      "PrebuiltVoiceConfig": {
         "additionalProperties": false,
         "description": "The configuration for the prebuilt speaker to use.",
         "properties": {
            "voiceName": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The name of the prebuilt voice to use.",
               "title": "Voicename"
            }
         },
         "title": "PrebuiltVoiceConfig",
         "type": "object"
      },
      "RagRetrievalConfig": {
         "additionalProperties": false,
         "description": "Specifies the context retrieval config.",
         "properties": {
            "filter": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/RagRetrievalConfigFilter"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Config for filters."
            },
            "hybridSearch": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/RagRetrievalConfigHybridSearch"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Config for Hybrid Search."
            },
            "ranking": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/RagRetrievalConfigRanking"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Config for ranking and reranking."
            },
            "topK": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. The number of contexts to retrieve.",
               "title": "Topk"
            }
         },
         "title": "RagRetrievalConfig",
         "type": "object"
      },
      "RagRetrievalConfigFilter": {
         "additionalProperties": false,
         "description": "Config for filters.",
         "properties": {
            "metadataFilter": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. String for metadata filtering.",
               "title": "Metadatafilter"
            },
            "vectorDistanceThreshold": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Only returns contexts with vector distance smaller than the threshold.",
               "title": "Vectordistancethreshold"
            },
            "vectorSimilarityThreshold": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Only returns contexts with vector similarity larger than the threshold.",
               "title": "Vectorsimilaritythreshold"
            }
         },
         "title": "RagRetrievalConfigFilter",
         "type": "object"
      },
      "RagRetrievalConfigHybridSearch": {
         "additionalProperties": false,
         "description": "Config for Hybrid Search.",
         "properties": {
            "alpha": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Alpha value controls the weight between dense and sparse vector search results. The range is [0, 1], while 0 means sparse vector search only and 1 means dense vector search only. The default value is 0.5 which balances sparse and dense vector search equally.",
               "title": "Alpha"
            }
         },
         "title": "RagRetrievalConfigHybridSearch",
         "type": "object"
      },
      "RagRetrievalConfigRanking": {
         "additionalProperties": false,
         "description": "Config for ranking and reranking.",
         "properties": {
            "llmRanker": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/RagRetrievalConfigRankingLlmRanker"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Config for LlmRanker."
            },
            "rankService": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/RagRetrievalConfigRankingRankService"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Config for Rank Service."
            }
         },
         "title": "RagRetrievalConfigRanking",
         "type": "object"
      },
      "RagRetrievalConfigRankingLlmRanker": {
         "additionalProperties": false,
         "description": "Config for LlmRanker.",
         "properties": {
            "modelName": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. The model name used for ranking. See [Supported models](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/inference#supported-models).",
               "title": "Modelname"
            }
         },
         "title": "RagRetrievalConfigRankingLlmRanker",
         "type": "object"
      },
      "RagRetrievalConfigRankingRankService": {
         "additionalProperties": false,
         "description": "Config for Rank Service.",
         "properties": {
            "modelName": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. The model name of the rank service. Format: `semantic-ranker-512@latest`",
               "title": "Modelname"
            }
         },
         "title": "RagRetrievalConfigRankingRankService",
         "type": "object"
      },
      "Retrieval": {
         "additionalProperties": false,
         "description": "Defines a retrieval tool that model can call to access external knowledge.",
         "properties": {
            "disableAttribution": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Deprecated. This option is no longer supported.",
               "title": "Disableattribution"
            },
            "externalApi": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/ExternalApi"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Use data source powered by external API for grounding."
            },
            "vertexAiSearch": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/VertexAISearch"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Set to use data source powered by Vertex AI Search."
            },
            "vertexRagStore": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/VertexRagStore"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Set to use data source powered by Vertex RAG store. User data is uploaded via the VertexRagDataService."
            }
         },
         "title": "Retrieval",
         "type": "object"
      },
      "RetrievalConfig": {
         "additionalProperties": false,
         "description": "Retrieval config.",
         "properties": {
            "latLng": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/LatLng"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. The location of the user."
            },
            "languageCode": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The language code of the user.",
               "title": "Languagecode"
            }
         },
         "title": "RetrievalConfig",
         "type": "object"
      },
      "SafetySetting": {
         "additionalProperties": false,
         "description": "Safety settings.",
         "properties": {
            "method": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/HarmBlockMethod"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Determines if the harm block method uses probability or probability\n      and severity scores."
            },
            "category": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/HarmCategory"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Required. Harm category."
            },
            "threshold": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/HarmBlockThreshold"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Required. The harm block threshold."
            }
         },
         "title": "SafetySetting",
         "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 value should be validated against any (one or more) of the subschemas in the list.",
               "title": "Anyof"
            },
            "default": {
               "anyOf": [
                  {},
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Default value of the data.",
               "title": "Default"
            },
            "description": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. The description of the data.",
               "title": "Description"
            },
            "enum": {
               "anyOf": [
                  {
                     "items": {
                        "type": "string"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Possible values of the element of primitive type with enum format. Examples: 1. We can define direction as : {type:STRING, format:enum, enum:[\"EAST\", NORTH\", \"SOUTH\", \"WEST\"]} 2. We can define apartment number as : {type:INTEGER, format:enum, enum:[\"101\", \"201\", \"301\"]}",
               "title": "Enum"
            },
            "example": {
               "anyOf": [
                  {},
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Example of the object. Will only populated when the object is the root.",
               "title": "Example"
            },
            "format": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. The format of the data. Supported formats: for NUMBER type: \"float\", \"double\" for INTEGER type: \"int32\", \"int64\" for STRING type: \"email\", \"byte\", etc",
               "title": "Format"
            },
            "items": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/Schema"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. SCHEMA FIELDS FOR TYPE ARRAY Schema of the elements of Type.ARRAY."
            },
            "maxItems": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Maximum number of the elements for Type.ARRAY.",
               "title": "Maxitems"
            },
            "maxLength": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Maximum length of the Type.STRING",
               "title": "Maxlength"
            },
            "maxProperties": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Maximum number of the properties for Type.OBJECT.",
               "title": "Maxproperties"
            },
            "maximum": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Maximum value of the Type.INTEGER and Type.NUMBER",
               "title": "Maximum"
            },
            "minItems": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Minimum number of the elements for Type.ARRAY.",
               "title": "Minitems"
            },
            "minLength": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. SCHEMA FIELDS FOR TYPE STRING Minimum length of the Type.STRING",
               "title": "Minlength"
            },
            "minProperties": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Minimum number of the properties for Type.OBJECT.",
               "title": "Minproperties"
            },
            "minimum": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. SCHEMA FIELDS FOR TYPE INTEGER and NUMBER Minimum value of the Type.INTEGER and Type.NUMBER",
               "title": "Minimum"
            },
            "nullable": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Indicates if the value may be null.",
               "title": "Nullable"
            },
            "pattern": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Pattern of the Type.STRING to restrict a string to a regular expression.",
               "title": "Pattern"
            },
            "properties": {
               "anyOf": [
                  {
                     "additionalProperties": {
                        "$ref": "#/$defs/Schema"
                     },
                     "type": "object"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. SCHEMA FIELDS FOR TYPE OBJECT Properties of Type.OBJECT.",
               "title": "Properties"
            },
            "propertyOrdering": {
               "anyOf": [
                  {
                     "items": {
                        "type": "string"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. The order of the properties. Not a standard field in open api spec. Only used to support the order of the properties.",
               "title": "Propertyordering"
            },
            "required": {
               "anyOf": [
                  {
                     "items": {
                        "type": "string"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Required properties of Type.OBJECT.",
               "title": "Required"
            },
            "title": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. The title of the Schema.",
               "title": "Title"
            },
            "type": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/Type"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. The type of the data."
            }
         },
         "title": "Schema",
         "type": "object"
      },
      "SpeakerVoiceConfig": {
         "additionalProperties": false,
         "description": "The configuration for the speaker to use.",
         "properties": {
            "speaker": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The name of the speaker to use. Should be the same as in the\n          prompt.",
               "title": "Speaker"
            },
            "voiceConfig": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/VoiceConfig"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The configuration for the voice to use."
            }
         },
         "title": "SpeakerVoiceConfig",
         "type": "object"
      },
      "SpeechConfig": {
         "additionalProperties": false,
         "description": "The speech generation configuration.",
         "properties": {
            "voiceConfig": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/VoiceConfig"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The configuration for the speaker to use.\n      "
            },
            "multiSpeakerVoiceConfig": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/MultiSpeakerVoiceConfig"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The configuration for the multi-speaker setup.\n          It is mutually exclusive with the voice_config field.\n          "
            },
            "languageCode": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Language code (ISO 639. e.g. en-US) for the speech synthesization.\n      Only available for Live API.\n      ",
               "title": "Languagecode"
            }
         },
         "title": "SpeechConfig",
         "type": "object"
      },
      "ThinkingConfig": {
         "additionalProperties": false,
         "description": "The thinking features configuration.",
         "properties": {
            "includeThoughts": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Indicates whether to include thoughts in the response. If true, thoughts are returned only if the model supports thought and thoughts are available.\n      ",
               "title": "Includethoughts"
            },
            "thinkingBudget": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Indicates the thinking budget in tokens. 0 is DISABLED. -1 is AUTOMATIC. The default values and allowed ranges are model dependent.\n      ",
               "title": "Thinkingbudget"
            }
         },
         "title": "ThinkingConfig",
         "type": "object"
      },
      "ToolAnnotations": {
         "additionalProperties": true,
         "description": "Additional properties describing a Tool to clients.\n\nNOTE: all properties in ToolAnnotations are **hints**.\nThey are not guaranteed to provide a faithful description of\ntool behavior (including descriptive properties like `title`).\n\nClients should never make tool use decisions based on ToolAnnotations\nreceived from untrusted servers.",
         "properties": {
            "title": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Title"
            },
            "readOnlyHint": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Readonlyhint"
            },
            "destructiveHint": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Destructivehint"
            },
            "idempotentHint": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Idempotenthint"
            },
            "openWorldHint": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Openworldhint"
            }
         },
         "title": "ToolAnnotations",
         "type": "object"
      },
      "ToolCodeExecution": {
         "additionalProperties": false,
         "description": "Tool that executes code generated by the model, and automatically returns the result to the model.\n\nSee also [ExecutableCode]and [CodeExecutionResult] which are input and output\nto this tool.",
         "properties": {},
         "title": "ToolCodeExecution",
         "type": "object"
      },
      "ToolComputerUse": {
         "additionalProperties": false,
         "description": "Tool to support computer use.",
         "properties": {
            "environment": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/Environment"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Required. The environment being operated."
            }
         },
         "title": "ToolComputerUse",
         "type": "object"
      },
      "ToolConfig": {
         "additionalProperties": false,
         "description": "Tool config.\n\nThis config is shared for all tools provided in the request.",
         "properties": {
            "functionCallingConfig": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/FunctionCallingConfig"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Function calling config."
            },
            "retrievalConfig": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/RetrievalConfig"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Retrieval config."
            }
         },
         "title": "ToolConfig",
         "type": "object"
      },
      "Type": {
         "description": "Optional. The type of the data.",
         "enum": [
            "TYPE_UNSPECIFIED",
            "STRING",
            "NUMBER",
            "INTEGER",
            "BOOLEAN",
            "ARRAY",
            "OBJECT",
            "NULL"
         ],
         "title": "Type",
         "type": "string"
      },
      "UrlContext": {
         "additionalProperties": false,
         "description": "Tool to support URL context retrieval.",
         "properties": {},
         "title": "UrlContext",
         "type": "object"
      },
      "VertexAISearch": {
         "additionalProperties": false,
         "description": "Retrieve from Vertex AI Search datastore or engine for grounding.\n\ndatastore and engine are mutually exclusive. See\nhttps://cloud.google.com/products/agent-builder",
         "properties": {
            "dataStoreSpecs": {
               "anyOf": [
                  {
                     "items": {
                        "$ref": "#/$defs/VertexAISearchDataStoreSpec"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Specifications that define the specific DataStores to be searched, along with configurations for those data stores. This is only considered for Engines with multiple data stores. It should only be set if engine is used.",
               "title": "Datastorespecs"
            },
            "datastore": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Fully-qualified Vertex AI Search data store resource ID. Format: `projects/{project}/locations/{location}/collections/{collection}/dataStores/{dataStore}`",
               "title": "Datastore"
            },
            "engine": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Fully-qualified Vertex AI Search engine resource ID. Format: `projects/{project}/locations/{location}/collections/{collection}/engines/{engine}`",
               "title": "Engine"
            },
            "filter": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Filter strings to be passed to the search API.",
               "title": "Filter"
            },
            "maxResults": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Number of search results to return per query. The default value is 10. The maximumm allowed value is 10.",
               "title": "Maxresults"
            }
         },
         "title": "VertexAISearch",
         "type": "object"
      },
      "VertexAISearchDataStoreSpec": {
         "additionalProperties": false,
         "description": "Define data stores within engine to filter on in a search call and configurations for those data stores.\n\nFor more information, see\nhttps://cloud.google.com/generative-ai-app-builder/docs/reference/rpc/google.cloud.discoveryengine.v1#datastorespec",
         "properties": {
            "dataStore": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Full resource name of DataStore, such as Format: `projects/{project}/locations/{location}/collections/{collection}/dataStores/{dataStore}`",
               "title": "Datastore"
            },
            "filter": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Filter specification to filter documents in the data store specified by data_store field. For more information on filtering, see [Filtering](https://cloud.google.com/generative-ai-app-builder/docs/filter-search-metadata)",
               "title": "Filter"
            }
         },
         "title": "VertexAISearchDataStoreSpec",
         "type": "object"
      },
      "VertexRagStore": {
         "additionalProperties": false,
         "description": "Retrieve from Vertex RAG Store for grounding.",
         "properties": {
            "ragCorpora": {
               "anyOf": [
                  {
                     "items": {
                        "type": "string"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Deprecated. Please use rag_resources instead.",
               "title": "Ragcorpora"
            },
            "ragResources": {
               "anyOf": [
                  {
                     "items": {
                        "$ref": "#/$defs/VertexRagStoreRagResource"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. The representation of the rag source. It can be used to specify corpus only or ragfiles. Currently only support one corpus or multiple files from one corpus. In the future we may open up multiple corpora support.",
               "title": "Ragresources"
            },
            "ragRetrievalConfig": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/RagRetrievalConfig"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. The retrieval config for the Rag query."
            },
            "similarityTopK": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Number of top k results to return from the selected corpora.",
               "title": "Similaritytopk"
            },
            "storeContext": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Currently only supported for Gemini Multimodal Live API. In Gemini Multimodal Live API, if `store_context` bool is specified, Gemini will leverage it to automatically memorize the interactions between the client and Gemini, and retrieve context when needed to augment the response generation for users' ongoing and future interactions.",
               "title": "Storecontext"
            },
            "vectorDistanceThreshold": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Only return results with vector distance smaller than the threshold.",
               "title": "Vectordistancethreshold"
            }
         },
         "title": "VertexRagStore",
         "type": "object"
      },
      "VertexRagStoreRagResource": {
         "additionalProperties": false,
         "description": "The definition of the Rag resource.",
         "properties": {
            "ragCorpus": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. RagCorpora resource name. Format: `projects/{project}/locations/{location}/ragCorpora/{rag_corpus}`",
               "title": "Ragcorpus"
            },
            "ragFileIds": {
               "anyOf": [
                  {
                     "items": {
                        "type": "string"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. rag_file_id. The files should be in the same rag_corpus set in rag_corpus field.",
               "title": "Ragfileids"
            }
         },
         "title": "VertexRagStoreRagResource",
         "type": "object"
      },
      "VideoMetadata": {
         "additionalProperties": false,
         "description": "Describes how the video in the Part should be used by the model.",
         "properties": {
            "fps": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The frame rate of the video sent to the model. If not specified, the\n        default value will be 1.0. The fps range is (0.0, 24.0].",
               "title": "Fps"
            },
            "endOffset": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. The end offset of the video.",
               "title": "Endoffset"
            },
            "startOffset": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. The start offset of the video.",
               "title": "Startoffset"
            }
         },
         "title": "VideoMetadata",
         "type": "object"
      },
      "VoiceConfig": {
         "additionalProperties": false,
         "description": "The configuration for the voice to use.",
         "properties": {
            "prebuiltVoiceConfig": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/PrebuiltVoiceConfig"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The configuration for the speaker to use.\n      "
            }
         },
         "title": "VoiceConfig",
         "type": "object"
      },
      "google__genai__types__Tool": {
         "additionalProperties": false,
         "description": "Tool details of a tool that the model may use to generate a response.",
         "properties": {
            "functionDeclarations": {
               "anyOf": [
                  {
                     "items": {
                        "$ref": "#/$defs/FunctionDeclaration"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "List of function declarations that the tool supports.",
               "title": "Functiondeclarations"
            },
            "retrieval": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/Retrieval"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Retrieval tool type. System will always execute the provided retrieval tool(s) to get external knowledge to answer the prompt. Retrieval results are presented to the model for generation."
            },
            "googleSearch": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/GoogleSearch"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Google Search tool type. Specialized retrieval tool\n      that is powered by Google Search."
            },
            "googleSearchRetrieval": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/GoogleSearchRetrieval"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. GoogleSearchRetrieval tool type. Specialized retrieval tool that is powered by Google search."
            },
            "enterpriseWebSearch": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/EnterpriseWebSearch"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Enterprise web search tool type. Specialized retrieval\n      tool that is powered by Vertex AI Search and Sec4 compliance."
            },
            "googleMaps": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/GoogleMaps"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Google Maps tool type. Specialized retrieval tool\n      that is powered by Google Maps."
            },
            "urlContext": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/UrlContext"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Tool to support URL context retrieval."
            },
            "computerUse": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/ToolComputerUse"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Tool to support the model interacting directly with the\n      computer. If enabled, it automatically populates computer-use specific\n      Function Declarations."
            },
            "codeExecution": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/ToolCodeExecution"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. CodeExecution tool type. Enables the model to execute code as part of generation."
            }
         },
         "title": "Tool",
         "type": "object"
      },
      "mcp__types__Tool": {
         "additionalProperties": true,
         "description": "Definition for a tool the client can call.",
         "properties": {
            "name": {
               "title": "Name",
               "type": "string"
            },
            "title": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Title"
            },
            "description": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Description"
            },
            "inputSchema": {
               "additionalProperties": true,
               "title": "Inputschema",
               "type": "object"
            },
            "outputSchema": {
               "anyOf": [
                  {
                     "additionalProperties": true,
                     "type": "object"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Outputschema"
            },
            "annotations": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/ToolAnnotations"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "_meta": {
               "anyOf": [
                  {
                     "additionalProperties": true,
                     "type": "object"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Meta"
            }
         },
         "required": [
            "name",
            "inputSchema"
         ],
         "title": "Tool",
         "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])

  • model (Union[str, BaseLlm])

  • output_key (Optional[str])

  • output_schema (Optional[type[BaseModel]])

  • planner (Optional[BasePlanner])

  • tools (list[ToolUnion])

Validators:
  • __model_validator_after » all fields

  • validate_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

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

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

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

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

field disallow_transfer_to_parent: bool = False

Disallows LLM-controlled transferring to the parent agent.

NOTE: Setting this as True also prevents this agent to continue reply to the end-user. 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

field disallow_transfer_to_peers: bool = False

Disallows LLM-controlled transferring to the peer agents.

Validated by:
  • __model_validator_after

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 must be configured via planner in LlmAgent.

For example: use this config to adjust model temperature, configure safety settings, etc.

Validated by:
  • __model_validator_after

  • validate_generate_content_config

field global_instruction: Union[str, InstructionProvider] = ''

Instructions for all the agents in the entire agent tree.

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

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

field input_schema: Optional[type[BaseModel]] = None

The input schema when agent is used as a tool.

Validated by:
  • __model_validator_after

field instruction: Union[str, InstructionProvider] = ''

Instructions for the LLM model, guiding the agent’s behavior.

Validated by:
  • __model_validator_after

field model: Union[str, BaseLlm] = ''

The model to use for the agent.

When not set, the agent will inherit the model from its ancestor.

Validated by:
  • __model_validator_after

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

field output_schema: Optional[type[BaseModel]] = None

The output schema when agent replies.

Note

When this is set, agent can ONLY reply and CANNOT use any tools, such as function tools, RAGs, agent transfer, etc.

Validated by:
  • __model_validator_after

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

field tools: list[ToolUnion] [Optional]

Tools available to this agent.

Validated by:
  • __model_validator_after

config_type

alias of LlmAgentConfig

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]

property canonical_after_model_callbacks: list[Callable[[CallbackContext, 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], ToolContext, dict], Awaitable[dict | None] | dict | None] | list[Callable[[BaseTool, dict[str, Any], ToolContext, 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[[CallbackContext, 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], ToolContext], Awaitable[dict | None] | dict | None] | list[Callable[[BaseTool, dict[str, Any], ToolContext], 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_model: BaseLlm

The resolved self.model field as BaseLlm.

This method is only for use by Agent Development Kit.

pydantic model google.adk.agents.LoopAgent

Bases: BaseAgent

A 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.

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.",
   "type": "object",
   "properties": {
      "name": {
         "title": "Name",
         "type": "string"
      },
      "description": {
         "default": "",
         "title": "Description",
         "type": "string"
      },
      "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"
            },
            "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"
      }
   },
   "additionalProperties": false,
   "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.ParallelAgent

Bases: BaseAgent

A shell agent that run its sub-agents in parallel in isolated manner.

This approach is beneficial for scenarios requiring multiple perspectives or attempts on a single task, such as:

  • Running different algorithms simultaneously.

  • Generating multiple responses for review by a subsequent evaluation agent.

Show JSON schema
{
   "title": "ParallelAgent",
   "description": "A shell agent that run its sub-agents in parallel in isolated manner.\n\nThis approach is beneficial for scenarios requiring multiple perspectives or\nattempts on a single task, such as:\n\n- Running different algorithms simultaneously.\n- Generating multiple responses for review by a subsequent evaluation agent.",
   "type": "object",
   "properties": {
      "name": {
         "title": "Name",
         "type": "string"
      },
      "description": {
         "default": "",
         "title": "Description",
         "type": "string"
      },
      "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"
      }
   },
   "$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"
            },
            "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"
      }
   },
   "additionalProperties": false,
   "required": [
      "name"
   ]
}

Fields:

Validators:

config_type

alias of ParallelAgentConfig

pydantic model google.adk.agents.RunConfig

Bases: BaseModel

Configs for runtime behavior of agents.

Show JSON schema
{
   "title": "RunConfig",
   "description": "Configs for runtime behavior of agents.",
   "type": "object",
   "properties": {
      "speech_config": {
         "anyOf": [
            {
               "$ref": "#/$defs/SpeechConfig"
            },
            {
               "type": "null"
            }
         ],
         "default": null
      },
      "response_modalities": {
         "anyOf": [
            {
               "items": {
                  "type": "string"
               },
               "type": "array"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Response Modalities"
      },
      "save_input_blobs_as_artifacts": {
         "default": false,
         "title": "Save Input Blobs As Artifacts",
         "type": "boolean"
      },
      "support_cfc": {
         "default": false,
         "title": "Support Cfc",
         "type": "boolean"
      },
      "streaming_mode": {
         "$ref": "#/$defs/StreamingMode",
         "default": null
      },
      "output_audio_transcription": {
         "anyOf": [
            {
               "$ref": "#/$defs/AudioTranscriptionConfig"
            },
            {
               "type": "null"
            }
         ],
         "default": null
      },
      "input_audio_transcription": {
         "anyOf": [
            {
               "$ref": "#/$defs/AudioTranscriptionConfig"
            },
            {
               "type": "null"
            }
         ],
         "default": null
      },
      "realtime_input_config": {
         "anyOf": [
            {
               "$ref": "#/$defs/RealtimeInputConfig"
            },
            {
               "type": "null"
            }
         ],
         "default": null
      },
      "enable_affective_dialog": {
         "anyOf": [
            {
               "type": "boolean"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Enable Affective Dialog"
      },
      "proactivity": {
         "anyOf": [
            {
               "$ref": "#/$defs/ProactivityConfig"
            },
            {
               "type": "null"
            }
         ],
         "default": null
      },
      "session_resumption": {
         "anyOf": [
            {
               "$ref": "#/$defs/SessionResumptionConfig"
            },
            {
               "type": "null"
            }
         ],
         "default": null
      },
      "max_llm_calls": {
         "default": 500,
         "title": "Max Llm Calls",
         "type": "integer"
      }
   },
   "$defs": {
      "ActivityHandling": {
         "description": "The different ways of handling user activity.",
         "enum": [
            "ACTIVITY_HANDLING_UNSPECIFIED",
            "START_OF_ACTIVITY_INTERRUPTS",
            "NO_INTERRUPTION"
         ],
         "title": "ActivityHandling",
         "type": "string"
      },
      "AudioTranscriptionConfig": {
         "additionalProperties": false,
         "description": "The audio transcription configuration in Setup.",
         "properties": {},
         "title": "AudioTranscriptionConfig",
         "type": "object"
      },
      "AutomaticActivityDetection": {
         "additionalProperties": false,
         "description": "Configures automatic detection of activity.",
         "properties": {
            "disabled": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "If enabled, detected voice and text input count as activity. If disabled, the client must send activity signals.",
               "title": "Disabled"
            },
            "startOfSpeechSensitivity": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/StartSensitivity"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Determines how likely speech is to be detected."
            },
            "endOfSpeechSensitivity": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/EndSensitivity"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Determines how likely detected speech is ended."
            },
            "prefixPaddingMs": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The required duration of detected speech before start-of-speech is committed. The lower this value the more sensitive the start-of-speech detection is and the shorter speech can be recognized. However, this also increases the probability of false positives.",
               "title": "Prefixpaddingms"
            },
            "silenceDurationMs": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The required duration of detected non-speech (e.g. silence) before end-of-speech is committed. The larger this value, the longer speech gaps can be without interrupting the user's activity but this will increase the model's latency.",
               "title": "Silencedurationms"
            }
         },
         "title": "AutomaticActivityDetection",
         "type": "object"
      },
      "EndSensitivity": {
         "description": "End of speech sensitivity.",
         "enum": [
            "END_SENSITIVITY_UNSPECIFIED",
            "END_SENSITIVITY_HIGH",
            "END_SENSITIVITY_LOW"
         ],
         "title": "EndSensitivity",
         "type": "string"
      },
      "MultiSpeakerVoiceConfig": {
         "additionalProperties": false,
         "description": "The configuration for the multi-speaker setup.",
         "properties": {
            "speakerVoiceConfigs": {
               "anyOf": [
                  {
                     "items": {
                        "$ref": "#/$defs/SpeakerVoiceConfig"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The configuration for the speaker to use.",
               "title": "Speakervoiceconfigs"
            }
         },
         "title": "MultiSpeakerVoiceConfig",
         "type": "object"
      },
      "PrebuiltVoiceConfig": {
         "additionalProperties": false,
         "description": "The configuration for the prebuilt speaker to use.",
         "properties": {
            "voiceName": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The name of the prebuilt voice to use.",
               "title": "Voicename"
            }
         },
         "title": "PrebuiltVoiceConfig",
         "type": "object"
      },
      "ProactivityConfig": {
         "additionalProperties": false,
         "description": "Config for proactivity features.",
         "properties": {
            "proactiveAudio": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "If enabled, the model can reject responding to the last prompt. For\n        example, this allows the model to ignore out of context speech or to stay\n        silent if the user did not make a request, yet.",
               "title": "Proactiveaudio"
            }
         },
         "title": "ProactivityConfig",
         "type": "object"
      },
      "RealtimeInputConfig": {
         "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": {
            "automaticActivityDetection": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/AutomaticActivityDetection"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "If not set, automatic activity detection is enabled by default. If automatic voice detection is disabled, the client must send activity signals."
            },
            "activityHandling": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/ActivityHandling"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Defines what effect activity has."
            },
            "turnCoverage": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/TurnCoverage"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Defines which input is included in the user's turn."
            }
         },
         "title": "RealtimeInputConfig",
         "type": "object"
      },
      "SessionResumptionConfig": {
         "additionalProperties": false,
         "description": "Configuration of session resumption mechanism.\n\nIncluded in `LiveConnectConfig.session_resumption`. If included server\nwill send `LiveServerSessionResumptionUpdate` messages.",
         "properties": {
            "handle": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Session resumption handle of previous session (session to restore).\n\nIf not present new session will be started.",
               "title": "Handle"
            },
            "transparent": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "If set the server will send `last_consumed_client_message_index` in the `session_resumption_update` messages to allow for transparent reconnections.",
               "title": "Transparent"
            }
         },
         "title": "SessionResumptionConfig",
         "type": "object"
      },
      "SpeakerVoiceConfig": {
         "additionalProperties": false,
         "description": "The configuration for the speaker to use.",
         "properties": {
            "speaker": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The name of the speaker to use. Should be the same as in the\n          prompt.",
               "title": "Speaker"
            },
            "voiceConfig": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/VoiceConfig"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The configuration for the voice to use."
            }
         },
         "title": "SpeakerVoiceConfig",
         "type": "object"
      },
      "SpeechConfig": {
         "additionalProperties": false,
         "description": "The speech generation configuration.",
         "properties": {
            "voiceConfig": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/VoiceConfig"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The configuration for the speaker to use.\n      "
            },
            "multiSpeakerVoiceConfig": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/MultiSpeakerVoiceConfig"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The configuration for the multi-speaker setup.\n          It is mutually exclusive with the voice_config field.\n          "
            },
            "languageCode": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Language code (ISO 639. e.g. en-US) for the speech synthesization.\n      Only available for Live API.\n      ",
               "title": "Languagecode"
            }
         },
         "title": "SpeechConfig",
         "type": "object"
      },
      "StartSensitivity": {
         "description": "Start of speech sensitivity.",
         "enum": [
            "START_SENSITIVITY_UNSPECIFIED",
            "START_SENSITIVITY_HIGH",
            "START_SENSITIVITY_LOW"
         ],
         "title": "StartSensitivity",
         "type": "string"
      },
      "StreamingMode": {
         "enum": [
            null,
            "sse",
            "bidi"
         ],
         "title": "StreamingMode"
      },
      "TurnCoverage": {
         "description": "Options about which input is included in the user's turn.",
         "enum": [
            "TURN_COVERAGE_UNSPECIFIED",
            "TURN_INCLUDES_ONLY_ACTIVITY",
            "TURN_INCLUDES_ALL_INPUT"
         ],
         "title": "TurnCoverage",
         "type": "string"
      },
      "VoiceConfig": {
         "additionalProperties": false,
         "description": "The configuration for the voice to use.",
         "properties": {
            "prebuiltVoiceConfig": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/PrebuiltVoiceConfig"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The configuration for the speaker to use.\n      "
            }
         },
         "title": "VoiceConfig",
         "type": "object"
      }
   },
   "additionalProperties": false
}

Fields:
  • enable_affective_dialog (bool | None)

  • input_audio_transcription (google.genai.types.AudioTranscriptionConfig | None)

  • max_llm_calls (int)

  • output_audio_transcription (google.genai.types.AudioTranscriptionConfig | None)

  • proactivity (google.genai.types.ProactivityConfig | None)

  • realtime_input_config (google.genai.types.RealtimeInputConfig | None)

  • response_modalities (list[str] | None)

  • save_input_blobs_as_artifacts (bool)

  • session_resumption (google.genai.types.SessionResumptionConfig | None)

  • speech_config (google.genai.types.SpeechConfig | None)

  • streaming_mode (google.adk.agents.run_config.StreamingMode)

  • support_cfc (bool)

Validators:
  • validate_max_llm_calls » max_llm_calls

field enable_affective_dialog: Optional[bool] = None

If enabled, the model will detect emotions and adapt its responses accordingly.

field input_audio_transcription: Optional[types.AudioTranscriptionConfig] = None

Input transcription for live agents with audio input from user.

field max_llm_calls: int = 500

A limit on the total number of llm calls for a given run.

Valid Values:
  • More than 0 and less than sys.maxsize: The bound on the number of llm calls is enforced, if the value is set in this range.

  • Less than or equal to 0: This allows for unbounded number of llm calls.

Validated by:
  • validate_max_llm_calls

field output_audio_transcription: Optional[types.AudioTranscriptionConfig] = None

Output transcription for live agents with audio response.

field proactivity: Optional[types.ProactivityConfig] = None

Configures the proactivity of the model. This allows the model to respond proactively to the input and to ignore irrelevant input.

field realtime_input_config: Optional[types.RealtimeInputConfig] = None

Realtime input config for live agents with audio input from user.

field response_modalities: Optional[list[str]] = None

The output modalities. If not set, it’s default to AUDIO.

field save_input_blobs_as_artifacts: bool = False

Whether or not to save the input blobs as artifacts.

field session_resumption: Optional[types.SessionResumptionConfig] = None

Configures session resumption mechanism. Only support transparent session resumption mode now.

field speech_config: Optional[types.SpeechConfig] = None

Speech configuration for the live agent.

field streaming_mode: StreamingMode = StreamingMode.NONE

Streaming mode, None or StreamingMode.SSE or StreamingMode.BIDI.

field support_cfc: bool = False

Whether to support CFC (Compositional Function Calling). Only applicable for StreamingMode.SSE. If it’s true. the LIVE API will be invoked. Since only LIVE API supports CFC

Warning

This feature is experimental and its API or behavior may change in future releases.

validator validate_max_llm_calls  »  max_llm_calls
Return type:

int

pydantic model google.adk.agents.SequentialAgent

Bases: BaseAgent

A shell agent that runs its sub-agents in sequence.

Show JSON schema
{
   "title": "SequentialAgent",
   "description": "A shell agent that runs its sub-agents in sequence.",
   "type": "object",
   "properties": {
      "name": {
         "title": "Name",
         "type": "string"
      },
      "description": {
         "default": "",
         "title": "Description",
         "type": "string"
      },
      "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"
      }
   },
   "$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"
            },
            "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"
      }
   },
   "additionalProperties": false,
   "required": [
      "name"
   ]
}

Fields:

Validators:

config_type

alias of SequentialAgentConfig

google.adk.artifacts module

class google.adk.artifacts.BaseArtifactService

Bases: ABC

Abstract base class for artifact services.

abstractmethod async delete_artifact(*, app_name, user_id, session_id, filename)

Deletes an artifact.

Return type:

None

Parameters:
  • app_name – The name of the application.

  • user_id – The ID of the user.

  • session_id – The ID of the session.

  • filename – The name of the artifact file.

abstractmethod async list_artifact_keys(*, app_name, user_id, session_id)

Lists all the artifact filenames within a session.

Return type:

list[str]

Parameters:
  • app_name – The name of the application.

  • user_id – The ID of the user.

  • session_id – The ID of the session.

Returns:

A list of all artifact filenames within a session.

abstractmethod async list_versions(*, app_name, user_id, session_id, filename)

Lists all versions of an artifact.

Return type:

list[int]

Parameters:
  • app_name – The name of the application.

  • user_id – The ID of the user.

  • session_id – The ID of the session.

  • filename – The name of the artifact file.

Returns:

A list of all available versions of the artifact.

abstractmethod async load_artifact(*, app_name, user_id, session_id, filename, version=None)

Gets an artifact from the artifact service storage.

The artifact is a file identified by the app name, user ID, session ID, and filename.

Return type:

Optional[Part]

Parameters:
  • app_name – The app name.

  • user_id – The user ID.

  • session_id – The session ID.

  • filename – The filename of the artifact.

  • version – The version of the artifact. If None, the latest version will be returned.

Returns:

The artifact or None if not found.

abstractmethod async save_artifact(*, app_name, user_id, session_id, filename, artifact)

Saves an artifact to the artifact service storage.

The artifact is a file identified by the app name, user ID, session ID, and filename. After saving the artifact, a revision ID is returned to identify the artifact version.

Return type:

int

Parameters:
  • app_name – The app name.

  • user_id – The user ID.

  • session_id – The session ID.

  • filename – The filename of the artifact.

  • artifact – The artifact to save.

Returns:

The revision ID. The first version of the artifact has a revision ID of 0. This is incremented by 1 after each successful save.

class google.adk.artifacts.GcsArtifactService(bucket_name, **kwargs)

Bases: BaseArtifactService

An artifact service implementation using Google Cloud Storage (GCS).

Initializes the GcsArtifactService.

Parameters:
  • bucket_name – The name of the bucket to use.

  • **kwargs – Keyword arguments to pass to the Google Cloud Storage client.

async delete_artifact(*, app_name, user_id, session_id, filename)

Deletes an artifact.

Return type:

None

Parameters:
  • app_name – The name of the application.

  • user_id – The ID of the user.

  • session_id – The ID of the session.

  • filename – The name of the artifact file.

async list_artifact_keys(*, app_name, user_id, session_id)

Lists all the artifact filenames within a session.

Return type:

list[str]

Parameters:
  • app_name – The name of the application.

  • user_id – The ID of the user.

  • session_id – The ID of the session.

Returns:

A list of all artifact filenames within a session.

async list_versions(*, app_name, user_id, session_id, filename)

Lists all versions of an artifact.

Return type:

list[int]

Parameters:
  • app_name – The name of the application.

  • user_id – The ID of the user.

  • session_id – The ID of the session.

  • filename – The name of the artifact file.

Returns:

A list of all available versions of the artifact.

async load_artifact(*, app_name, user_id, session_id, filename, version=None)

Gets an artifact from the artifact service storage.

The artifact is a file identified by the app name, user ID, session ID, and filename.

Return type:

Optional[Part]

Parameters:
  • app_name – The app name.

  • user_id – The user ID.

  • session_id – The session ID.

  • filename – The filename of the artifact.

  • version – The version of the artifact. If None, the latest version will be returned.

Returns:

The artifact or None if not found.

async save_artifact(*, app_name, user_id, session_id, filename, artifact)

Saves an artifact to the artifact service storage.

The artifact is a file identified by the app name, user ID, session ID, and filename. After saving the artifact, a revision ID is returned to identify the artifact version.

Return type:

int

Parameters:
  • app_name – The app name.

  • user_id – The user ID.

  • session_id – The session ID.

  • filename – The filename of the artifact.

  • artifact – The artifact to save.

Returns:

The revision ID. The first version of the artifact has a revision ID of 0. This is incremented by 1 after each successful save.

pydantic model google.adk.artifacts.InMemoryArtifactService

Bases: BaseArtifactService, BaseModel

An in-memory implementation of the artifact service.

It is not suitable for multi-threaded production environments. Use it for testing and development only.

Show JSON schema
{
   "title": "InMemoryArtifactService",
   "description": "An in-memory implementation of the artifact service.\n\nIt is not suitable for multi-threaded production environments. Use it for\ntesting and development only.",
   "type": "object",
   "properties": {
      "artifacts": {
         "additionalProperties": {
            "items": {
               "$ref": "#/$defs/Part"
            },
            "type": "array"
         },
         "title": "Artifacts",
         "type": "object"
      }
   },
   "$defs": {
      "Blob": {
         "additionalProperties": false,
         "description": "Content blob.",
         "properties": {
            "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 not currently used in the Gemini GenerateContent calls.",
               "title": "Displayname"
            },
            "data": {
               "anyOf": [
                  {
                     "format": "base64url",
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Required. Raw bytes.",
               "title": "Data"
            },
            "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\nOnly generated when using the [CodeExecution] tool, and always follows a\n`part` containing the [ExecutableCode].",
         "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"
            }
         },
         "title": "CodeExecutionResult",
         "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`."
            }
         },
         "title": "ExecutableCode",
         "type": "object"
      },
      "FileData": {
         "additionalProperties": false,
         "description": "URI based data.",
         "properties": {
            "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. It is not currently used in the Gemini GenerateContent calls.",
               "title": "Displayname"
            },
            "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"
            }
         },
         "title": "FileData",
         "type": "object"
      },
      "FunctionCall": {
         "additionalProperties": false,
         "description": "A function call.",
         "properties": {
            "id": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The unique id of the function call. If populated, the client to execute the\n   `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": "Required. The name of the function to call. Matches [FunctionDeclaration.name].",
               "title": "Name"
            }
         },
         "title": "FunctionCall",
         "type": "object"
      },
      "FunctionResponse": {
         "additionalProperties": false,
         "description": "A function response.",
         "properties": {
            "willContinue": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "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 (see FunctionDeclaration.behavior for details), ignored otherwise. If false, the default, future responses will not be considered. 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.",
               "title": "Willcontinue"
            },
            "scheduling": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/FunctionResponseScheduling"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Specifies how the response should be scheduled in the conversation. Only applicable to NON_BLOCKING function calls, is ignored otherwise. Defaults to WHEN_IDLE."
            },
            "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"
      },
      "FunctionResponseScheduling": {
         "description": "Specifies how the response should be scheduled in the conversation.",
         "enum": [
            "SCHEDULING_UNSPECIFIED",
            "SILENT",
            "WHEN_IDLE",
            "INTERRUPT"
         ],
         "title": "FunctionResponseScheduling",
         "type": "string"
      },
      "Language": {
         "description": "Required. Programming language of the `code`.",
         "enum": [
            "LANGUAGE_UNSPECIFIED",
            "PYTHON"
         ],
         "title": "Language",
         "type": "string"
      },
      "Outcome": {
         "description": "Required. 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": {
            "videoMetadata": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/VideoMetadata"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Metadata for a given video."
            },
            "thought": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Indicates if the part is thought from the model.",
               "title": "Thought"
            },
            "inlineData": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/Blob"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Inlined bytes data."
            },
            "fileData": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/FileData"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. URI based data."
            },
            "thoughtSignature": {
               "anyOf": [
                  {
                     "format": "base64url",
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "An opaque signature for the thought so it can be reused in subsequent requests.",
               "title": "Thoughtsignature"
            },
            "codeExecutionResult": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/CodeExecutionResult"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Result of executing the [ExecutableCode]."
            },
            "executableCode": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/ExecutableCode"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Code generated by the model that is meant to be executed."
            },
            "functionCall": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/FunctionCall"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. A predicted [FunctionCall] returned from the model that contains a string representing the [FunctionDeclaration.name] with the parameters and their values."
            },
            "functionResponse": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/FunctionResponse"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. The result output of a [FunctionCall] that contains a string representing the [FunctionDeclaration.name] and a structured JSON object containing any output from the function call. It is used as context to the model."
            },
            "text": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Text part (can be code).",
               "title": "Text"
            }
         },
         "title": "Part",
         "type": "object"
      },
      "VideoMetadata": {
         "additionalProperties": false,
         "description": "Describes how the video in the Part should be used by the model.",
         "properties": {
            "fps": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The frame rate of the video sent to the model. If not specified, the\n        default value will be 1.0. The fps range is (0.0, 24.0].",
               "title": "Fps"
            },
            "endOffset": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. The end offset of the video.",
               "title": "Endoffset"
            },
            "startOffset": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. The start offset of the video.",
               "title": "Startoffset"
            }
         },
         "title": "VideoMetadata",
         "type": "object"
      }
   }
}

Fields:
  • artifacts (dict[str, list[google.genai.types.Part]])

field artifacts: dict[str, list[types.Part]] [Optional]
async delete_artifact(*, app_name, user_id, session_id, filename)

Deletes an artifact.

Return type:

None

Parameters:
  • app_name – The name of the application.

  • user_id – The ID of the user.

  • session_id – The ID of the session.

  • filename – The name of the artifact file.

async list_artifact_keys(*, app_name, user_id, session_id)

Lists all the artifact filenames within a session.

Return type:

list[str]

Parameters:
  • app_name – The name of the application.

  • user_id – The ID of the user.

  • session_id – The ID of the session.

Returns:

A list of all artifact filenames within a session.

async list_versions(*, app_name, user_id, session_id, filename)

Lists all versions of an artifact.

Return type:

list[int]

Parameters:
  • app_name – The name of the application.

  • user_id – The ID of the user.

  • session_id – The ID of the session.

  • filename – The name of the artifact file.

Returns:

A list of all available versions of the artifact.

async load_artifact(*, app_name, user_id, session_id, filename, version=None)

Gets an artifact from the artifact service storage.

The artifact is a file identified by the app name, user ID, session ID, and filename.

Return type:

Optional[Part]

Parameters:
  • app_name – The app name.

  • user_id – The user ID.

  • session_id – The session ID.

  • filename – The filename of the artifact.

  • version – The version of the artifact. If None, the latest version will be returned.

Returns:

The artifact or None if not found.

async save_artifact(*, app_name, user_id, session_id, filename, artifact)

Saves an artifact to the artifact service storage.

The artifact is a file identified by the app name, user ID, session ID, and filename. After saving the artifact, a revision ID is returned to identify the artifact version.

Return type:

int

Parameters:
  • app_name – The app name.

  • user_id – The user ID.

  • session_id – The session ID.

  • filename – The filename of the artifact.

  • artifact – The artifact to save.

Returns:

The revision ID. The first version of the artifact has a revision ID of 0. This is incremented by 1 after each successful save.

google.adk.auth module

google.adk.cli module

google.adk.code_executors module

pydantic model google.adk.code_executors.BaseCodeExecutor

Bases: BaseModel

Abstract base class for all code executors.

The code executor allows the agent to execute code blocks from model responses and incorporate the execution results into the final response.

optimize_data_file

If true, extract and process data files from the model request and attach them to the code executor. Supported data file MimeTypes are [text/csv]. Default to False.

stateful

Whether the code executor is stateful. Default to False.

error_retry_attempts

The number of attempts to retry on consecutive code execution errors. Default to 2.

code_block_delimiters

The list of the enclosing delimiters to identify the code blocks.

execution_result_delimiters

The delimiters to format the code execution result.

Show JSON schema
{
   "title": "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.",
   "type": "object",
   "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"
      }
   }
}

Fields:
  • code_block_delimiters (List[tuple[str, str]])

  • error_retry_attempts (int)

  • execution_result_delimiters (tuple[str, str])

  • optimize_data_file (bool)

  • stateful (bool)

field code_block_delimiters: List[tuple[str, str]] = [('```tool_code\n', '\n```'), ('```python\n', '\n```')]

The list of the enclosing delimiters to identify the code blocks.

For example, the delimiter (’`python\n', '\n`’) can be used to identify code blocks with the following format:

```python
print("hello")
```
field error_retry_attempts: int = 2

The number of attempts to retry on consecutive code execution errors. Default to 2.

field execution_result_delimiters: tuple[str, str] = ('```tool_output\n', '\n```')

The delimiters to format the code execution result.

field optimize_data_file: bool = False

If true, extract and process data files from the model request and attach them to the code executor.

Supported data file MimeTypes are [text/csv]. Default to False.

field stateful: bool = False

Whether the code executor is stateful. Default to False.

abstractmethod execute_code(invocation_context, code_execution_input)

Executes code and return the code execution result.

Return type:

CodeExecutionResult

Parameters:
  • invocation_context – The invocation context of the code execution.

  • code_execution_input – The code execution input.

Returns:

The code execution result.

pydantic model google.adk.code_executors.BuiltInCodeExecutor

Bases: BaseCodeExecutor

A code executor that uses the Model’s built-in code executor.

Currently only supports Gemini 2.0+ models, but will be expanded to other models.

Show JSON schema
{
   "title": "BuiltInCodeExecutor",
   "description": "A code executor that uses the Model's built-in code executor.\n\nCurrently only supports Gemini 2.0+ models, but will be expanded to\nother models.",
   "type": "object",
   "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"
      }
   }
}

Fields:

execute_code(invocation_context, code_execution_input)

Executes code and return the code execution result.

Return type:

CodeExecutionResult

Parameters:
  • invocation_context – The invocation context of the code execution.

  • code_execution_input – The code execution input.

Returns:

The code execution result.

process_llm_request(llm_request)

Pre-process the LLM request for Gemini 2.0+ models to use the code execution tool.

Return type:

None

class google.adk.code_executors.CodeExecutorContext(session_state)

Bases: object

The persistent context used to configure the code executor.

Initializes the code executor context.

Parameters:

session_state – The session state to get the code executor context from.

add_input_files(input_files)

Adds the input files to the code executor context.

Parameters:

input_files – The input files to add to the code executor context.

add_processed_file_names(file_names)

Adds the processed file name to the session state.

Parameters:

file_names – The processed file names to add to the session state.

clear_input_files()

Removes the input files and processed file names to the code executor context.

get_error_count(invocation_id)

Gets the error count from the session state.

Return type:

int

Parameters:

invocation_id – The invocation ID to get the error count for.

Returns:

The error count for the given invocation ID.

get_execution_id()

Gets the session ID for the code executor.

Return type:

Optional[str]

Returns:

The session ID for the code executor context.

get_input_files()

Gets the code executor input file names from the session state.

Return type:

list[File]

Returns:

A list of input files in the code executor context.

get_processed_file_names()

Gets the processed file names from the session state.

Return type:

list[str]

Returns:

A list of processed file names in the code executor context.

get_state_delta()

Gets the state delta to update in the persistent session state.

Return type:

dict[str, Any]

Returns:

The state delta to update in the persistent session state.

increment_error_count(invocation_id)

Increments the error count from the session state.

Parameters:

invocation_id – The invocation ID to increment the error count for.

reset_error_count(invocation_id)

Resets the error count from the session state.

Parameters:

invocation_id – The invocation ID to reset the error count for.

set_execution_id(session_id)

Sets the session ID for the code executor.

Parameters:

session_id – The session ID for the code executor.

update_code_execution_result(invocation_id, code, result_stdout, result_stderr)

Updates the code execution result.

Parameters:
  • invocation_id – The invocation ID to update the code execution result for.

  • code – The code to execute.

  • result_stdout – The standard output of the code execution.

  • result_stderr – The standard error of the code execution.

pydantic model google.adk.code_executors.UnsafeLocalCodeExecutor

Bases: BaseCodeExecutor

A code executor that unsafely execute code in the current local context.

Initializes the UnsafeLocalCodeExecutor.

Show JSON schema
{
   "title": "UnsafeLocalCodeExecutor",
   "description": "A code executor that unsafely execute code in the current local context.",
   "type": "object",
   "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"
      }
   }
}

Fields:
  • optimize_data_file (bool)

  • stateful (bool)

field optimize_data_file: bool = False

If true, extract and process data files from the model request and attach them to the code executor.

Supported data file MimeTypes are [text/csv]. Default to False.

field stateful: bool = False

Whether the code executor is stateful. Default to False.

execute_code(invocation_context, code_execution_input)

Executes code and return the code execution result.

Return type:

CodeExecutionResult

Parameters:
  • invocation_context – The invocation context of the code execution.

  • code_execution_input – The code execution input.

Returns:

The code execution result.

google.adk.errors module

google.adk.evaluation module

class google.adk.evaluation.AgentEvaluator

Bases: object

An evaluator for Agents, mainly intended for helping with test cases.

async static evaluate(agent_module, eval_dataset_file_path_or_dir, num_runs=2, agent_name=None, initial_session_file=None, print_detailed_results=True)

Evaluates an Agent given eval data.

Parameters:
  • agent_module – The path to python module that contains the definition of the agent. There is convention in place here, where the code is going to look for ‘root_agent’ in the loaded module.

  • eval_dataset_file_path_or_dir – The eval data set. This can be either a string representing full path to the file containing eval dataset, or a directory that is recursively explored for all files that have a .test.json suffix.

  • num_runs – Number of times all entries in the eval dataset should be assessed.

  • agent_name – The name of the agent.

  • initial_session_file – File that contains initial session state that is needed by all the evals in the eval dataset.

  • print_detailed_results – Whether to print detailed results for each metric evaluation.

async static evaluate_eval_set(agent_module, eval_set, criteria, num_runs=2, agent_name=None, print_detailed_results=True)

Evaluates an agent using the given EvalSet.

Parameters:
  • agent_module – The path to python module that contains the definition of the agent. There is convention in place here, where the code is going to look for ‘root_agent’ in the loaded module.

  • eval_set – The eval set.

  • criteria – Evauation criterias, a dictionary of metric names to their respective thresholds.

  • num_runs – Number of times all entries in the eval dataset should be assessed.

  • agent_name – The name of the agent, if trying to evaluate something other than root agent. If left empty or none, then root agent is evaluated.

  • print_detailed_results – Whether to print detailed results for each metric evaluation.

static find_config_for_test_file(test_file)

Find the test_config.json file in the same folder as the test file.

static migrate_eval_data_to_new_schema(old_eval_data_file, new_eval_data_file, initial_session_file=None)

A utility for migrating eval data to new schema backed by EvalSet.

google.adk.events module

pydantic model google.adk.events.Event

Bases: LlmResponse

Represents an event in a conversation between agents and users.

It is used to store the content of the conversation, as well as the actions taken by the agents like function calls, etc.

invocation_id

Required. The invocation ID of the event. Should be non-empty before appending to a session.

author

Required. “user” or the name of the agent, indicating who appended the event to the session.

actions

The actions taken by the agent.

long_running_tool_ids

The ids of the long running function calls.

branch

The branch of the event.

id

The unique identifier of the event.

timestamp

The timestamp of the event.

get_function_calls

Returns the function calls in the event.

Show JSON schema
{
   "title": "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.\n\nAttributes:\n  invocation_id: Required. The invocation ID of the event. Should be non-empty\n    before appending to a session.\n  author: Required. \"user\" or the name of the agent, indicating who appended\n    the event to the session.\n  actions: The actions taken by the agent.\n  long_running_tool_ids: The ids of the long running function calls.\n  branch: The branch of the event.\n  id: The unique identifier of the event.\n  timestamp: The timestamp of the event.\n  get_function_calls: Returns the function calls in the event.",
   "type": "object",
   "properties": {
      "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"
      },
      "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
      },
      "inputTranscription": {
         "anyOf": [
            {
               "$ref": "#/$defs/Transcription"
            },
            {
               "type": "null"
            }
         ],
         "default": null
      },
      "outputTranscription": {
         "anyOf": [
            {
               "$ref": "#/$defs/Transcription"
            },
            {
               "type": "null"
            }
         ],
         "default": null
      },
      "invocationId": {
         "default": "",
         "title": "Invocationid",
         "type": "string"
      },
      "author": {
         "title": "Author",
         "type": "string"
      },
      "actions": {
         "$ref": "#/$defs/EventActions"
      },
      "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"
      },
      "id": {
         "default": "",
         "title": "Id",
         "type": "string"
      },
      "timestamp": {
         "title": "Timestamp",
         "type": "number"
      }
   },
   "$defs": {
      "APIKey": {
         "additionalProperties": true,
         "properties": {
            "type": {
               "$ref": "#/$defs/SecuritySchemeType",
               "default": "apiKey"
            },
            "description": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Description"
            },
            "in": {
               "$ref": "#/$defs/APIKeyIn"
            },
            "name": {
               "title": "Name",
               "type": "string"
            }
         },
         "required": [
            "in",
            "name"
         ],
         "title": "APIKey",
         "type": "object"
      },
      "APIKeyIn": {
         "enum": [
            "query",
            "header",
            "cookie"
         ],
         "title": "APIKeyIn",
         "type": "string"
      },
      "AuthConfig": {
         "additionalProperties": true,
         "description": "The auth config sent by tool asking client to collect auth credentials and\n\nadk and client will help to fill in the response",
         "properties": {
            "authScheme": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/APIKey"
                  },
                  {
                     "$ref": "#/$defs/HTTPBase"
                  },
                  {
                     "$ref": "#/$defs/OAuth2"
                  },
                  {
                     "$ref": "#/$defs/OpenIdConnect"
                  },
                  {
                     "$ref": "#/$defs/HTTPBearer"
                  },
                  {
                     "$ref": "#/$defs/OpenIdConnectWithConfig"
                  }
               ],
               "title": "Authscheme"
            },
            "rawAuthCredential": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/AuthCredential"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "exchangedAuthCredential": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/AuthCredential"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "credentialKey": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Credentialkey"
            }
         },
         "required": [
            "authScheme"
         ],
         "title": "AuthConfig",
         "type": "object"
      },
      "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"
      },
      "Blob": {
         "additionalProperties": false,
         "description": "Content blob.",
         "properties": {
            "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 not currently used in the Gemini GenerateContent calls.",
               "title": "Displayname"
            },
            "data": {
               "anyOf": [
                  {
                     "format": "base64url",
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Required. Raw bytes.",
               "title": "Data"
            },
            "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\nOnly generated when using the [CodeExecution] tool, and always follows a\n`part` containing the [ExecutableCode].",
         "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"
            }
         },
         "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\n      'model'. Useful to set for multi-turn conversations, otherwise can be\n      empty. If role is not specified, SDK will determine the role.",
               "title": "Role"
            }
         },
         "title": "Content",
         "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": {
                  "$ref": "#/$defs/AuthConfig"
               },
               "title": "Requestedauthconfigs",
               "type": "object"
            },
            "requestedToolConfirmations": {
               "additionalProperties": {
                  "$ref": "#/$defs/ToolConfirmation"
               },
               "title": "Requestedtoolconfirmations",
               "type": "object"
            }
         },
         "title": "EventActions",
         "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`."
            }
         },
         "title": "ExecutableCode",
         "type": "object"
      },
      "FileData": {
         "additionalProperties": false,
         "description": "URI based data.",
         "properties": {
            "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. It is not currently used in the Gemini GenerateContent calls.",
               "title": "Displayname"
            },
            "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"
            }
         },
         "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"
         ],
         "title": "FinishReason",
         "type": "string"
      },
      "FunctionCall": {
         "additionalProperties": false,
         "description": "A function call.",
         "properties": {
            "id": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The unique id of the function call. If populated, the client to execute the\n   `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": "Required. The name of the function to call. Matches [FunctionDeclaration.name].",
               "title": "Name"
            }
         },
         "title": "FunctionCall",
         "type": "object"
      },
      "FunctionResponse": {
         "additionalProperties": false,
         "description": "A function response.",
         "properties": {
            "willContinue": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "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 (see FunctionDeclaration.behavior for details), ignored otherwise. If false, the default, future responses will not be considered. 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.",
               "title": "Willcontinue"
            },
            "scheduling": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/FunctionResponseScheduling"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Specifies how the response should be scheduled in the conversation. Only applicable to NON_BLOCKING function calls, is ignored otherwise. Defaults to WHEN_IDLE."
            },
            "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"
      },
      "FunctionResponseScheduling": {
         "description": "Specifies how the response should be scheduled in the conversation.",
         "enum": [
            "SCHEDULING_UNSPECIFIED",
            "SILENT",
            "WHEN_IDLE",
            "INTERRUPT"
         ],
         "title": "FunctionResponseScheduling",
         "type": "string"
      },
      "GenerateContentResponseUsageMetadata": {
         "additionalProperties": false,
         "description": "Usage metadata about response(s).",
         "properties": {
            "cacheTokensDetails": {
               "anyOf": [
                  {
                     "items": {
                        "$ref": "#/$defs/ModalityTokenCount"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Output only. List of modalities of the cached content in the request input.",
               "title": "Cachetokensdetails"
            },
            "cachedContentTokenCount": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Output only. Number of tokens in the cached part in the input (the cached content).",
               "title": "Cachedcontenttokencount"
            },
            "candidatesTokenCount": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Number of tokens in the response(s).",
               "title": "Candidatestokencount"
            },
            "candidatesTokensDetails": {
               "anyOf": [
                  {
                     "items": {
                        "$ref": "#/$defs/ModalityTokenCount"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Output only. List of modalities that were returned in the response.",
               "title": "Candidatestokensdetails"
            },
            "promptTokenCount": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Number of tokens in the request. When `cached_content` is set, this is still the total effective prompt size meaning this 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. List of modalities that were processed in the request input.",
               "title": "Prompttokensdetails"
            },
            "thoughtsTokenCount": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Output only. Number of tokens present in thoughts output.",
               "title": "Thoughtstokencount"
            },
            "toolUsePromptTokenCount": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Output only. Number of tokens present in tool-use prompt(s).",
               "title": "Tooluseprompttokencount"
            },
            "toolUsePromptTokensDetails": {
               "anyOf": [
                  {
                     "items": {
                        "$ref": "#/$defs/ModalityTokenCount"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Output only. List of modalities that were processed for tool-use request inputs.",
               "title": "Tooluseprompttokensdetails"
            },
            "totalTokenCount": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Total token count for prompt, response candidates, and tool-use prompts (if present).",
               "title": "Totaltokencount"
            },
            "trafficType": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/TrafficType"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Output only. Traffic type. This shows whether a request consumes Pay-As-You-Go or Provisioned Throughput quota."
            }
         },
         "title": "GenerateContentResponseUsageMetadata",
         "type": "object"
      },
      "GroundingChunk": {
         "additionalProperties": false,
         "description": "Grounding chunk.",
         "properties": {
            "maps": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/GroundingChunkMaps"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Grounding chunk from Google Maps."
            },
            "retrievedContext": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/GroundingChunkRetrievedContext"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Grounding chunk from context retrieved by the retrieval tools."
            },
            "web": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/GroundingChunkWeb"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Grounding chunk from the web."
            }
         },
         "title": "GroundingChunk",
         "type": "object"
      },
      "GroundingChunkMaps": {
         "additionalProperties": false,
         "description": "Chunk from Google Maps.",
         "properties": {
            "placeAnswerSources": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/GroundingChunkMapsPlaceAnswerSources"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Sources used to generate the place answer. This includes review snippets and photos that were used to generate the 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. Can be used to look up the Place.",
               "title": "Placeid"
            },
            "text": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Text of the chunk.",
               "title": "Text"
            },
            "title": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Title of the chunk.",
               "title": "Title"
            },
            "uri": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "URI reference of the chunk.",
               "title": "Uri"
            }
         },
         "title": "GroundingChunkMaps",
         "type": "object"
      },
      "GroundingChunkMapsPlaceAnswerSources": {
         "additionalProperties": false,
         "description": "Sources used to generate the place answer.",
         "properties": {
            "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 are 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"
            }
         },
         "title": "GroundingChunkMapsPlaceAnswerSourcesReviewSnippet",
         "type": "object"
      },
      "GroundingChunkRetrievedContext": {
         "additionalProperties": false,
         "description": "Chunk from context retrieved by the retrieval tools.",
         "properties": {
            "documentName": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Output only. The full document name for the referenced Vertex AI Search document.",
               "title": "Documentname"
            },
            "ragChunk": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/RagChunk"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Additional context for the RAG retrieval result. This is only populated when using the RAG retrieval tool."
            },
            "text": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Text of the attribution.",
               "title": "Text"
            },
            "title": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Title of the attribution.",
               "title": "Title"
            },
            "uri": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "URI reference of the attribution.",
               "title": "Uri"
            }
         },
         "title": "GroundingChunkRetrievedContext",
         "type": "object"
      },
      "GroundingChunkWeb": {
         "additionalProperties": false,
         "description": "Chunk from the web.",
         "properties": {
            "domain": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Domain of the (original) URI.",
               "title": "Domain"
            },
            "title": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Title of the chunk.",
               "title": "Title"
            },
            "uri": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "URI reference of the chunk.",
               "title": "Uri"
            }
         },
         "title": "GroundingChunkWeb",
         "type": "object"
      },
      "GroundingMetadata": {
         "additionalProperties": false,
         "description": "Metadata returned to client when grounding is enabled.",
         "properties": {
            "googleMapsWidgetContextToken": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Output only. Resource name of the Google Maps widget context token to be used with the PlacesContextElement widget to render contextual data. This is populated only for Google Maps grounding.",
               "title": "Googlemapswidgetcontexttoken"
            },
            "groundingChunks": {
               "anyOf": [
                  {
                     "items": {
                        "$ref": "#/$defs/GroundingChunk"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "List of supporting references retrieved from specified grounding source.",
               "title": "Groundingchunks"
            },
            "groundingSupports": {
               "anyOf": [
                  {
                     "items": {
                        "$ref": "#/$defs/GroundingSupport"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. List of grounding support.",
               "title": "Groundingsupports"
            },
            "retrievalMetadata": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/RetrievalMetadata"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Output only. Retrieval metadata."
            },
            "retrievalQueries": {
               "anyOf": [
                  {
                     "items": {
                        "type": "string"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Queries executed by the retrieval tools.",
               "title": "Retrievalqueries"
            },
            "searchEntryPoint": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/SearchEntryPoint"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Google search entry for the following-up web searches."
            },
            "webSearchQueries": {
               "anyOf": [
                  {
                     "items": {
                        "type": "string"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Web search queries for the following-up web search.",
               "title": "Websearchqueries"
            }
         },
         "title": "GroundingMetadata",
         "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. Ranges from 0 to 1. 1 is the most confident. For Gemini 2.0 and before, this list must have the same size as the grounding_chunk_indices. For Gemini 2.5 and after, this list will be empty and should be ignored.",
               "title": "Confidencescores"
            },
            "groundingChunkIndices": {
               "anyOf": [
                  {
                     "items": {
                        "type": "integer"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "A list of indices (into 'grounding_chunk') specifying the citations associated with the claim. For instance [1,3,4] means that grounding_chunk[1], grounding_chunk[3], grounding_chunk[4] are the 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."
            }
         },
         "title": "GroundingSupport",
         "type": "object"
      },
      "HTTPBase": {
         "additionalProperties": true,
         "properties": {
            "type": {
               "$ref": "#/$defs/SecuritySchemeType",
               "default": "http"
            },
            "description": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Description"
            },
            "scheme": {
               "title": "Scheme",
               "type": "string"
            }
         },
         "required": [
            "scheme"
         ],
         "title": "HTTPBase",
         "type": "object"
      },
      "HTTPBearer": {
         "additionalProperties": true,
         "properties": {
            "type": {
               "$ref": "#/$defs/SecuritySchemeType",
               "default": "http"
            },
            "description": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Description"
            },
            "scheme": {
               "const": "bearer",
               "default": "bearer",
               "title": "Scheme",
               "type": "string"
            },
            "bearerFormat": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Bearerformat"
            }
         },
         "title": "HTTPBearer",
         "type": "object"
      },
      "HttpAuth": {
         "additionalProperties": true,
         "description": "The credentials and metadata for HTTP authentication.",
         "properties": {
            "scheme": {
               "title": "Scheme",
               "type": "string"
            },
            "credentials": {
               "$ref": "#/$defs/HttpCredentials"
            }
         },
         "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": "Required. Programming language of the `code`.",
         "enum": [
            "LANGUAGE_UNSPECIFIED",
            "PYTHON"
         ],
         "title": "Language",
         "type": "string"
      },
      "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 `SessionResmumptionTokenUpdate`. 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 arelikely not needed.",
               "title": "Lastconsumedclientmessageindex"
            }
         },
         "title": "LiveServerSessionResumptionUpdate",
         "type": "object"
      },
      "MediaModality": {
         "description": "Server content modalities.",
         "enum": [
            "MODALITY_UNSPECIFIED",
            "TEXT",
            "IMAGE",
            "VIDEO",
            "AUDIO",
            "DOCUMENT"
         ],
         "title": "MediaModality",
         "type": "string"
      },
      "ModalityTokenCount": {
         "additionalProperties": false,
         "description": "Represents token counting info for a single modality.",
         "properties": {
            "modality": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/MediaModality"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The modality associated with this token count."
            },
            "tokenCount": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Number of tokens.",
               "title": "Tokencount"
            }
         },
         "title": "ModalityTokenCount",
         "type": "object"
      },
      "OAuth2": {
         "additionalProperties": true,
         "properties": {
            "type": {
               "$ref": "#/$defs/SecuritySchemeType",
               "default": "oauth2"
            },
            "description": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Description"
            },
            "flows": {
               "$ref": "#/$defs/OAuthFlows"
            }
         },
         "required": [
            "flows"
         ],
         "title": "OAuth2",
         "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"
            },
            "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"
            },
            "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"
            }
         },
         "title": "OAuth2Auth",
         "type": "object"
      },
      "OAuthFlowAuthorizationCode": {
         "additionalProperties": true,
         "properties": {
            "refreshUrl": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Refreshurl"
            },
            "scopes": {
               "additionalProperties": {
                  "type": "string"
               },
               "default": {},
               "title": "Scopes",
               "type": "object"
            },
            "authorizationUrl": {
               "title": "Authorizationurl",
               "type": "string"
            },
            "tokenUrl": {
               "title": "Tokenurl",
               "type": "string"
            }
         },
         "required": [
            "authorizationUrl",
            "tokenUrl"
         ],
         "title": "OAuthFlowAuthorizationCode",
         "type": "object"
      },
      "OAuthFlowClientCredentials": {
         "additionalProperties": true,
         "properties": {
            "refreshUrl": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Refreshurl"
            },
            "scopes": {
               "additionalProperties": {
                  "type": "string"
               },
               "default": {},
               "title": "Scopes",
               "type": "object"
            },
            "tokenUrl": {
               "title": "Tokenurl",
               "type": "string"
            }
         },
         "required": [
            "tokenUrl"
         ],
         "title": "OAuthFlowClientCredentials",
         "type": "object"
      },
      "OAuthFlowImplicit": {
         "additionalProperties": true,
         "properties": {
            "refreshUrl": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Refreshurl"
            },
            "scopes": {
               "additionalProperties": {
                  "type": "string"
               },
               "default": {},
               "title": "Scopes",
               "type": "object"
            },
            "authorizationUrl": {
               "title": "Authorizationurl",
               "type": "string"
            }
         },
         "required": [
            "authorizationUrl"
         ],
         "title": "OAuthFlowImplicit",
         "type": "object"
      },
      "OAuthFlowPassword": {
         "additionalProperties": true,
         "properties": {
            "refreshUrl": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Refreshurl"
            },
            "scopes": {
               "additionalProperties": {
                  "type": "string"
               },
               "default": {},
               "title": "Scopes",
               "type": "object"
            },
            "tokenUrl": {
               "title": "Tokenurl",
               "type": "string"
            }
         },
         "required": [
            "tokenUrl"
         ],
         "title": "OAuthFlowPassword",
         "type": "object"
      },
      "OAuthFlows": {
         "additionalProperties": true,
         "properties": {
            "implicit": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/OAuthFlowImplicit"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "password": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/OAuthFlowPassword"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "clientCredentials": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/OAuthFlowClientCredentials"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "authorizationCode": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/OAuthFlowAuthorizationCode"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            }
         },
         "title": "OAuthFlows",
         "type": "object"
      },
      "OpenIdConnect": {
         "additionalProperties": true,
         "properties": {
            "type": {
               "$ref": "#/$defs/SecuritySchemeType",
               "default": "openIdConnect"
            },
            "description": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Description"
            },
            "openIdConnectUrl": {
               "title": "Openidconnecturl",
               "type": "string"
            }
         },
         "required": [
            "openIdConnectUrl"
         ],
         "title": "OpenIdConnect",
         "type": "object"
      },
      "OpenIdConnectWithConfig": {
         "additionalProperties": true,
         "properties": {
            "type": {
               "$ref": "#/$defs/SecuritySchemeType",
               "default": "openIdConnect"
            },
            "description": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Description"
            },
            "authorization_endpoint": {
               "title": "Authorization Endpoint",
               "type": "string"
            },
            "token_endpoint": {
               "title": "Token Endpoint",
               "type": "string"
            },
            "userinfo_endpoint": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Userinfo Endpoint"
            },
            "revocation_endpoint": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Revocation Endpoint"
            },
            "token_endpoint_auth_methods_supported": {
               "anyOf": [
                  {
                     "items": {
                        "type": "string"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Token Endpoint Auth Methods Supported"
            },
            "grant_types_supported": {
               "anyOf": [
                  {
                     "items": {
                        "type": "string"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Grant Types Supported"
            },
            "scopes": {
               "anyOf": [
                  {
                     "items": {
                        "type": "string"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Scopes"
            }
         },
         "required": [
            "authorization_endpoint",
            "token_endpoint"
         ],
         "title": "OpenIdConnectWithConfig",
         "type": "object"
      },
      "Outcome": {
         "description": "Required. 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": {
            "videoMetadata": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/VideoMetadata"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Metadata for a given video."
            },
            "thought": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Indicates if the part is thought from the model.",
               "title": "Thought"
            },
            "inlineData": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/Blob"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Inlined bytes data."
            },
            "fileData": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/FileData"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. URI based data."
            },
            "thoughtSignature": {
               "anyOf": [
                  {
                     "format": "base64url",
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "An opaque signature for the thought so it can be reused in subsequent requests.",
               "title": "Thoughtsignature"
            },
            "codeExecutionResult": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/CodeExecutionResult"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Result of executing the [ExecutableCode]."
            },
            "executableCode": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/ExecutableCode"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Code generated by the model that is meant to be executed."
            },
            "functionCall": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/FunctionCall"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. A predicted [FunctionCall] returned from the model that contains a string representing the [FunctionDeclaration.name] with the parameters and their values."
            },
            "functionResponse": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/FunctionResponse"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. The result output of a [FunctionCall] that contains a string representing the [FunctionDeclaration.name] and a structured JSON object containing any output from the function call. It is used as context to the model."
            },
            "text": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Text part (can be code).",
               "title": "Text"
            }
         },
         "title": "Part",
         "type": "object"
      },
      "RagChunk": {
         "additionalProperties": false,
         "description": "A RagChunk includes the content of a chunk of a RagFile, and associated metadata.",
         "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"
            }
         },
         "title": "RagChunk",
         "type": "object"
      },
      "RagChunkPageSpan": {
         "additionalProperties": false,
         "description": "Represents where the chunk starts and ends in the document.",
         "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"
      },
      "RetrievalMetadata": {
         "additionalProperties": false,
         "description": "Metadata related to retrieval in the grounding flow.",
         "properties": {
            "googleSearchDynamicRetrievalScore": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Score indicating how likely information from Google Search could help answer the prompt. The score is in the range `[0, 1]`, where 0 is the least likely and 1 is the most likely. This score is only populated when Google Search grounding and dynamic retrieval is enabled. It will be compared to the threshold to determine whether to trigger Google Search.",
               "title": "Googlesearchdynamicretrievalscore"
            }
         },
         "title": "RetrievalMetadata",
         "type": "object"
      },
      "SearchEntryPoint": {
         "additionalProperties": false,
         "description": "Google search entry point.",
         "properties": {
            "renderedContent": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Web content snippet that can be embedded in a web page or an app webview.",
               "title": "Renderedcontent"
            },
            "sdkBlob": {
               "anyOf": [
                  {
                     "format": "base64url",
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Base64 encoded JSON representing array of tuple.",
               "title": "Sdkblob"
            }
         },
         "title": "SearchEntryPoint",
         "type": "object"
      },
      "SecuritySchemeType": {
         "enum": [
            "apiKey",
            "http",
            "oauth2",
            "openIdConnect"
         ],
         "title": "SecuritySchemeType",
         "type": "string"
      },
      "Segment": {
         "additionalProperties": false,
         "description": "Segment of the content.",
         "properties": {
            "endIndex": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Output only. End index in the given Part, measured in bytes. 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 Content object.",
               "title": "Partindex"
            },
            "startIndex": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Output only. Start index in the given Part, measured in bytes. Offset from the start of the Part, inclusive, starting at zero.",
               "title": "Startindex"
            },
            "text": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Output only. The text corresponding to the segment from the response.",
               "title": "Text"
            }
         },
         "title": "Segment",
         "type": "object"
      },
      "ServiceAccount": {
         "additionalProperties": true,
         "description": "Represents Google Service Account configuration.",
         "properties": {
            "serviceAccountCredential": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/ServiceAccountCredential"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "scopes": {
               "items": {
                  "type": "string"
               },
               "title": "Scopes",
               "type": "array"
            },
            "useDefaultCredential": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": false,
               "title": "Usedefaultcredential"
            }
         },
         "required": [
            "scopes"
         ],
         "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"
      },
      "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"
      },
      "TrafficType": {
         "description": "Output only.\n\nTraffic type. This shows whether a request consumes Pay-As-You-Go or\nProvisioned Throughput quota.",
         "enum": [
            "TRAFFIC_TYPE_UNSPECIFIED",
            "ON_DEMAND",
            "PROVISIONED_THROUGHPUT"
         ],
         "title": "TrafficType",
         "type": "string"
      },
      "Transcription": {
         "additionalProperties": false,
         "description": "Audio transcription in Server Conent.",
         "properties": {
            "text": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Transcription text.\n      ",
               "title": "Text"
            },
            "finished": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The bool indicates the end of the transcription.\n      ",
               "title": "Finished"
            }
         },
         "title": "Transcription",
         "type": "object"
      },
      "VideoMetadata": {
         "additionalProperties": false,
         "description": "Describes how the video in the Part should be used by the model.",
         "properties": {
            "fps": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The frame rate of the video sent to the model. If not specified, the\n        default value will be 1.0. The fps range is (0.0, 24.0].",
               "title": "Fps"
            },
            "endOffset": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. The end offset of the video.",
               "title": "Endoffset"
            },
            "startOffset": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. The start offset of the video.",
               "title": "Startoffset"
            }
         },
         "title": "VideoMetadata",
         "type": "object"
      }
   },
   "additionalProperties": false,
   "required": [
      "author"
   ]
}

Fields:
  • actions (google.adk.events.event_actions.EventActions)

  • author (str)

  • branch (str | None)

  • id (str)

  • invocation_id (str)

  • long_running_tool_ids (set[str] | None)

  • timestamp (float)

field actions: EventActions [Optional]

The actions taken by the agent.

field author: str [Required]

‘user’ or the name of the agent, indicating who appended the event to the session.

field branch: Optional[str] = None

The branch of the event.

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-agent shouldn’t see their peer agents’ conversation history.

field id: str = ''

The unique identifier of the event.

field invocation_id: str = '' (alias 'invocationId')

The invocation ID of the event. Should be non-empty before appending to a session.

field long_running_tool_ids: Optional[set[str]] = None (alias 'longRunningToolIds')

Set of ids of the long running function calls. Agent client will know from this field about which function call is long running. only valid for function call event

field timestamp: float [Optional]

The timestamp of the event.

static new_id()
get_function_calls()

Returns the function calls in the event.

Return type:

list[FunctionCall]

get_function_responses()

Returns the function responses in the event.

Return type:

list[FunctionResponse]

has_trailing_code_execution_result()

Returns whether the event has a trailing code execution result.

Return type:

bool

is_final_response()

Returns whether the event is the final response of an agent.

NOTE: This method is ONLY for use by Agent Development Kit.

Note that when multiple agents participage in one invocation, there could be one event has is_final_response() as True for each participating agent.

Return type:

bool

model_post_init(_Event__context)

Post initialization logic for the event.

pydantic model google.adk.events.EventActions

Bases: BaseModel

Represents the actions attached to an event.

Show JSON schema
{
   "title": "EventActions",
   "description": "Represents the actions attached to an event.",
   "type": "object",
   "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": {
            "$ref": "#/$defs/AuthConfig"
         },
         "title": "Requestedauthconfigs",
         "type": "object"
      },
      "requestedToolConfirmations": {
         "additionalProperties": {
            "$ref": "#/$defs/ToolConfirmation"
         },
         "title": "Requestedtoolconfirmations",
         "type": "object"
      }
   },
   "$defs": {
      "APIKey": {
         "additionalProperties": true,
         "properties": {
            "type": {
               "$ref": "#/$defs/SecuritySchemeType",
               "default": "apiKey"
            },
            "description": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Description"
            },
            "in": {
               "$ref": "#/$defs/APIKeyIn"
            },
            "name": {
               "title": "Name",
               "type": "string"
            }
         },
         "required": [
            "in",
            "name"
         ],
         "title": "APIKey",
         "type": "object"
      },
      "APIKeyIn": {
         "enum": [
            "query",
            "header",
            "cookie"
         ],
         "title": "APIKeyIn",
         "type": "string"
      },
      "AuthConfig": {
         "additionalProperties": true,
         "description": "The auth config sent by tool asking client to collect auth credentials and\n\nadk and client will help to fill in the response",
         "properties": {
            "authScheme": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/APIKey"
                  },
                  {
                     "$ref": "#/$defs/HTTPBase"
                  },
                  {
                     "$ref": "#/$defs/OAuth2"
                  },
                  {
                     "$ref": "#/$defs/OpenIdConnect"
                  },
                  {
                     "$ref": "#/$defs/HTTPBearer"
                  },
                  {
                     "$ref": "#/$defs/OpenIdConnectWithConfig"
                  }
               ],
               "title": "Authscheme"
            },
            "rawAuthCredential": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/AuthCredential"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "exchangedAuthCredential": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/AuthCredential"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "credentialKey": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Credentialkey"
            }
         },
         "required": [
            "authScheme"
         ],
         "title": "AuthConfig",
         "type": "object"
      },
      "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"
      },
      "HTTPBase": {
         "additionalProperties": true,
         "properties": {
            "type": {
               "$ref": "#/$defs/SecuritySchemeType",
               "default": "http"
            },
            "description": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Description"
            },
            "scheme": {
               "title": "Scheme",
               "type": "string"
            }
         },
         "required": [
            "scheme"
         ],
         "title": "HTTPBase",
         "type": "object"
      },
      "HTTPBearer": {
         "additionalProperties": true,
         "properties": {
            "type": {
               "$ref": "#/$defs/SecuritySchemeType",
               "default": "http"
            },
            "description": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Description"
            },
            "scheme": {
               "const": "bearer",
               "default": "bearer",
               "title": "Scheme",
               "type": "string"
            },
            "bearerFormat": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Bearerformat"
            }
         },
         "title": "HTTPBearer",
         "type": "object"
      },
      "HttpAuth": {
         "additionalProperties": true,
         "description": "The credentials and metadata for HTTP authentication.",
         "properties": {
            "scheme": {
               "title": "Scheme",
               "type": "string"
            },
            "credentials": {
               "$ref": "#/$defs/HttpCredentials"
            }
         },
         "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"
      },
      "OAuth2": {
         "additionalProperties": true,
         "properties": {
            "type": {
               "$ref": "#/$defs/SecuritySchemeType",
               "default": "oauth2"
            },
            "description": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Description"
            },
            "flows": {
               "$ref": "#/$defs/OAuthFlows"
            }
         },
         "required": [
            "flows"
         ],
         "title": "OAuth2",
         "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"
            },
            "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"
            },
            "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"
            }
         },
         "title": "OAuth2Auth",
         "type": "object"
      },
      "OAuthFlowAuthorizationCode": {
         "additionalProperties": true,
         "properties": {
            "refreshUrl": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Refreshurl"
            },
            "scopes": {
               "additionalProperties": {
                  "type": "string"
               },
               "default": {},
               "title": "Scopes",
               "type": "object"
            },
            "authorizationUrl": {
               "title": "Authorizationurl",
               "type": "string"
            },
            "tokenUrl": {
               "title": "Tokenurl",
               "type": "string"
            }
         },
         "required": [
            "authorizationUrl",
            "tokenUrl"
         ],
         "title": "OAuthFlowAuthorizationCode",
         "type": "object"
      },
      "OAuthFlowClientCredentials": {
         "additionalProperties": true,
         "properties": {
            "refreshUrl": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Refreshurl"
            },
            "scopes": {
               "additionalProperties": {
                  "type": "string"
               },
               "default": {},
               "title": "Scopes",
               "type": "object"
            },
            "tokenUrl": {
               "title": "Tokenurl",
               "type": "string"
            }
         },
         "required": [
            "tokenUrl"
         ],
         "title": "OAuthFlowClientCredentials",
         "type": "object"
      },
      "OAuthFlowImplicit": {
         "additionalProperties": true,
         "properties": {
            "refreshUrl": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Refreshurl"
            },
            "scopes": {
               "additionalProperties": {
                  "type": "string"
               },
               "default": {},
               "title": "Scopes",
               "type": "object"
            },
            "authorizationUrl": {
               "title": "Authorizationurl",
               "type": "string"
            }
         },
         "required": [
            "authorizationUrl"
         ],
         "title": "OAuthFlowImplicit",
         "type": "object"
      },
      "OAuthFlowPassword": {
         "additionalProperties": true,
         "properties": {
            "refreshUrl": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Refreshurl"
            },
            "scopes": {
               "additionalProperties": {
                  "type": "string"
               },
               "default": {},
               "title": "Scopes",
               "type": "object"
            },
            "tokenUrl": {
               "title": "Tokenurl",
               "type": "string"
            }
         },
         "required": [
            "tokenUrl"
         ],
         "title": "OAuthFlowPassword",
         "type": "object"
      },
      "OAuthFlows": {
         "additionalProperties": true,
         "properties": {
            "implicit": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/OAuthFlowImplicit"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "password": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/OAuthFlowPassword"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "clientCredentials": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/OAuthFlowClientCredentials"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "authorizationCode": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/OAuthFlowAuthorizationCode"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            }
         },
         "title": "OAuthFlows",
         "type": "object"
      },
      "OpenIdConnect": {
         "additionalProperties": true,
         "properties": {
            "type": {
               "$ref": "#/$defs/SecuritySchemeType",
               "default": "openIdConnect"
            },
            "description": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Description"
            },
            "openIdConnectUrl": {
               "title": "Openidconnecturl",
               "type": "string"
            }
         },
         "required": [
            "openIdConnectUrl"
         ],
         "title": "OpenIdConnect",
         "type": "object"
      },
      "OpenIdConnectWithConfig": {
         "additionalProperties": true,
         "properties": {
            "type": {
               "$ref": "#/$defs/SecuritySchemeType",
               "default": "openIdConnect"
            },
            "description": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Description"
            },
            "authorization_endpoint": {
               "title": "Authorization Endpoint",
               "type": "string"
            },
            "token_endpoint": {
               "title": "Token Endpoint",
               "type": "string"
            },
            "userinfo_endpoint": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Userinfo Endpoint"
            },
            "revocation_endpoint": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Revocation Endpoint"
            },
            "token_endpoint_auth_methods_supported": {
               "anyOf": [
                  {
                     "items": {
                        "type": "string"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Token Endpoint Auth Methods Supported"
            },
            "grant_types_supported": {
               "anyOf": [
                  {
                     "items": {
                        "type": "string"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Grant Types Supported"
            },
            "scopes": {
               "anyOf": [
                  {
                     "items": {
                        "type": "string"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Scopes"
            }
         },
         "required": [
            "authorization_endpoint",
            "token_endpoint"
         ],
         "title": "OpenIdConnectWithConfig",
         "type": "object"
      },
      "SecuritySchemeType": {
         "enum": [
            "apiKey",
            "http",
            "oauth2",
            "openIdConnect"
         ],
         "title": "SecuritySchemeType",
         "type": "string"
      },
      "ServiceAccount": {
         "additionalProperties": true,
         "description": "Represents Google Service Account configuration.",
         "properties": {
            "serviceAccountCredential": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/ServiceAccountCredential"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "scopes": {
               "items": {
                  "type": "string"
               },
               "title": "Scopes",
               "type": "array"
            },
            "useDefaultCredential": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": false,
               "title": "Usedefaultcredential"
            }
         },
         "required": [
            "scopes"
         ],
         "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"
      },
      "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"
      }
   },
   "additionalProperties": false
}

Fields:
  • artifact_delta (dict[str, int])

  • escalate (bool | None)

  • requested_auth_configs (dict[str, google.adk.auth.auth_tool.AuthConfig])

  • requested_tool_confirmations (dict[str, google.adk.tools.tool_confirmation.ToolConfirmation])

  • skip_summarization (bool | None)

  • state_delta (dict[str, object])

  • transfer_to_agent (str | None)

field artifact_delta: dict[str, int] [Optional] (alias 'artifactDelta')

Indicates that the event is updating an artifact. key is the filename, value is the version.

field escalate: Optional[bool] = None

The agent is escalating to a higher level agent.

field requested_auth_configs: dict[str, AuthConfig] [Optional] (alias 'requestedAuthConfigs')

Authentication configurations requested by tool responses.

This field will only be set by a tool response event indicating tool request auth credential. - Keys: The function call id. Since one function response event could contain multiple function responses that correspond to multiple function calls. Each function call could request different auth configs. This id is used to identify the function call. - Values: The requested auth config.

field requested_tool_confirmations: dict[str, ToolConfirmation] [Optional] (alias 'requestedToolConfirmations')

A dict of tool confirmation requested by this event, keyed by function call id.

field skip_summarization: Optional[bool] = None (alias 'skipSummarization')

If true, it won’t call model to summarize function response.

Only used for function_response event.

field state_delta: dict[str, object] [Optional] (alias 'stateDelta')

Indicates that the event is updating the state with the given delta.

field transfer_to_agent: Optional[str] = None (alias 'transferToAgent')

If set, the event transfers to the specified agent.

google.adk.examples module

class google.adk.examples.BaseExampleProvider

Bases: ABC

Base class for example providers.

This class defines the interface for providing examples for a given query.

abstractmethod get_examples(query)

Returns a list of examples for a given query.

Return type:

list[Example]

Parameters:

query – The query to get examples for.

Returns:

A list of Example objects.

pydantic model google.adk.examples.Example

Bases: BaseModel

A few-shot example.

input

The input content for the example.

output

The expected output content for the example.

Show JSON schema
{
   "title": "Example",
   "description": "A few-shot example.\n\nAttributes:\n  input: The input content for the example.\n  output: The expected output content for the example.",
   "type": "object",
   "properties": {
      "input": {
         "$ref": "#/$defs/Content"
      },
      "output": {
         "items": {
            "$ref": "#/$defs/Content"
         },
         "title": "Output",
         "type": "array"
      }
   },
   "$defs": {
      "Blob": {
         "additionalProperties": false,
         "description": "Content blob.",
         "properties": {
            "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 not currently used in the Gemini GenerateContent calls.",
               "title": "Displayname"
            },
            "data": {
               "anyOf": [
                  {
                     "format": "base64url",
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Required. Raw bytes.",
               "title": "Data"
            },
            "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\nOnly generated when using the [CodeExecution] tool, and always follows a\n`part` containing the [ExecutableCode].",
         "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"
            }
         },
         "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\n      'model'. Useful to set for multi-turn conversations, otherwise can be\n      empty. If role is not specified, SDK will determine the role.",
               "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`."
            }
         },
         "title": "ExecutableCode",
         "type": "object"
      },
      "FileData": {
         "additionalProperties": false,
         "description": "URI based data.",
         "properties": {
            "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. It is not currently used in the Gemini GenerateContent calls.",
               "title": "Displayname"
            },
            "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"
            }
         },
         "title": "FileData",
         "type": "object"
      },
      "FunctionCall": {
         "additionalProperties": false,
         "description": "A function call.",
         "properties": {
            "id": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The unique id of the function call. If populated, the client to execute the\n   `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": "Required. The name of the function to call. Matches [FunctionDeclaration.name].",
               "title": "Name"
            }
         },
         "title": "FunctionCall",
         "type": "object"
      },
      "FunctionResponse": {
         "additionalProperties": false,
         "description": "A function response.",
         "properties": {
            "willContinue": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "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 (see FunctionDeclaration.behavior for details), ignored otherwise. If false, the default, future responses will not be considered. 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.",
               "title": "Willcontinue"
            },
            "scheduling": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/FunctionResponseScheduling"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Specifies how the response should be scheduled in the conversation. Only applicable to NON_BLOCKING function calls, is ignored otherwise. Defaults to WHEN_IDLE."
            },
            "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"
      },
      "FunctionResponseScheduling": {
         "description": "Specifies how the response should be scheduled in the conversation.",
         "enum": [
            "SCHEDULING_UNSPECIFIED",
            "SILENT",
            "WHEN_IDLE",
            "INTERRUPT"
         ],
         "title": "FunctionResponseScheduling",
         "type": "string"
      },
      "Language": {
         "description": "Required. Programming language of the `code`.",
         "enum": [
            "LANGUAGE_UNSPECIFIED",
            "PYTHON"
         ],
         "title": "Language",
         "type": "string"
      },
      "Outcome": {
         "description": "Required. 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": {
            "videoMetadata": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/VideoMetadata"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Metadata for a given video."
            },
            "thought": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Indicates if the part is thought from the model.",
               "title": "Thought"
            },
            "inlineData": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/Blob"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Inlined bytes data."
            },
            "fileData": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/FileData"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. URI based data."
            },
            "thoughtSignature": {
               "anyOf": [
                  {
                     "format": "base64url",
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "An opaque signature for the thought so it can be reused in subsequent requests.",
               "title": "Thoughtsignature"
            },
            "codeExecutionResult": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/CodeExecutionResult"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Result of executing the [ExecutableCode]."
            },
            "executableCode": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/ExecutableCode"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Code generated by the model that is meant to be executed."
            },
            "functionCall": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/FunctionCall"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. A predicted [FunctionCall] returned from the model that contains a string representing the [FunctionDeclaration.name] with the parameters and their values."
            },
            "functionResponse": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/FunctionResponse"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. The result output of a [FunctionCall] that contains a string representing the [FunctionDeclaration.name] and a structured JSON object containing any output from the function call. It is used as context to the model."
            },
            "text": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Text part (can be code).",
               "title": "Text"
            }
         },
         "title": "Part",
         "type": "object"
      },
      "VideoMetadata": {
         "additionalProperties": false,
         "description": "Describes how the video in the Part should be used by the model.",
         "properties": {
            "fps": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The frame rate of the video sent to the model. If not specified, the\n        default value will be 1.0. The fps range is (0.0, 24.0].",
               "title": "Fps"
            },
            "endOffset": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. The end offset of the video.",
               "title": "Endoffset"
            },
            "startOffset": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. The start offset of the video.",
               "title": "Startoffset"
            }
         },
         "title": "VideoMetadata",
         "type": "object"
      }
   },
   "required": [
      "input",
      "output"
   ]
}

Fields:
  • input (google.genai.types.Content)

  • output (list[google.genai.types.Content])

field input: Content [Required]
field output: list[Content] [Required]
class google.adk.examples.VertexAiExampleStore(examples_store_name)

Bases: BaseExampleProvider

Provides examples from Vertex example store.

Initializes the VertexAiExampleStore.

Parameters:

examples_store_name – The resource name of the vertex example store, in the format of projects/{project}/locations/{location}/exampleStores/{example_store}.

get_examples(query)

Returns a list of examples for a given query.

Return type:

list[Example]

Parameters:

query – The query to get examples for.

Returns:

A list of Example objects.

google.adk.flows module

google.adk.memory module

class google.adk.memory.BaseMemoryService

Bases: ABC

Base class for memory services.

The service provides functionalities to ingest sessions into memory so that the memory can be used for user queries.

abstractmethod async add_session_to_memory(session)

Adds a session to the memory service.

A session may be added multiple times during its lifetime.

Parameters:

session – The session to add.

abstractmethod async search_memory(*, app_name, user_id, query)

Searches for sessions that match the query.

Return type:

SearchMemoryResponse

Parameters:
  • app_name – The name of the application.

  • user_id – The id of the user.

  • query – The query to search for.

Returns:

A SearchMemoryResponse containing the matching memories.

class google.adk.memory.InMemoryMemoryService

Bases: BaseMemoryService

An in-memory memory service for prototyping purpose only.

Uses keyword matching instead of semantic search.

This class is thread-safe, however, it should be used for testing and development only.

async add_session_to_memory(session)

Adds a session to the memory service.

A session may be added multiple times during its lifetime.

Parameters:

session – The session to add.

async search_memory(*, app_name, user_id, query)

Searches for sessions that match the query.

Return type:

SearchMemoryResponse

Parameters:
  • app_name – The name of the application.

  • user_id – The id of the user.

  • query – The query to search for.

Returns:

A SearchMemoryResponse containing the matching memories.

class google.adk.memory.VertexAiMemoryBankService(project=None, location=None, agent_engine_id=None)

Bases: BaseMemoryService

Implementation of the BaseMemoryService using Vertex AI Memory Bank.

Initializes a VertexAiMemoryBankService.

Parameters:
  • project – The project ID of the Memory Bank to use.

  • location – The location of the Memory Bank to use.

  • agent_engine_id – The ID of the agent engine to use for the Memory Bank. e.g. ‘456’ in ‘projects/my-project/locations/us-central1/reasoningEngines/456’.

async add_session_to_memory(session)

Adds a session to the memory service.

A session may be added multiple times during its lifetime.

Parameters:

session – The session to add.

async search_memory(*, app_name, user_id, query)

Searches for sessions that match the query.

Parameters:
  • app_name – The name of the application.

  • user_id – The id of the user.

  • query – The query to search for.

Returns:

A SearchMemoryResponse containing the matching memories.

class google.adk.memory.VertexAiRagMemoryService(rag_corpus=None, similarity_top_k=None, vector_distance_threshold=10)

Bases: BaseMemoryService

A memory service that uses Vertex AI RAG for storage and retrieval.

Initializes a VertexAiRagMemoryService.

Parameters:
  • rag_corpus – The name of the Vertex AI RAG corpus to use. Format: projects/{project}/locations/{location}/ragCorpora/{rag_corpus_id} or {rag_corpus_id}

  • similarity_top_k – The number of contexts to retrieve.

  • vector_distance_threshold – Only returns contexts with vector distance smaller than the threshold..

async add_session_to_memory(session)

Adds a session to the memory service.

A session may be added multiple times during its lifetime.

Parameters:

session – The session to add.

async search_memory(*, app_name, user_id, query)

Searches for sessions that match the query using rag.retrieval_query.

Return type:

SearchMemoryResponse

google.adk.models module

Defines the interface to support a model.

pydantic model google.adk.models.BaseLlm

Bases: BaseModel

The BaseLLM class.

model

The name of the LLM, e.g. gemini-1.5-flash or gemini-1.5-flash-001.

Show JSON schema
{
   "title": "BaseLlm",
   "description": "The BaseLLM class.\n\nAttributes:\n  model: The name of the LLM, e.g. gemini-1.5-flash or gemini-1.5-flash-001.",
   "type": "object",
   "properties": {
      "model": {
         "title": "Model",
         "type": "string"
      }
   },
   "required": [
      "model"
   ]
}

Fields:
  • model (str)

field model: str [Required]

The name of the LLM, e.g. gemini-1.5-flash or gemini-1.5-flash-001.

classmethod supported_models()

Returns a list of supported models in regex for LlmRegistry.

Return type:

list[str]

connect(llm_request)

Creates a live connection to the LLM.

Return type:

BaseLlmConnection

Parameters:

llm_request – LlmRequest, the request to send to the LLM.

Returns:

BaseLlmConnection, the connection to the LLM.

abstractmethod async generate_content_async(llm_request, stream=False)

Generates one content from the given contents and tools.

Return type:

AsyncGenerator[LlmResponse, None]

Parameters:
  • llm_request – LlmRequest, the request to send to the LLM.

  • stream – bool = False, whether to do streaming call.

Yields:

a generator of types.Content.

For non-streaming call, it will only yield one Content.

For streaming call, it may yield more than one content, but all yielded contents should be treated as one content by merging the parts list.

pydantic model google.adk.models.Gemini

Bases: BaseLlm

Integration for Gemini models.

model

The name of the Gemini model.

Show JSON schema
{
   "title": "Gemini",
   "description": "Integration for Gemini models.\n\nAttributes:\n  model: The name of the Gemini model.",
   "type": "object",
   "properties": {
      "model": {
         "default": "gemini-1.5-flash",
         "title": "Model",
         "type": "string"
      },
      "retry_options": {
         "anyOf": [
            {
               "$ref": "#/$defs/HttpRetryOptions"
            },
            {
               "type": "null"
            }
         ],
         "default": null
      }
   },
   "$defs": {
      "HttpRetryOptions": {
         "additionalProperties": false,
         "description": "HTTP retry options to be used in each of the requests.",
         "properties": {
            "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.",
               "title": "Attempts"
            },
            "initialDelay": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Initial delay before the first retry, in fractions of a second.",
               "title": "Initialdelay"
            },
            "maxDelay": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Maximum delay between retries, in fractions of a second.",
               "title": "Maxdelay"
            },
            "expBase": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Multiplier by which the delay increases after each attempt.",
               "title": "Expbase"
            },
            "jitter": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Randomness factor for the delay.",
               "title": "Jitter"
            },
            "httpStatusCodes": {
               "anyOf": [
                  {
                     "items": {
                        "type": "integer"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "List of HTTP status codes that should trigger a retry.\n      If not specified, a default set of retryable codes may be used.",
               "title": "Httpstatuscodes"
            }
         },
         "title": "HttpRetryOptions",
         "type": "object"
      }
   }
}

Fields:
  • model (str)

  • retry_options (Optional[types.HttpRetryOptions])

field model: str = 'gemini-1.5-flash'

The name of the LLM, e.g. gemini-1.5-flash or gemini-1.5-flash-001.

field retry_options: Optional[types.HttpRetryOptions] = None

Allow Gemini to retry failed responses.

Sample: ```python from google.genai import types

# …

agent = Agent(
model=Gemini(

retry_options=types.HttpRetryOptions(initial_delay=1, attempts=2),

)

)

classmethod supported_models()

Provides the list of supported models.

Return type:

list[str]

Returns:

A list of supported models.

connect(llm_request)

Connects to the Gemini model and returns an llm connection.

Return type:

BaseLlmConnection

Parameters:

llm_request – LlmRequest, the request to send to the Gemini model.

Yields:

BaseLlmConnection, the connection to the Gemini model.

async generate_content_async(llm_request, stream=False)

Sends a request to the Gemini model.

Return type:

AsyncGenerator[LlmResponse, None]

Parameters:
  • llm_request – LlmRequest, the request to send to the Gemini model.

  • stream – bool = False, whether to do streaming call.

Yields:

LlmResponse – The model response.

property api_client: Client

Provides the api client.

Returns:

The api client.

class google.adk.models.LLMRegistry

Bases: object

Registry for LLMs.

static new_llm(model)

Creates a new LLM instance.

Return type:

BaseLlm

Parameters:

model – The model name.

Returns:

The LLM instance.

static register(llm_cls)

Registers a new LLM class.

Parameters:

llm_cls – The class that implements the model.

static resolve(model)

Resolves the model to a BaseLlm subclass.

Return type:

type[BaseLlm]

Parameters:

model – The model name.

Returns:

The BaseLlm subclass.

Raises:

ValueError – If the model is not found.

google.adk.planners module

class google.adk.planners.BasePlanner

Bases: ABC

Abstract base class for all planners.

The planner allows the agent to generate plans for the queries to guide its action.

abstractmethod build_planning_instruction(readonly_context, llm_request)

Builds the system instruction to be appended to the LLM request for planning.

Return type:

Optional[str]

Parameters:
  • readonly_context – The readonly context of the invocation.

  • llm_request – The LLM request. Readonly.

Returns:

The planning system instruction, or None if no instruction is needed.

abstractmethod process_planning_response(callback_context, response_parts)

Processes the LLM response for planning.

Return type:

Optional[List[Part]]

Parameters:
  • callback_context – The callback context of the invocation.

  • response_parts – The LLM response parts. Readonly.

Returns:

The processed response parts, or None if no processing is needed.

class google.adk.planners.BuiltInPlanner(*, thinking_config)

Bases: BasePlanner

The built-in planner that uses model’s built-in thinking features.

thinking_config

Config for model built-in thinking features. An error will be returned if this field is set for models that don’t support thinking.

Initializes the built-in planner.

Parameters:

thinking_config – Config for model built-in thinking features. An error will be returned if this field is set for models that don’t support thinking.

apply_thinking_config(llm_request)

Applies the thinking config to the LLM request.

Return type:

None

Parameters:

llm_request – The LLM request to apply the thinking config to.

build_planning_instruction(readonly_context, llm_request)

Builds the system instruction to be appended to the LLM request for planning.

Return type:

Optional[str]

Parameters:
  • readonly_context – The readonly context of the invocation.

  • llm_request – The LLM request. Readonly.

Returns:

The planning system instruction, or None if no instruction is needed.

process_planning_response(callback_context, response_parts)

Processes the LLM response for planning.

Return type:

Optional[List[Part]]

Parameters:
  • callback_context – The callback context of the invocation.

  • response_parts – The LLM response parts. Readonly.

Returns:

The processed response parts, or None if no processing is needed.

thinking_config: ThinkingConfig

Config for model built-in thinking features. An error will be returned if this field is set for models that don’t support thinking.

class google.adk.planners.PlanReActPlanner

Bases: BasePlanner

Plan-Re-Act planner that constrains the LLM response to generate a plan before any action/observation.

Note: this planner does not require the model to support built-in thinking features or setting the thinking config.

build_planning_instruction(readonly_context, llm_request)

Builds the system instruction to be appended to the LLM request for planning.

Return type:

str

Parameters:
  • readonly_context – The readonly context of the invocation.

  • llm_request – The LLM request. Readonly.

Returns:

The planning system instruction, or None if no instruction is needed.

process_planning_response(callback_context, response_parts)

Processes the LLM response for planning.

Return type:

Optional[List[Part]]

Parameters:
  • callback_context – The callback context of the invocation.

  • response_parts – The LLM response parts. Readonly.

Returns:

The processed response parts, or None if no processing is needed.

google.adk.platform module

google.adk.plugins module

class google.adk.plugins.BasePlugin(name)

Bases: ABC

Base class for creating plugins.

Plugins provide a structured way to intercept and modify agent, tool, and LLM behaviors at critical execution points in a callback manner. While agent callbacks apply to a particular agent, plugins applies globally to all agents added in the runner. Plugins are best used for adding custom behaviors like logging, monitoring, caching, or modifying requests and responses at key stages.

A plugin can implement one or more methods of callbacks, but should not implement the same method of callback for multiple times.

Relation with [Agent callbacks](https://google.github.io/adk-docs/callbacks/):

Execution Order Similar to Agent callbacks, Plugins are executed in the order they are registered. However, Plugin and Agent Callbacks are executed sequentially, with Plugins takes precedence over agent callbacks. When the callback in a plugin returns a value, it will short circuit all remaining plugins and agent callbacks, causing all remaining plugins and agent callbacks to be skipped.

Change Propagation Plugins and agent callbacks can both modify the value of the input parameters, including agent input, tool input, and LLM request/response, etc. They work in the exactly same way. The modifications will be visible and passed to the next callback in the chain. For example, if a plugin modifies the tool input with before_tool_callback, the modified tool input will be passed to the before_tool_callback of the next plugin, and further passed to the agent callbacks if not short circuited.

To use a plugin, implement the desired callback methods and pass an instance of your custom plugin class to the ADK Runner.

Examples

A simple plugin that logs every tool call.

>>> class ToolLoggerPlugin(BasePlugin):
..   def __init__(self):
..     super().__init__(name="tool_logger")
..
..   async def before_tool_callback(
..       self, *, tool: BaseTool, tool_args: dict[str, Any],
tool_context:
ToolContext
..   ):
..     print(f"[{self.name}] Calling tool '{tool.name}' with args:
{tool_args}")
..
..   async def after_tool_callback(
..       self, *, tool: BaseTool, tool_args: dict, tool_context:
ToolContext, result: dict
..   ):
..     print(f"[{self.name}] Tool '{tool.name}' finished with result:
{result}")
..
>>> # Add the plugin to ADK Runner
>>> # runner = Runner(
>>> #     ...
>>> #     plugins=[ToolLoggerPlugin(), AgentPolicyPlugin()],
>>> # )

Initializes the plugin.

Parameters:

name – A unique identifier for this plugin instance.

async after_agent_callback(*, agent, callback_context)

Callback executed after an agent’s primary logic has completed.

This callback can be used to inspect, log, or modify the agent’s final result before it is returned.

Return type:

Optional[Content]

Parameters:
  • agent – The agent that has just run.

  • callback_context – The context for the agent invocation.

Returns:

An optional types.Content object. If a value is returned, it will replace the agent’s original result. Returning None uses the original, unmodified result.

async after_model_callback(*, callback_context, llm_response)

Callback executed after a response is received from the model.

This is the ideal place to log model responses, collect metrics on token usage, or perform post-processing on the raw LlmResponse.

Return type:

Optional[LlmResponse]

Parameters:
  • callback_context – The context for the current agent call.

  • llm_response – The response object received from the model.

Returns:

An optional value. A non-None return may be used by the framework to modify or replace the response. Returning None allows the original response to be used.

async after_run_callback(*, invocation_context)

Callback executed after an ADK runner run has completed.

This is the final callback in the ADK lifecycle, suitable for cleanup, final logging, or reporting tasks.

Return type:

None

Parameters:

invocation_context – The context for the entire invocation.

Returns:

None

async after_tool_callback(*, tool, tool_args, tool_context, result)

Callback executed after a tool has been called.

This callback allows for inspecting, logging, or modifying the result returned by a tool.

Return type:

Optional[dict]

Parameters:
  • tool – The tool instance that has just been executed.

  • tool_args – The original arguments that were passed to the tool.

  • tool_context – The context specific to the tool execution.

  • result – The dictionary returned by the tool invocation.

Returns:

An optional dictionary. If a dictionary is returned, it will replace the original result from the tool. This allows for post-processing or altering tool outputs. Returning None uses the original, unmodified result.

async before_agent_callback(*, agent, callback_context)

Callback executed before an agent’s primary logic is invoked.

This callback can be used for logging, setup, or to short-circuit the agent’s execution by returning a value.

Return type:

Optional[Content]

Parameters:
  • agent – The agent that is about to run.

  • callback_context – The context for the agent invocation.

Returns:

An optional types.Content object. If a value is returned, it will bypass the agent’s callbacks and its execution, and return this value directly. Returning None allows the agent to proceed normally.

async before_model_callback(*, callback_context, llm_request)

Callback executed before a request is sent to the model.

This provides an opportunity to inspect, log, or modify the LlmRequest object. It can also be used to implement caching by returning a cached LlmResponse, which would skip the actual model call.

Return type:

Optional[LlmResponse]

Parameters:
  • callback_context – The context for the current agent call.

  • llm_request – The prepared request object to be sent to the model.

Returns:

An optional value. The interpretation of a non-None trigger an early exit and returns the response immediately. Returning None allows the LLM request to proceed normally.

async before_run_callback(*, invocation_context)

Callback executed before the ADK runner runs.

This is the first callback to be called in the lifecycle, ideal for global setup or initialization tasks.

Return type:

Optional[Content]

Parameters:

invocation_context – The context for the entire invocation, containing session information, the root agent, etc.

Returns:

An optional Event to be returned to the ADK. Returning a value to halt execution of the runner and ends the runner with that event. Return None to proceed normally.

async before_tool_callback(*, tool, tool_args, tool_context)

Callback executed before a tool is called.

This callback is useful for logging tool usage, input validation, or modifying the arguments before they are passed to the tool.

Return type:

Optional[dict]

Parameters:
  • tool – The tool instance that is about to be executed.

  • tool_args – The dictionary of arguments to be used for invoking the tool.

  • tool_context – The context specific to the tool execution.

Returns:

An optional dictionary. If a dictionary is returned, it will stop the tool execution and return this response immediately. Returning None uses the original, unmodified arguments.

async on_event_callback(*, invocation_context, event)

Callback executed after an event is yielded from runner.

This is the ideal place to make modification to the event before the event is handled by the underlying agent app.

Return type:

Optional[Event]

Parameters:
  • invocation_context – The context for the entire invocation.

  • event – The event raised by the runner.

Returns:

An optional value. A non-None return may be used by the framework to modify or replace the response. Returning None allows the original response to be used.

async on_model_error_callback(*, callback_context, llm_request, error)

Callback executed when a model call encounters an error.

This callback provides an opportunity to handle model errors gracefully, potentially providing alternative responses or recovery mechanisms.

Return type:

Optional[LlmResponse]

Parameters:
  • callback_context – The context for the current agent call.

  • llm_request – The request that was sent to the model when the error occurred.

  • error – The exception that was raised during model execution.

Returns:

An optional LlmResponse. If an LlmResponse is returned, it will be used instead of propagating the error. Returning None allows the original error to be raised.

async on_tool_error_callback(*, tool, tool_args, tool_context, error)

Callback executed when a tool call encounters an error.

This callback provides an opportunity to handle tool errors gracefully, potentially providing alternative responses or recovery mechanisms.

Return type:

Optional[dict]

Parameters:
  • tool – The tool instance that encountered an error.

  • tool_args – The arguments that were passed to the tool.

  • tool_context – The context specific to the tool execution.

  • error – The exception that was raised during tool execution.

Returns:

An optional dictionary. If a dictionary is returned, it will be used as the tool response instead of propagating the error. Returning None allows the original error to be raised.

async on_user_message_callback(*, invocation_context, user_message)

Callback executed when a user message is received before an invocation starts.

This callback helps logging and modifying the user message before the runner starts the invocation.

Return type:

Optional[Content]

Parameters:
  • invocation_context – The context for the entire invocation.

  • user_message – The message content input by user.

Returns:

An optional types.Content to be returned to the ADK. Returning a value to replace the user message. Returning None to proceed normally.

google.adk.runners module

class google.adk.runners.InMemoryRunner(agent=None, *, app_name='InMemoryRunner', plugins=None, app=None)

Bases: Runner

An in-memory Runner for testing and development.

This runner uses in-memory implementations for artifact, session, and memory services, providing a lightweight and self-contained environment for agent execution.

agent

The root agent to run.

app_name

The application name of the runner. Defaults to ‘InMemoryRunner’.

_in_memory_session_service

Deprecated. Please don’t use. The in-memory session service for the runner.

Initializes the InMemoryRunner.

Parameters:
  • agent – The root agent to run.

  • app_name – The application name of the runner. Defaults to ‘InMemoryRunner’.

class google.adk.runners.Runner(*, app=None, app_name=None, agent=None, plugins=None, artifact_service=None, session_service, memory_service=None, credential_service=None)

Bases: object

The Runner class is used to run agents.

It manages the execution of an agent within a session, handling message processing, event generation, and interaction with various services like artifact storage, session management, and memory.

app_name

The application name of the runner.

agent

The root agent to run.

artifact_service

The artifact service for the runner.

plugin_manager

The plugin manager for the runner.

session_service

The session service for the runner.

memory_service

The memory service for the runner.

credential_service

The credential service for the runner.

Initializes the Runner.

Developers should provide either an app instance or both app_name and agent. Providing a mix of app and app_name/agent will result in a ValueError. Providing app is the recommended way to create a runner.

Parameters:
  • app_name – The application name of the runner. Required if app is not provided.

  • agent – The root agent to run. Required if app is not provided.

  • app – An optional App instance. If provided, app_name and agent should not be specified.

  • plugins – Deprecated. A list of plugins for the runner. Please use the app argument to provide plugins instead.

  • artifact_service – The artifact service for the runner.

  • session_service – The session service for the runner.

  • memory_service – The memory service for the runner.

  • credential_service – The credential service for the runner.

Raises:

ValueError – If app is provided along with app_name or plugins, or if app is not provided but either app_name or agent is missing.

agent: BaseAgent

The root agent to run.

app_name: str

The app name of the runner.

artifact_service: Optional[BaseArtifactService] = None

The artifact service for the runner.

async close()

Closes the runner.

credential_service: Optional[BaseCredentialService] = None

The credential service for the runner.

memory_service: Optional[BaseMemoryService] = None

The memory service for the runner.

plugin_manager: PluginManager

The plugin manager for the runner.

run(*, user_id, session_id, new_message, run_config=None)

Runs the agent.

Return type:

Generator[Event, None, None]

Note

This sync interface is only for local testing and convenience purpose. Consider using run_async for production usage.

Parameters:
  • user_id – The user ID of the session.

  • session_id – The session ID of the session.

  • new_message – A new message to append to the session.

  • run_config – The run config for the agent.

Yields:

The events generated by the agent.

async run_async(*, user_id, session_id, new_message, state_delta=None, run_config=None)

Main entry method to run the agent in this runner.

Return type:

AsyncGenerator[Event, None]

Parameters:
  • user_id – The user ID of the session.

  • session_id – The session ID of the session.

  • new_message – A new message to append to the session.

  • run_config – The run config for the agent.

Yields:

The events generated by the agent.

async run_live(*, user_id=None, session_id=None, live_request_queue, run_config=None, session=None)

Runs the agent in live mode (experimental feature).

Return type:

AsyncGenerator[Event, None]

Parameters:
  • user_id – The user ID for the session. Required if session is None.

  • session_id – The session ID for the session. Required if session is None.

  • live_request_queue – The queue for live requests.

  • run_config – The run config for the agent.

  • session – The session to use. This parameter is deprecated, please use user_id and session_id instead.

Yields:

AsyncGenerator[Event, None] – An asynchronous generator that yields Event objects as they are produced by the agent during its live execution.

Warning

This feature is experimental and its API or behavior may change in future releases.

Note

Either session or both user_id and session_id must be provided.

session_service: BaseSessionService

The session service for the runner.

google.adk.sessions module

class google.adk.sessions.BaseSessionService

Bases: ABC

Base class for session services.

The service provides a set of methods for managing sessions and events.

async append_event(session, event)

Appends an event to a session object.

Return type:

Event

abstractmethod async create_session(*, app_name, user_id, state=None, session_id=None)

Creates a new session.

Return type:

Session

Parameters:
  • app_name – the name of the app.

  • user_id – the id of the user.

  • state – the initial state of the session.

  • session_id – the client-provided id of the session. If not provided, a generated ID will be used.

Returns:

The newly created session instance.

Return type:

session

abstractmethod async delete_session(*, app_name, user_id, session_id)

Deletes a session.

Return type:

None

abstractmethod async get_session(*, app_name, user_id, session_id, config=None)

Gets a session.

Return type:

Optional[Session]

abstractmethod async list_sessions(*, app_name, user_id)

Lists all the sessions.

Return type:

ListSessionsResponse

class google.adk.sessions.DatabaseSessionService(db_url, **kwargs)

Bases: BaseSessionService

A session service that uses a database for storage.

Initializes the database session service with a database URL.

async append_event(session, event)

Appends an event to a session object.

Return type:

Event

async create_session(*, app_name, user_id, state=None, session_id=None)

Creates a new session.

Return type:

Session

Parameters:
  • app_name – the name of the app.

  • user_id – the id of the user.

  • state – the initial state of the session.

  • session_id – the client-provided id of the session. If not provided, a generated ID will be used.

Returns:

The newly created session instance.

Return type:

session

async delete_session(app_name, user_id, session_id)

Deletes a session.

Return type:

None

async get_session(*, app_name, user_id, session_id, config=None)

Gets a session.

Return type:

Optional[Session]

async list_sessions(*, app_name, user_id)

Lists all the sessions.

Return type:

ListSessionsResponse

class google.adk.sessions.InMemorySessionService

Bases: BaseSessionService

An in-memory implementation of the session service.

It is not suitable for multi-threaded production environments. Use it for testing and development only.

async append_event(session, event)

Appends an event to a session object.

Return type:

Event

async create_session(*, app_name, user_id, state=None, session_id=None)

Creates a new session.

Return type:

Session

Parameters:
  • app_name – the name of the app.

  • user_id – the id of the user.

  • state – the initial state of the session.

  • session_id – the client-provided id of the session. If not provided, a generated ID will be used.

Returns:

The newly created session instance.

Return type:

session

create_session_sync(*, app_name, user_id, state=None, session_id=None)
Return type:

Session

async delete_session(*, app_name, user_id, session_id)

Deletes a session.

Return type:

None

delete_session_sync(*, app_name, user_id, session_id)
Return type:

None

async get_session(*, app_name, user_id, session_id, config=None)

Gets a session.

Return type:

Optional[Session]

get_session_sync(*, app_name, user_id, session_id, config=None)
Return type:

Optional[Session]

async list_sessions(*, app_name, user_id)

Lists all the sessions.

Return type:

ListSessionsResponse

list_sessions_sync(*, app_name, user_id)
Return type:

ListSessionsResponse

pydantic model google.adk.sessions.Session

Bases: BaseModel

Represents a series of interactions between a user and agents.

id

The unique identifier of the session.

app_name

The name of the app.

user_id

The id of the user.

state

The state of the session.

events

The events of the session, e.g. user input, model response, function call/response, etc.

last_update_time

The last update time of the session.

Show JSON schema
{
   "title": "Session",
   "description": "Represents a series of interactions between a user and agents.\n\nAttributes:\n  id: The unique identifier of the session.\n  app_name: The name of the app.\n  user_id: The id of the user.\n  state: The state of the session.\n  events: The events of the session, e.g. user input, model response, function\n    call/response, etc.\n  last_update_time: The last update time of the session.",
   "type": "object",
   "properties": {
      "id": {
         "title": "Id",
         "type": "string"
      },
      "appName": {
         "title": "Appname",
         "type": "string"
      },
      "userId": {
         "title": "Userid",
         "type": "string"
      },
      "state": {
         "additionalProperties": true,
         "title": "State",
         "type": "object"
      },
      "events": {
         "items": {
            "$ref": "#/$defs/Event"
         },
         "title": "Events",
         "type": "array"
      },
      "lastUpdateTime": {
         "default": 0.0,
         "title": "Lastupdatetime",
         "type": "number"
      }
   },
   "$defs": {
      "APIKey": {
         "additionalProperties": true,
         "properties": {
            "type": {
               "$ref": "#/$defs/SecuritySchemeType",
               "default": "apiKey"
            },
            "description": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Description"
            },
            "in": {
               "$ref": "#/$defs/APIKeyIn"
            },
            "name": {
               "title": "Name",
               "type": "string"
            }
         },
         "required": [
            "in",
            "name"
         ],
         "title": "APIKey",
         "type": "object"
      },
      "APIKeyIn": {
         "enum": [
            "query",
            "header",
            "cookie"
         ],
         "title": "APIKeyIn",
         "type": "string"
      },
      "AuthConfig": {
         "additionalProperties": true,
         "description": "The auth config sent by tool asking client to collect auth credentials and\n\nadk and client will help to fill in the response",
         "properties": {
            "authScheme": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/APIKey"
                  },
                  {
                     "$ref": "#/$defs/HTTPBase"
                  },
                  {
                     "$ref": "#/$defs/OAuth2"
                  },
                  {
                     "$ref": "#/$defs/OpenIdConnect"
                  },
                  {
                     "$ref": "#/$defs/HTTPBearer"
                  },
                  {
                     "$ref": "#/$defs/OpenIdConnectWithConfig"
                  }
               ],
               "title": "Authscheme"
            },
            "rawAuthCredential": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/AuthCredential"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "exchangedAuthCredential": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/AuthCredential"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "credentialKey": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Credentialkey"
            }
         },
         "required": [
            "authScheme"
         ],
         "title": "AuthConfig",
         "type": "object"
      },
      "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"
      },
      "Blob": {
         "additionalProperties": false,
         "description": "Content blob.",
         "properties": {
            "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 not currently used in the Gemini GenerateContent calls.",
               "title": "Displayname"
            },
            "data": {
               "anyOf": [
                  {
                     "format": "base64url",
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Required. Raw bytes.",
               "title": "Data"
            },
            "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\nOnly generated when using the [CodeExecution] tool, and always follows a\n`part` containing the [ExecutableCode].",
         "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"
            }
         },
         "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\n      'model'. Useful to set for multi-turn conversations, otherwise can be\n      empty. If role is not specified, SDK will determine the role.",
               "title": "Role"
            }
         },
         "title": "Content",
         "type": "object"
      },
      "Event": {
         "additionalProperties": false,
         "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.\n\nAttributes:\n  invocation_id: Required. The invocation ID of the event. Should be non-empty\n    before appending to a session.\n  author: Required. \"user\" or the name of the agent, indicating who appended\n    the event to the session.\n  actions: The actions taken by the agent.\n  long_running_tool_ids: The ids of the long running function calls.\n  branch: The branch of the event.\n  id: The unique identifier of the event.\n  timestamp: The timestamp of the event.\n  get_function_calls: Returns the function calls in the event.",
         "properties": {
            "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"
            },
            "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
            },
            "inputTranscription": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/Transcription"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "outputTranscription": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/Transcription"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "invocationId": {
               "default": "",
               "title": "Invocationid",
               "type": "string"
            },
            "author": {
               "title": "Author",
               "type": "string"
            },
            "actions": {
               "$ref": "#/$defs/EventActions"
            },
            "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"
            },
            "id": {
               "default": "",
               "title": "Id",
               "type": "string"
            },
            "timestamp": {
               "title": "Timestamp",
               "type": "number"
            }
         },
         "required": [
            "author"
         ],
         "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": {
                  "$ref": "#/$defs/AuthConfig"
               },
               "title": "Requestedauthconfigs",
               "type": "object"
            },
            "requestedToolConfirmations": {
               "additionalProperties": {
                  "$ref": "#/$defs/ToolConfirmation"
               },
               "title": "Requestedtoolconfirmations",
               "type": "object"
            }
         },
         "title": "EventActions",
         "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`."
            }
         },
         "title": "ExecutableCode",
         "type": "object"
      },
      "FileData": {
         "additionalProperties": false,
         "description": "URI based data.",
         "properties": {
            "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. It is not currently used in the Gemini GenerateContent calls.",
               "title": "Displayname"
            },
            "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"
            }
         },
         "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"
         ],
         "title": "FinishReason",
         "type": "string"
      },
      "FunctionCall": {
         "additionalProperties": false,
         "description": "A function call.",
         "properties": {
            "id": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The unique id of the function call. If populated, the client to execute the\n   `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": "Required. The name of the function to call. Matches [FunctionDeclaration.name].",
               "title": "Name"
            }
         },
         "title": "FunctionCall",
         "type": "object"
      },
      "FunctionResponse": {
         "additionalProperties": false,
         "description": "A function response.",
         "properties": {
            "willContinue": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "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 (see FunctionDeclaration.behavior for details), ignored otherwise. If false, the default, future responses will not be considered. 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.",
               "title": "Willcontinue"
            },
            "scheduling": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/FunctionResponseScheduling"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Specifies how the response should be scheduled in the conversation. Only applicable to NON_BLOCKING function calls, is ignored otherwise. Defaults to WHEN_IDLE."
            },
            "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"
      },
      "FunctionResponseScheduling": {
         "description": "Specifies how the response should be scheduled in the conversation.",
         "enum": [
            "SCHEDULING_UNSPECIFIED",
            "SILENT",
            "WHEN_IDLE",
            "INTERRUPT"
         ],
         "title": "FunctionResponseScheduling",
         "type": "string"
      },
      "GenerateContentResponseUsageMetadata": {
         "additionalProperties": false,
         "description": "Usage metadata about response(s).",
         "properties": {
            "cacheTokensDetails": {
               "anyOf": [
                  {
                     "items": {
                        "$ref": "#/$defs/ModalityTokenCount"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Output only. List of modalities of the cached content in the request input.",
               "title": "Cachetokensdetails"
            },
            "cachedContentTokenCount": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Output only. Number of tokens in the cached part in the input (the cached content).",
               "title": "Cachedcontenttokencount"
            },
            "candidatesTokenCount": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Number of tokens in the response(s).",
               "title": "Candidatestokencount"
            },
            "candidatesTokensDetails": {
               "anyOf": [
                  {
                     "items": {
                        "$ref": "#/$defs/ModalityTokenCount"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Output only. List of modalities that were returned in the response.",
               "title": "Candidatestokensdetails"
            },
            "promptTokenCount": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Number of tokens in the request. When `cached_content` is set, this is still the total effective prompt size meaning this 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. List of modalities that were processed in the request input.",
               "title": "Prompttokensdetails"
            },
            "thoughtsTokenCount": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Output only. Number of tokens present in thoughts output.",
               "title": "Thoughtstokencount"
            },
            "toolUsePromptTokenCount": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Output only. Number of tokens present in tool-use prompt(s).",
               "title": "Tooluseprompttokencount"
            },
            "toolUsePromptTokensDetails": {
               "anyOf": [
                  {
                     "items": {
                        "$ref": "#/$defs/ModalityTokenCount"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Output only. List of modalities that were processed for tool-use request inputs.",
               "title": "Tooluseprompttokensdetails"
            },
            "totalTokenCount": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Total token count for prompt, response candidates, and tool-use prompts (if present).",
               "title": "Totaltokencount"
            },
            "trafficType": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/TrafficType"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Output only. Traffic type. This shows whether a request consumes Pay-As-You-Go or Provisioned Throughput quota."
            }
         },
         "title": "GenerateContentResponseUsageMetadata",
         "type": "object"
      },
      "GroundingChunk": {
         "additionalProperties": false,
         "description": "Grounding chunk.",
         "properties": {
            "maps": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/GroundingChunkMaps"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Grounding chunk from Google Maps."
            },
            "retrievedContext": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/GroundingChunkRetrievedContext"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Grounding chunk from context retrieved by the retrieval tools."
            },
            "web": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/GroundingChunkWeb"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Grounding chunk from the web."
            }
         },
         "title": "GroundingChunk",
         "type": "object"
      },
      "GroundingChunkMaps": {
         "additionalProperties": false,
         "description": "Chunk from Google Maps.",
         "properties": {
            "placeAnswerSources": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/GroundingChunkMapsPlaceAnswerSources"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Sources used to generate the place answer. This includes review snippets and photos that were used to generate the 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. Can be used to look up the Place.",
               "title": "Placeid"
            },
            "text": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Text of the chunk.",
               "title": "Text"
            },
            "title": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Title of the chunk.",
               "title": "Title"
            },
            "uri": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "URI reference of the chunk.",
               "title": "Uri"
            }
         },
         "title": "GroundingChunkMaps",
         "type": "object"
      },
      "GroundingChunkMapsPlaceAnswerSources": {
         "additionalProperties": false,
         "description": "Sources used to generate the place answer.",
         "properties": {
            "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 are 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"
            }
         },
         "title": "GroundingChunkMapsPlaceAnswerSourcesReviewSnippet",
         "type": "object"
      },
      "GroundingChunkRetrievedContext": {
         "additionalProperties": false,
         "description": "Chunk from context retrieved by the retrieval tools.",
         "properties": {
            "documentName": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Output only. The full document name for the referenced Vertex AI Search document.",
               "title": "Documentname"
            },
            "ragChunk": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/RagChunk"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Additional context for the RAG retrieval result. This is only populated when using the RAG retrieval tool."
            },
            "text": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Text of the attribution.",
               "title": "Text"
            },
            "title": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Title of the attribution.",
               "title": "Title"
            },
            "uri": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "URI reference of the attribution.",
               "title": "Uri"
            }
         },
         "title": "GroundingChunkRetrievedContext",
         "type": "object"
      },
      "GroundingChunkWeb": {
         "additionalProperties": false,
         "description": "Chunk from the web.",
         "properties": {
            "domain": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Domain of the (original) URI.",
               "title": "Domain"
            },
            "title": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Title of the chunk.",
               "title": "Title"
            },
            "uri": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "URI reference of the chunk.",
               "title": "Uri"
            }
         },
         "title": "GroundingChunkWeb",
         "type": "object"
      },
      "GroundingMetadata": {
         "additionalProperties": false,
         "description": "Metadata returned to client when grounding is enabled.",
         "properties": {
            "googleMapsWidgetContextToken": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Output only. Resource name of the Google Maps widget context token to be used with the PlacesContextElement widget to render contextual data. This is populated only for Google Maps grounding.",
               "title": "Googlemapswidgetcontexttoken"
            },
            "groundingChunks": {
               "anyOf": [
                  {
                     "items": {
                        "$ref": "#/$defs/GroundingChunk"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "List of supporting references retrieved from specified grounding source.",
               "title": "Groundingchunks"
            },
            "groundingSupports": {
               "anyOf": [
                  {
                     "items": {
                        "$ref": "#/$defs/GroundingSupport"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. List of grounding support.",
               "title": "Groundingsupports"
            },
            "retrievalMetadata": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/RetrievalMetadata"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Output only. Retrieval metadata."
            },
            "retrievalQueries": {
               "anyOf": [
                  {
                     "items": {
                        "type": "string"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Queries executed by the retrieval tools.",
               "title": "Retrievalqueries"
            },
            "searchEntryPoint": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/SearchEntryPoint"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Google search entry for the following-up web searches."
            },
            "webSearchQueries": {
               "anyOf": [
                  {
                     "items": {
                        "type": "string"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Web search queries for the following-up web search.",
               "title": "Websearchqueries"
            }
         },
         "title": "GroundingMetadata",
         "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. Ranges from 0 to 1. 1 is the most confident. For Gemini 2.0 and before, this list must have the same size as the grounding_chunk_indices. For Gemini 2.5 and after, this list will be empty and should be ignored.",
               "title": "Confidencescores"
            },
            "groundingChunkIndices": {
               "anyOf": [
                  {
                     "items": {
                        "type": "integer"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "A list of indices (into 'grounding_chunk') specifying the citations associated with the claim. For instance [1,3,4] means that grounding_chunk[1], grounding_chunk[3], grounding_chunk[4] are the 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."
            }
         },
         "title": "GroundingSupport",
         "type": "object"
      },
      "HTTPBase": {
         "additionalProperties": true,
         "properties": {
            "type": {
               "$ref": "#/$defs/SecuritySchemeType",
               "default": "http"
            },
            "description": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Description"
            },
            "scheme": {
               "title": "Scheme",
               "type": "string"
            }
         },
         "required": [
            "scheme"
         ],
         "title": "HTTPBase",
         "type": "object"
      },
      "HTTPBearer": {
         "additionalProperties": true,
         "properties": {
            "type": {
               "$ref": "#/$defs/SecuritySchemeType",
               "default": "http"
            },
            "description": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Description"
            },
            "scheme": {
               "const": "bearer",
               "default": "bearer",
               "title": "Scheme",
               "type": "string"
            },
            "bearerFormat": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Bearerformat"
            }
         },
         "title": "HTTPBearer",
         "type": "object"
      },
      "HttpAuth": {
         "additionalProperties": true,
         "description": "The credentials and metadata for HTTP authentication.",
         "properties": {
            "scheme": {
               "title": "Scheme",
               "type": "string"
            },
            "credentials": {
               "$ref": "#/$defs/HttpCredentials"
            }
         },
         "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": "Required. Programming language of the `code`.",
         "enum": [
            "LANGUAGE_UNSPECIFIED",
            "PYTHON"
         ],
         "title": "Language",
         "type": "string"
      },
      "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 `SessionResmumptionTokenUpdate`. 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 arelikely not needed.",
               "title": "Lastconsumedclientmessageindex"
            }
         },
         "title": "LiveServerSessionResumptionUpdate",
         "type": "object"
      },
      "MediaModality": {
         "description": "Server content modalities.",
         "enum": [
            "MODALITY_UNSPECIFIED",
            "TEXT",
            "IMAGE",
            "VIDEO",
            "AUDIO",
            "DOCUMENT"
         ],
         "title": "MediaModality",
         "type": "string"
      },
      "ModalityTokenCount": {
         "additionalProperties": false,
         "description": "Represents token counting info for a single modality.",
         "properties": {
            "modality": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/MediaModality"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The modality associated with this token count."
            },
            "tokenCount": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Number of tokens.",
               "title": "Tokencount"
            }
         },
         "title": "ModalityTokenCount",
         "type": "object"
      },
      "OAuth2": {
         "additionalProperties": true,
         "properties": {
            "type": {
               "$ref": "#/$defs/SecuritySchemeType",
               "default": "oauth2"
            },
            "description": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Description"
            },
            "flows": {
               "$ref": "#/$defs/OAuthFlows"
            }
         },
         "required": [
            "flows"
         ],
         "title": "OAuth2",
         "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"
            },
            "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"
            },
            "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"
            }
         },
         "title": "OAuth2Auth",
         "type": "object"
      },
      "OAuthFlowAuthorizationCode": {
         "additionalProperties": true,
         "properties": {
            "refreshUrl": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Refreshurl"
            },
            "scopes": {
               "additionalProperties": {
                  "type": "string"
               },
               "default": {},
               "title": "Scopes",
               "type": "object"
            },
            "authorizationUrl": {
               "title": "Authorizationurl",
               "type": "string"
            },
            "tokenUrl": {
               "title": "Tokenurl",
               "type": "string"
            }
         },
         "required": [
            "authorizationUrl",
            "tokenUrl"
         ],
         "title": "OAuthFlowAuthorizationCode",
         "type": "object"
      },
      "OAuthFlowClientCredentials": {
         "additionalProperties": true,
         "properties": {
            "refreshUrl": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Refreshurl"
            },
            "scopes": {
               "additionalProperties": {
                  "type": "string"
               },
               "default": {},
               "title": "Scopes",
               "type": "object"
            },
            "tokenUrl": {
               "title": "Tokenurl",
               "type": "string"
            }
         },
         "required": [
            "tokenUrl"
         ],
         "title": "OAuthFlowClientCredentials",
         "type": "object"
      },
      "OAuthFlowImplicit": {
         "additionalProperties": true,
         "properties": {
            "refreshUrl": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Refreshurl"
            },
            "scopes": {
               "additionalProperties": {
                  "type": "string"
               },
               "default": {},
               "title": "Scopes",
               "type": "object"
            },
            "authorizationUrl": {
               "title": "Authorizationurl",
               "type": "string"
            }
         },
         "required": [
            "authorizationUrl"
         ],
         "title": "OAuthFlowImplicit",
         "type": "object"
      },
      "OAuthFlowPassword": {
         "additionalProperties": true,
         "properties": {
            "refreshUrl": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Refreshurl"
            },
            "scopes": {
               "additionalProperties": {
                  "type": "string"
               },
               "default": {},
               "title": "Scopes",
               "type": "object"
            },
            "tokenUrl": {
               "title": "Tokenurl",
               "type": "string"
            }
         },
         "required": [
            "tokenUrl"
         ],
         "title": "OAuthFlowPassword",
         "type": "object"
      },
      "OAuthFlows": {
         "additionalProperties": true,
         "properties": {
            "implicit": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/OAuthFlowImplicit"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "password": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/OAuthFlowPassword"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "clientCredentials": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/OAuthFlowClientCredentials"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "authorizationCode": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/OAuthFlowAuthorizationCode"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            }
         },
         "title": "OAuthFlows",
         "type": "object"
      },
      "OpenIdConnect": {
         "additionalProperties": true,
         "properties": {
            "type": {
               "$ref": "#/$defs/SecuritySchemeType",
               "default": "openIdConnect"
            },
            "description": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Description"
            },
            "openIdConnectUrl": {
               "title": "Openidconnecturl",
               "type": "string"
            }
         },
         "required": [
            "openIdConnectUrl"
         ],
         "title": "OpenIdConnect",
         "type": "object"
      },
      "OpenIdConnectWithConfig": {
         "additionalProperties": true,
         "properties": {
            "type": {
               "$ref": "#/$defs/SecuritySchemeType",
               "default": "openIdConnect"
            },
            "description": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Description"
            },
            "authorization_endpoint": {
               "title": "Authorization Endpoint",
               "type": "string"
            },
            "token_endpoint": {
               "title": "Token Endpoint",
               "type": "string"
            },
            "userinfo_endpoint": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Userinfo Endpoint"
            },
            "revocation_endpoint": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Revocation Endpoint"
            },
            "token_endpoint_auth_methods_supported": {
               "anyOf": [
                  {
                     "items": {
                        "type": "string"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Token Endpoint Auth Methods Supported"
            },
            "grant_types_supported": {
               "anyOf": [
                  {
                     "items": {
                        "type": "string"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Grant Types Supported"
            },
            "scopes": {
               "anyOf": [
                  {
                     "items": {
                        "type": "string"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Scopes"
            }
         },
         "required": [
            "authorization_endpoint",
            "token_endpoint"
         ],
         "title": "OpenIdConnectWithConfig",
         "type": "object"
      },
      "Outcome": {
         "description": "Required. 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": {
            "videoMetadata": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/VideoMetadata"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Metadata for a given video."
            },
            "thought": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Indicates if the part is thought from the model.",
               "title": "Thought"
            },
            "inlineData": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/Blob"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Inlined bytes data."
            },
            "fileData": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/FileData"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. URI based data."
            },
            "thoughtSignature": {
               "anyOf": [
                  {
                     "format": "base64url",
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "An opaque signature for the thought so it can be reused in subsequent requests.",
               "title": "Thoughtsignature"
            },
            "codeExecutionResult": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/CodeExecutionResult"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Result of executing the [ExecutableCode]."
            },
            "executableCode": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/ExecutableCode"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Code generated by the model that is meant to be executed."
            },
            "functionCall": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/FunctionCall"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. A predicted [FunctionCall] returned from the model that contains a string representing the [FunctionDeclaration.name] with the parameters and their values."
            },
            "functionResponse": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/FunctionResponse"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. The result output of a [FunctionCall] that contains a string representing the [FunctionDeclaration.name] and a structured JSON object containing any output from the function call. It is used as context to the model."
            },
            "text": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Text part (can be code).",
               "title": "Text"
            }
         },
         "title": "Part",
         "type": "object"
      },
      "RagChunk": {
         "additionalProperties": false,
         "description": "A RagChunk includes the content of a chunk of a RagFile, and associated metadata.",
         "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"
            }
         },
         "title": "RagChunk",
         "type": "object"
      },
      "RagChunkPageSpan": {
         "additionalProperties": false,
         "description": "Represents where the chunk starts and ends in the document.",
         "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"
      },
      "RetrievalMetadata": {
         "additionalProperties": false,
         "description": "Metadata related to retrieval in the grounding flow.",
         "properties": {
            "googleSearchDynamicRetrievalScore": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Score indicating how likely information from Google Search could help answer the prompt. The score is in the range `[0, 1]`, where 0 is the least likely and 1 is the most likely. This score is only populated when Google Search grounding and dynamic retrieval is enabled. It will be compared to the threshold to determine whether to trigger Google Search.",
               "title": "Googlesearchdynamicretrievalscore"
            }
         },
         "title": "RetrievalMetadata",
         "type": "object"
      },
      "SearchEntryPoint": {
         "additionalProperties": false,
         "description": "Google search entry point.",
         "properties": {
            "renderedContent": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Web content snippet that can be embedded in a web page or an app webview.",
               "title": "Renderedcontent"
            },
            "sdkBlob": {
               "anyOf": [
                  {
                     "format": "base64url",
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Base64 encoded JSON representing array of tuple.",
               "title": "Sdkblob"
            }
         },
         "title": "SearchEntryPoint",
         "type": "object"
      },
      "SecuritySchemeType": {
         "enum": [
            "apiKey",
            "http",
            "oauth2",
            "openIdConnect"
         ],
         "title": "SecuritySchemeType",
         "type": "string"
      },
      "Segment": {
         "additionalProperties": false,
         "description": "Segment of the content.",
         "properties": {
            "endIndex": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Output only. End index in the given Part, measured in bytes. 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 Content object.",
               "title": "Partindex"
            },
            "startIndex": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Output only. Start index in the given Part, measured in bytes. Offset from the start of the Part, inclusive, starting at zero.",
               "title": "Startindex"
            },
            "text": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Output only. The text corresponding to the segment from the response.",
               "title": "Text"
            }
         },
         "title": "Segment",
         "type": "object"
      },
      "ServiceAccount": {
         "additionalProperties": true,
         "description": "Represents Google Service Account configuration.",
         "properties": {
            "serviceAccountCredential": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/ServiceAccountCredential"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "scopes": {
               "items": {
                  "type": "string"
               },
               "title": "Scopes",
               "type": "array"
            },
            "useDefaultCredential": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": false,
               "title": "Usedefaultcredential"
            }
         },
         "required": [
            "scopes"
         ],
         "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"
      },
      "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"
      },
      "TrafficType": {
         "description": "Output only.\n\nTraffic type. This shows whether a request consumes Pay-As-You-Go or\nProvisioned Throughput quota.",
         "enum": [
            "TRAFFIC_TYPE_UNSPECIFIED",
            "ON_DEMAND",
            "PROVISIONED_THROUGHPUT"
         ],
         "title": "TrafficType",
         "type": "string"
      },
      "Transcription": {
         "additionalProperties": false,
         "description": "Audio transcription in Server Conent.",
         "properties": {
            "text": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Transcription text.\n      ",
               "title": "Text"
            },
            "finished": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The bool indicates the end of the transcription.\n      ",
               "title": "Finished"
            }
         },
         "title": "Transcription",
         "type": "object"
      },
      "VideoMetadata": {
         "additionalProperties": false,
         "description": "Describes how the video in the Part should be used by the model.",
         "properties": {
            "fps": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The frame rate of the video sent to the model. If not specified, the\n        default value will be 1.0. The fps range is (0.0, 24.0].",
               "title": "Fps"
            },
            "endOffset": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. The end offset of the video.",
               "title": "Endoffset"
            },
            "startOffset": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. The start offset of the video.",
               "title": "Startoffset"
            }
         },
         "title": "VideoMetadata",
         "type": "object"
      }
   },
   "additionalProperties": false,
   "required": [
      "id",
      "appName",
      "userId"
   ]
}

Fields:
  • app_name (str)

  • events (list[google.adk.events.event.Event])

  • id (str)

  • last_update_time (float)

  • state (dict[str, Any])

  • user_id (str)

field app_name: str [Required] (alias 'appName')

The name of the app.

field events: list[Event] [Optional]

The events of the session, e.g. user input, model response, function call/response, etc.

field id: str [Required]

The unique identifier of the session.

field last_update_time: float = 0.0 (alias 'lastUpdateTime')

The last update time of the session.

field state: dict[str, Any] [Optional]

The state of the session.

field user_id: str [Required] (alias 'userId')

The id of the user.

class google.adk.sessions.State(value, delta)

Bases: object

A state dict that maintain the current value and the pending-commit delta.

Parameters:
  • value – The current value of the state dict.

  • delta – The delta change to the current value that hasn’t been committed.

APP_PREFIX = 'app:'
TEMP_PREFIX = 'temp:'
USER_PREFIX = 'user:'
get(key, default=None)

Returns the value of the state dict for the given key.

Return type:

Any

has_delta()

Whether the state has pending delta.

Return type:

bool

setdefault(key, default=None)

Gets the value of a key, or sets it to a default if the key doesn’t exist.

Return type:

Any

to_dict()

Returns the state dict.

Return type:

dict[str, Any]

update(delta)

Updates the state dict with the given delta.

class google.adk.sessions.VertexAiSessionService(project=None, location=None, agent_engine_id=None)

Bases: BaseSessionService

Connects to the Vertex AI Agent Engine Session Service using GenAI API client.

https://cloud.google.com/vertex-ai/generative-ai/docs/agent-engine/sessions/overview

Initializes the VertexAiSessionService.

Parameters:
  • project – The project id of the project to use.

  • location – The location of the project to use.

  • agent_engine_id – The resource ID of the agent engine to use.

async append_event(session, event)

Appends an event to a session object.

Return type:

Event

async create_session(*, app_name, user_id, state=None, session_id=None)

Creates a new session.

Return type:

Session

Parameters:
  • app_name – the name of the app.

  • user_id – the id of the user.

  • state – the initial state of the session.

  • session_id – the client-provided id of the session. If not provided, a generated ID will be used.

Returns:

The newly created session instance.

Return type:

session

async delete_session(*, app_name, user_id, session_id)

Deletes a session.

Return type:

None

async get_session(*, app_name, user_id, session_id, config=None)

Gets a session.

Return type:

Optional[Session]

async list_sessions(*, app_name, user_id)

Lists all the sessions.

Return type:

ListSessionsResponse

google.adk.telemetry module

google.adk.telemetry.trace_call_llm(invocation_context, event_id, llm_request, llm_response)

Traces a call to the LLM.

This function records details about the LLM request and response as attributes on the current OpenTelemetry span.

Parameters:
  • invocation_context – The invocation context for the current agent run.

  • event_id – The ID of the event.

  • llm_request – The LLM request object.

  • llm_response – The LLM response object.

google.adk.telemetry.trace_merged_tool_calls(response_event_id, function_response_event)

Traces merged tool call events.

Calling this function is not needed for telemetry purposes. This is provided for preventing /debug/trace requests (typically sent by web UI).

Parameters:
  • response_event_id – The ID of the response event.

  • function_response_event – The merged response event.

google.adk.telemetry.trace_send_data(invocation_context, event_id, data)

Traces the sending of data to the agent.

This function records details about the data sent to the agent as attributes on the current OpenTelemetry span.

Parameters:
  • invocation_context – The invocation context for the current agent run.

  • event_id – The ID of the event.

  • data – A list of content objects.

google.adk.telemetry.trace_tool_call(tool, args, function_response_event)

Traces tool call.

Parameters:
  • tool – The tool that was called.

  • args – The arguments to the tool call.

  • function_response_event – The event with the function response details.

google.adk.tools package

class google.adk.tools.APIHubToolset(*, apihub_resource_name, access_token=None, service_account_json=None, name='', description='', lazy_load_spec=False, auth_scheme=None, auth_credential=None, apihub_client=None, tool_filter=None)

Bases: BaseToolset

APIHubTool generates tools from a given API Hub resource.

Examples:

apihub_toolset = APIHubToolset(
    apihub_resource_name="projects/test-project/locations/us-central1/apis/test-api",
    service_account_json="...",
    tool_filter=lambda tool, ctx=None: tool.name in ('my_tool',
    'my_other_tool')
)

# Get all available tools
agent = LlmAgent(tools=apihub_toolset)

apihub_resource_name is the resource name from API Hub. It must include API name, and can optionally include API version and spec name.

  • If apihub_resource_name includes a spec resource name, the content of that spec will be used for generating the tools.

  • If apihub_resource_name includes only an api or a version name, the first spec of the first version of that API will be used.

Initializes the APIHubTool with the given parameters.

Examples:

apihub_toolset = APIHubToolset(
    apihub_resource_name="projects/test-project/locations/us-central1/apis/test-api",
    service_account_json="...",
)

# Get all available tools
agent = LlmAgent(tools=[apihub_toolset])

apihub_toolset = APIHubToolset(
    apihub_resource_name="projects/test-project/locations/us-central1/apis/test-api",
    service_account_json="...",
    tool_filter = ['my_tool']
)
# Get a specific tool
agent = LlmAgent(tools=[
    ...,
    apihub_toolset,
])

apihub_resource_name is the resource name from API Hub. It must include API name, and can optionally include API version and spec name.

  • If apihub_resource_name includes a spec resource name, the content of that spec will be used for generating the tools.

  • If apihub_resource_name includes only an api or a version name, the first spec of the first version of that API will be used.

Example:

Parameters:
  • apihub_resource_name – The resource name of the API in API Hub. Example: projects/test-project/locations/us-central1/apis/test-api.

  • access_token – Google Access token. Generate with gcloud cli gcloud auth auth print-access-token. Used for fetching API Specs from API Hub.

  • service_account_json – The service account config as a json string. Required if not using default service credential. It is used for creating the API Hub client and fetching the API Specs from API Hub.

  • apihub_client – Optional custom API Hub client.

  • name – Name of the toolset. Optional.

  • description – Description of the toolset. Optional.

  • auth_scheme – Auth scheme that applies to all the tool in the toolset.

  • auth_credential – Auth credential that applies to all the tool in the toolset.

  • lazy_load_spec – If True, the spec will be loaded lazily when needed. Otherwise, the spec will be loaded immediately and the tools will be generated during initialization.

  • tool_filter – The filter used to filter the tools in the toolset. It can be either a tool predicate or a list of tool names of the tools to expose.

async close()

Performs cleanup and releases resources held by the toolset.

Note

This method is invoked, for example, at the end of an agent server’s lifecycle or when the toolset is no longer needed. Implementations should ensure that any open connections, files, or other managed resources are properly released to prevent leaks.

async get_tools(readonly_context=None)

Retrieves all available tools.

Return type:

List[RestApiTool]

Returns:

A list of all available RestApiTool objects.

class google.adk.tools.AgentTool(agent, skip_summarization=False)

Bases: BaseTool

A tool that wraps an agent.

This tool allows an agent to be called as a tool within a larger application. The agent’s input schema is used to define the tool’s input parameters, and the agent’s output is returned as the tool’s result.

agent

The agent to wrap.

skip_summarization

Whether to skip summarization of the agent output.

classmethod from_config(config, config_abs_path)

Creates a tool instance from a config.

This default implementation uses inspect to automatically map config values to constructor arguments based on their type hints. Subclasses should override this method for custom initialization logic.

Return type:

AgentTool

Parameters:
  • config – The config for the tool.

  • config_abs_path – The absolute path to the config file that contains the tool config.

Returns:

The tool instance.

populate_name()
Return type:

Any

async run_async(*, args, tool_context)

Runs the tool with the given arguments and context.

Return type:

Any

Note

  • Required if this tool needs to run at the client side.

  • Otherwise, can be skipped, e.g. for a built-in GoogleSearch tool for Gemini.

Parameters:
  • args – The LLM-filled arguments.

  • tool_context – The context of the tool.

Returns:

The result of running the tool.

pydantic model google.adk.tools.AuthToolArguments

Bases: BaseModelWithConfig

the arguments for the special long running function tool that is used to

request end user credentials.

Show JSON schema
{
   "title": "AuthToolArguments",
   "description": "the arguments for the special long running function tool that is used to\n\nrequest end user credentials.",
   "type": "object",
   "properties": {
      "functionCallId": {
         "title": "Functioncallid",
         "type": "string"
      },
      "authConfig": {
         "$ref": "#/$defs/AuthConfig"
      }
   },
   "$defs": {
      "APIKey": {
         "additionalProperties": true,
         "properties": {
            "type": {
               "$ref": "#/$defs/SecuritySchemeType",
               "default": "apiKey"
            },
            "description": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Description"
            },
            "in": {
               "$ref": "#/$defs/APIKeyIn"
            },
            "name": {
               "title": "Name",
               "type": "string"
            }
         },
         "required": [
            "in",
            "name"
         ],
         "title": "APIKey",
         "type": "object"
      },
      "APIKeyIn": {
         "enum": [
            "query",
            "header",
            "cookie"
         ],
         "title": "APIKeyIn",
         "type": "string"
      },
      "AuthConfig": {
         "additionalProperties": true,
         "description": "The auth config sent by tool asking client to collect auth credentials and\n\nadk and client will help to fill in the response",
         "properties": {
            "authScheme": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/APIKey"
                  },
                  {
                     "$ref": "#/$defs/HTTPBase"
                  },
                  {
                     "$ref": "#/$defs/OAuth2"
                  },
                  {
                     "$ref": "#/$defs/OpenIdConnect"
                  },
                  {
                     "$ref": "#/$defs/HTTPBearer"
                  },
                  {
                     "$ref": "#/$defs/OpenIdConnectWithConfig"
                  }
               ],
               "title": "Authscheme"
            },
            "rawAuthCredential": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/AuthCredential"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "exchangedAuthCredential": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/AuthCredential"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "credentialKey": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Credentialkey"
            }
         },
         "required": [
            "authScheme"
         ],
         "title": "AuthConfig",
         "type": "object"
      },
      "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"
      },
      "HTTPBase": {
         "additionalProperties": true,
         "properties": {
            "type": {
               "$ref": "#/$defs/SecuritySchemeType",
               "default": "http"
            },
            "description": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Description"
            },
            "scheme": {
               "title": "Scheme",
               "type": "string"
            }
         },
         "required": [
            "scheme"
         ],
         "title": "HTTPBase",
         "type": "object"
      },
      "HTTPBearer": {
         "additionalProperties": true,
         "properties": {
            "type": {
               "$ref": "#/$defs/SecuritySchemeType",
               "default": "http"
            },
            "description": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Description"
            },
            "scheme": {
               "const": "bearer",
               "default": "bearer",
               "title": "Scheme",
               "type": "string"
            },
            "bearerFormat": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Bearerformat"
            }
         },
         "title": "HTTPBearer",
         "type": "object"
      },
      "HttpAuth": {
         "additionalProperties": true,
         "description": "The credentials and metadata for HTTP authentication.",
         "properties": {
            "scheme": {
               "title": "Scheme",
               "type": "string"
            },
            "credentials": {
               "$ref": "#/$defs/HttpCredentials"
            }
         },
         "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"
      },
      "OAuth2": {
         "additionalProperties": true,
         "properties": {
            "type": {
               "$ref": "#/$defs/SecuritySchemeType",
               "default": "oauth2"
            },
            "description": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Description"
            },
            "flows": {
               "$ref": "#/$defs/OAuthFlows"
            }
         },
         "required": [
            "flows"
         ],
         "title": "OAuth2",
         "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"
            },
            "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"
            },
            "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"
            }
         },
         "title": "OAuth2Auth",
         "type": "object"
      },
      "OAuthFlowAuthorizationCode": {
         "additionalProperties": true,
         "properties": {
            "refreshUrl": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Refreshurl"
            },
            "scopes": {
               "additionalProperties": {
                  "type": "string"
               },
               "default": {},
               "title": "Scopes",
               "type": "object"
            },
            "authorizationUrl": {
               "title": "Authorizationurl",
               "type": "string"
            },
            "tokenUrl": {
               "title": "Tokenurl",
               "type": "string"
            }
         },
         "required": [
            "authorizationUrl",
            "tokenUrl"
         ],
         "title": "OAuthFlowAuthorizationCode",
         "type": "object"
      },
      "OAuthFlowClientCredentials": {
         "additionalProperties": true,
         "properties": {
            "refreshUrl": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Refreshurl"
            },
            "scopes": {
               "additionalProperties": {
                  "type": "string"
               },
               "default": {},
               "title": "Scopes",
               "type": "object"
            },
            "tokenUrl": {
               "title": "Tokenurl",
               "type": "string"
            }
         },
         "required": [
            "tokenUrl"
         ],
         "title": "OAuthFlowClientCredentials",
         "type": "object"
      },
      "OAuthFlowImplicit": {
         "additionalProperties": true,
         "properties": {
            "refreshUrl": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Refreshurl"
            },
            "scopes": {
               "additionalProperties": {
                  "type": "string"
               },
               "default": {},
               "title": "Scopes",
               "type": "object"
            },
            "authorizationUrl": {
               "title": "Authorizationurl",
               "type": "string"
            }
         },
         "required": [
            "authorizationUrl"
         ],
         "title": "OAuthFlowImplicit",
         "type": "object"
      },
      "OAuthFlowPassword": {
         "additionalProperties": true,
         "properties": {
            "refreshUrl": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Refreshurl"
            },
            "scopes": {
               "additionalProperties": {
                  "type": "string"
               },
               "default": {},
               "title": "Scopes",
               "type": "object"
            },
            "tokenUrl": {
               "title": "Tokenurl",
               "type": "string"
            }
         },
         "required": [
            "tokenUrl"
         ],
         "title": "OAuthFlowPassword",
         "type": "object"
      },
      "OAuthFlows": {
         "additionalProperties": true,
         "properties": {
            "implicit": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/OAuthFlowImplicit"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "password": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/OAuthFlowPassword"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "clientCredentials": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/OAuthFlowClientCredentials"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "authorizationCode": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/OAuthFlowAuthorizationCode"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            }
         },
         "title": "OAuthFlows",
         "type": "object"
      },
      "OpenIdConnect": {
         "additionalProperties": true,
         "properties": {
            "type": {
               "$ref": "#/$defs/SecuritySchemeType",
               "default": "openIdConnect"
            },
            "description": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Description"
            },
            "openIdConnectUrl": {
               "title": "Openidconnecturl",
               "type": "string"
            }
         },
         "required": [
            "openIdConnectUrl"
         ],
         "title": "OpenIdConnect",
         "type": "object"
      },
      "OpenIdConnectWithConfig": {
         "additionalProperties": true,
         "properties": {
            "type": {
               "$ref": "#/$defs/SecuritySchemeType",
               "default": "openIdConnect"
            },
            "description": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Description"
            },
            "authorization_endpoint": {
               "title": "Authorization Endpoint",
               "type": "string"
            },
            "token_endpoint": {
               "title": "Token Endpoint",
               "type": "string"
            },
            "userinfo_endpoint": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Userinfo Endpoint"
            },
            "revocation_endpoint": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Revocation Endpoint"
            },
            "token_endpoint_auth_methods_supported": {
               "anyOf": [
                  {
                     "items": {
                        "type": "string"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Token Endpoint Auth Methods Supported"
            },
            "grant_types_supported": {
               "anyOf": [
                  {
                     "items": {
                        "type": "string"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Grant Types Supported"
            },
            "scopes": {
               "anyOf": [
                  {
                     "items": {
                        "type": "string"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Scopes"
            }
         },
         "required": [
            "authorization_endpoint",
            "token_endpoint"
         ],
         "title": "OpenIdConnectWithConfig",
         "type": "object"
      },
      "SecuritySchemeType": {
         "enum": [
            "apiKey",
            "http",
            "oauth2",
            "openIdConnect"
         ],
         "title": "SecuritySchemeType",
         "type": "string"
      },
      "ServiceAccount": {
         "additionalProperties": true,
         "description": "Represents Google Service Account configuration.",
         "properties": {
            "serviceAccountCredential": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/ServiceAccountCredential"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "scopes": {
               "items": {
                  "type": "string"
               },
               "title": "Scopes",
               "type": "array"
            },
            "useDefaultCredential": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": false,
               "title": "Usedefaultcredential"
            }
         },
         "required": [
            "scopes"
         ],
         "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"
      }
   },
   "additionalProperties": true,
   "required": [
      "functionCallId",
      "authConfig"
   ]
}

Fields:
  • auth_config (google.adk.auth.auth_tool.AuthConfig)

  • function_call_id (str)

field auth_config: AuthConfig [Required] (alias 'authConfig')
field function_call_id: str [Required] (alias 'functionCallId')
class google.adk.tools.BaseTool(*, name, description, is_long_running=False, custom_metadata=None)

Bases: ABC

The base class for all tools.

custom_metadata: Optional[dict[str, Any]] = None

The custom metadata of the BaseTool.

An optional key-value pair for storing and retrieving tool-specific metadata, such as tool manifests, etc.

NOTE: the entire dict must be JSON serializable.

description: str

The description of the tool.

classmethod from_config(config, config_abs_path)

Creates a tool instance from a config.

This default implementation uses inspect to automatically map config values to constructor arguments based on their type hints. Subclasses should override this method for custom initialization logic.

Return type:

TypeVar(SelfTool, bound= BaseTool)

Parameters:
  • config – The config for the tool.

  • config_abs_path – The absolute path to the config file that contains the tool config.

Returns:

The tool instance.

is_long_running: bool = False

Whether the tool is a long running operation, which typically returns a resource id first and finishes the operation later.

name: str

The name of the tool.

async process_llm_request(*, tool_context, llm_request)

Processes the outgoing LLM request for this tool.

Use cases: - Most common use case is adding this tool to the LLM request. - Some tools may just preprocess the LLM request before it’s sent out.

Return type:

None

Parameters:
  • tool_context – The context of the tool.

  • llm_request – The outgoing LLM request, mutable this method.

async run_async(*, args, tool_context)

Runs the tool with the given arguments and context.

Return type:

Any

Note

  • Required if this tool needs to run at the client side.

  • Otherwise, can be skipped, e.g. for a built-in GoogleSearch tool for Gemini.

Parameters:
  • args – The LLM-filled arguments.

  • tool_context – The context of the tool.

Returns:

The result of running the tool.

class google.adk.tools.ExampleTool(examples)

Bases: BaseTool

A tool that adds (few-shot) examples to the LLM request.

examples

The examples to add to the LLM request.

classmethod from_config(config, config_abs_path)

Creates a tool instance from a config.

This default implementation uses inspect to automatically map config values to constructor arguments based on their type hints. Subclasses should override this method for custom initialization logic.

Return type:

ExampleTool

Parameters:
  • config – The config for the tool.

  • config_abs_path – The absolute path to the config file that contains the tool config.

Returns:

The tool instance.

async process_llm_request(*, tool_context, llm_request)

Processes the outgoing LLM request for this tool.

Use cases: - Most common use case is adding this tool to the LLM request. - Some tools may just preprocess the LLM request before it’s sent out.

Return type:

None

Parameters:
  • tool_context – The context of the tool.

  • llm_request – The outgoing LLM request, mutable this method.

class google.adk.tools.FunctionTool(func, *, require_confirmation=False)

Bases: BaseTool

A tool that wraps a user-defined Python function.

func

The function to wrap.

Initializes the FunctionTool. Extracts metadata from a callable object.

Parameters:
  • func – The function to wrap.

  • require_confirmation – Wether this tool requires confirmation. A boolean or a callable that takes the function’s arguments and returns a boolean. If the callable returns True, the tool will require confirmation from the user.

async run_async(*, args, tool_context)

Runs the tool with the given arguments and context.

Return type:

Any

Note

  • Required if this tool needs to run at the client side.

  • Otherwise, can be skipped, e.g. for a built-in GoogleSearch tool for Gemini.

Parameters:
  • args – The LLM-filled arguments.

  • tool_context – The context of the tool.

Returns:

The result of running the tool.

class google.adk.tools.LongRunningFunctionTool(func)

Bases: FunctionTool

A function tool that returns the result asynchronously.

This tool is used for long-running operations that may take a significant amount of time to complete. The framework will call the function. Once the function returns, the response will be returned asynchronously to the framework which is identified by the function_call_id.

Example: `python tool = LongRunningFunctionTool(a_long_running_function) `

is_long_running

Whether the tool is a long running operation.

Initializes the FunctionTool. Extracts metadata from a callable object.

Parameters:
  • func – The function to wrap.

  • require_confirmation – Wether this tool requires confirmation. A boolean or a callable that takes the function’s arguments and returns a boolean. If the callable returns True, the tool will require confirmation from the user.

class google.adk.tools.MCPToolset(*args, **kwargs)

Bases: McpToolset

Deprecated name, use McpToolset instead.

Initializes the MCPToolset.

Parameters:
  • connection_params – The connection parameters to the MCP server. Can be: StdioConnectionParams for using local mcp server (e.g. using npx or python3); or SseConnectionParams for a local/remote SSE server; or StreamableHTTPConnectionParams for local/remote Streamable http server. Note, StdioServerParameters is also supported for using local mcp server (e.g. using npx or python3 ), but it does not support timeout, and we recommend to use StdioConnectionParams instead when timeout is needed.

  • tool_filter – Optional filter to select specific tools. Can be either: - A list of tool names to include - A ToolPredicate function for custom filtering logic

  • errlog – TextIO stream for error logging.

  • auth_scheme – The auth scheme of the tool for tool calling

  • auth_credential – The auth credential of the tool for tool calling

class google.adk.tools.ToolContext(invocation_context, *, function_call_id=None, event_actions=None, tool_confirmation=None)

Bases: CallbackContext

The context of the tool.

This class provides the context for a tool invocation, including access to the invocation context, function call ID, event actions, and authentication response. It also provides methods for requesting credentials, retrieving authentication responses, listing artifacts, and searching memory.

invocation_context

The invocation context of the tool.

function_call_id

The function call id of the current tool call. This id was returned in the function call event from LLM to identify a function call. If LLM didn’t return this id, ADK will assign one to it. This id is used to map function call response to the original function call.

event_actions

The event actions of the current tool call.

tool_confirmation

The tool confirmation of the current tool call.

property actions: EventActions
get_auth_response(auth_config)
Return type:

AuthCredential

request_confirmation(*, hint=None, payload=None)

Requests confirmation for the given function call.

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.

request_credential(auth_config)
Return type:

None

async search_memory(query)

Searches the memory of the current user.

Return type:

SearchMemoryResponse

class google.adk.tools.VertexAiSearchTool(*, data_store_id=None, data_store_specs=None, search_engine_id=None, filter=None, max_results=None)

Bases: BaseTool

A built-in tool using Vertex AI Search.

data_store_id

The Vertex AI search data store resource ID.

search_engine_id

The Vertex AI search engine resource ID.

Initializes the Vertex AI Search tool.

Parameters:
  • data_store_id – The Vertex AI search data store resource ID in the format of “projects/{project}/locations/{location}/collections/{collection}/dataStores/{dataStore}”.

  • data_store_specs – Specifications that define the specific DataStores to be searched. It should only be set if engine is used.

  • search_engine_id – The Vertex AI search engine resource ID in the format of “projects/{project}/locations/{location}/collections/{collection}/engines/{engine}”.

Raises:
  • ValueError – If both data_store_id and search_engine_id are not specified

  • or both are specified.

async process_llm_request(*, tool_context, llm_request)

Processes the outgoing LLM request for this tool.

Use cases: - Most common use case is adding this tool to the LLM request. - Some tools may just preprocess the LLM request before it’s sent out.

Return type:

None

Parameters:
  • tool_context – The context of the tool.

  • llm_request – The outgoing LLM request, mutable this method.

google.adk.tools.exit_loop(tool_context)

Exits the loop.

Call this function only when you are instructed to do so.

google.adk.tools.transfer_to_agent(agent_name, tool_context)

Transfer the question to another agent.

This tool hands off control to another agent when it’s more suitable to answer the user’s question according to the agent’s description.

Return type:

None

Parameters:

agent_name – the agent name to transfer to.

google.adk.tools.agent_tool module

class google.adk.tools.agent_tool.AgentTool(agent, skip_summarization=False)

Bases: BaseTool

A tool that wraps an agent.

This tool allows an agent to be called as a tool within a larger application. The agent’s input schema is used to define the tool’s input parameters, and the agent’s output is returned as the tool’s result.

agent

The agent to wrap.

skip_summarization

Whether to skip summarization of the agent output.

classmethod from_config(config, config_abs_path)

Creates a tool instance from a config.

This default implementation uses inspect to automatically map config values to constructor arguments based on their type hints. Subclasses should override this method for custom initialization logic.

Return type:

AgentTool

Parameters:
  • config – The config for the tool.

  • config_abs_path – The absolute path to the config file that contains the tool config.

Returns:

The tool instance.

populate_name()
Return type:

Any

async run_async(*, args, tool_context)

Runs the tool with the given arguments and context.

Return type:

Any

Note

  • Required if this tool needs to run at the client side.

  • Otherwise, can be skipped, e.g. for a built-in GoogleSearch tool for Gemini.

Parameters:
  • args – The LLM-filled arguments.

  • tool_context – The context of the tool.

Returns:

The result of running the tool.

pydantic model google.adk.tools.agent_tool.AgentToolConfig

Bases: BaseToolConfig

The config for the AgentTool.

Show JSON schema
{
   "title": "AgentToolConfig",
   "description": "The config for the AgentTool.",
   "type": "object",
   "properties": {
      "agent": {
         "$ref": "#/$defs/AgentRefConfig"
      },
      "skip_summarization": {
         "default": false,
         "title": "Skip Summarization",
         "type": "boolean"
      }
   },
   "$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"
      }
   },
   "additionalProperties": false,
   "required": [
      "agent"
   ]
}

Fields:
field agent: AgentRefConfig [Required]

The reference to the agent instance.

field skip_summarization: bool = False

Whether to skip summarization of the agent output.

google.adk.tools.apihub_tool module

class google.adk.tools.apihub_tool.APIHubToolset(*, apihub_resource_name, access_token=None, service_account_json=None, name='', description='', lazy_load_spec=False, auth_scheme=None, auth_credential=None, apihub_client=None, tool_filter=None)

Bases: BaseToolset

APIHubTool generates tools from a given API Hub resource.

Examples:

apihub_toolset = APIHubToolset(
    apihub_resource_name="projects/test-project/locations/us-central1/apis/test-api",
    service_account_json="...",
    tool_filter=lambda tool, ctx=None: tool.name in ('my_tool',
    'my_other_tool')
)

# Get all available tools
agent = LlmAgent(tools=apihub_toolset)

apihub_resource_name is the resource name from API Hub. It must include API name, and can optionally include API version and spec name.

  • If apihub_resource_name includes a spec resource name, the content of that spec will be used for generating the tools.

  • If apihub_resource_name includes only an api or a version name, the first spec of the first version of that API will be used.

Initializes the APIHubTool with the given parameters.

Examples:

apihub_toolset = APIHubToolset(
    apihub_resource_name="projects/test-project/locations/us-central1/apis/test-api",
    service_account_json="...",
)

# Get all available tools
agent = LlmAgent(tools=[apihub_toolset])

apihub_toolset = APIHubToolset(
    apihub_resource_name="projects/test-project/locations/us-central1/apis/test-api",
    service_account_json="...",
    tool_filter = ['my_tool']
)
# Get a specific tool
agent = LlmAgent(tools=[
    ...,
    apihub_toolset,
])

apihub_resource_name is the resource name from API Hub. It must include API name, and can optionally include API version and spec name.

  • If apihub_resource_name includes a spec resource name, the content of that spec will be used for generating the tools.

  • If apihub_resource_name includes only an api or a version name, the first spec of the first version of that API will be used.

Example:

Parameters:
  • apihub_resource_name – The resource name of the API in API Hub. Example: projects/test-project/locations/us-central1/apis/test-api.

  • access_token – Google Access token. Generate with gcloud cli gcloud auth auth print-access-token. Used for fetching API Specs from API Hub.

  • service_account_json – The service account config as a json string. Required if not using default service credential. It is used for creating the API Hub client and fetching the API Specs from API Hub.

  • apihub_client – Optional custom API Hub client.

  • name – Name of the toolset. Optional.

  • description – Description of the toolset. Optional.

  • auth_scheme – Auth scheme that applies to all the tool in the toolset.

  • auth_credential – Auth credential that applies to all the tool in the toolset.

  • lazy_load_spec – If True, the spec will be loaded lazily when needed. Otherwise, the spec will be loaded immediately and the tools will be generated during initialization.

  • tool_filter – The filter used to filter the tools in the toolset. It can be either a tool predicate or a list of tool names of the tools to expose.

async close()

Performs cleanup and releases resources held by the toolset.

Note

This method is invoked, for example, at the end of an agent server’s lifecycle or when the toolset is no longer needed. Implementations should ensure that any open connections, files, or other managed resources are properly released to prevent leaks.

async get_tools(readonly_context=None)

Retrieves all available tools.

Return type:

List[RestApiTool]

Returns:

A list of all available RestApiTool objects.

google.adk.tools.application_integration_tool module

class google.adk.tools.application_integration_tool.ApplicationIntegrationToolset(project, location, integration=None, triggers=None, connection=None, entity_operations=None, actions=None, tool_name_prefix='', tool_instructions='', service_account_json=None, auth_scheme=None, auth_credential=None, tool_filter=None)

Bases: BaseToolset

ApplicationIntegrationToolset generates tools from a given Application Integration or Integration Connector resource.

Example Usage:

# Get all available tools for an integration with api trigger
application_integration_toolset = ApplicationIntegrationToolset(
    project="test-project",
    location="us-central1"
    integration="test-integration",
    triggers=["api_trigger/test_trigger"],
    service_account_credentials={...},
)

# Get all available tools for a connection using entity operations and
# actions
# Note: Find the list of supported entity operations and actions for a
# connection using integration connector apis:
# https://cloud.google.com/integration-connectors/docs/reference/rest/v1/projects.locations.connections.connectionSchemaMetadata
application_integration_toolset = ApplicationIntegrationToolset(
    project="test-project",
    location="us-central1"
    connection="test-connection",
    entity_operations=["EntityId1": ["LIST","CREATE"], "EntityId2": []],
    #empty list for actions means all operations on the entity are supported
    actions=["action1"],
    service_account_credentials={...},
)

# Feed the toolset to agent
agent = LlmAgent(tools=[
    ...,
    application_integration_toolset,
])

Args:

Parameters:
  • project – The GCP project ID.

  • location – The GCP location.

  • integration – The integration name.

  • triggers – The list of trigger names in the integration.

  • connection – The connection name.

  • entity_operations – The entity operations supported by the connection.

  • actions – The actions supported by the connection.

  • tool_name_prefix – The name prefix of the generated tools.

  • tool_instructions – The instructions for the tool.

  • service_account_json – The service account configuration as a dictionary. Required if not using default service credential. Used for fetching the Application Integration or Integration Connector resource.

  • tool_filter – The filter used to filter the tools in the toolset. It can be either a tool predicate or a list of tool names of the tools to expose.

Raises:
  • ValueError – If none of the following conditions are met: - integration is provided. - connection is provided and at least one of entity_operations or actions is provided.

  • Exception – If there is an error during the initialization of the integration or connection client.

async close()

Performs cleanup and releases resources held by the toolset.

Return type:

None

Note

This method is invoked, for example, at the end of an agent server’s lifecycle or when the toolset is no longer needed. Implementations should ensure that any open connections, files, or other managed resources are properly released to prevent leaks.

async get_tools(readonly_context=None)

Return all tools in the toolset based on the provided context.

Return type:

List[RestApiTool]

Parameters:

readonly_context (ReadonlyContext, optional) – Context used to filter tools available to the agent. If None, all tools in the toolset are returned.

Returns:

A list of tools available under the specified context.

Return type:

list[BaseTool]

class google.adk.tools.application_integration_tool.IntegrationConnectorTool(name, description, connection_name, connection_host, connection_service_name, entity, operation, action, rest_api_tool, auth_scheme=None, auth_credential=None)

Bases: BaseTool

A tool that wraps a RestApiTool to interact with a specific Application Integration endpoint.

This tool adds Application Integration specific context like connection details, entity, operation, and action to the underlying REST API call handled by RestApiTool. It prepares the arguments and then delegates the actual API call execution to the contained RestApiTool instance.

  • Generates request params and body

  • Attaches auth credentials to API call.

Example:

# Each API operation in the spec will be turned into its own tool
# Name of the tool is the operationId of that operation, in snake case
operations = OperationGenerator().parse(openapi_spec_dict)
tool = [RestApiTool.from_parsed_operation(o) for o in operations]

Initializes the ApplicationIntegrationTool.

Parameters:
  • name – The name of the tool, typically derived from the API operation. Should be unique and adhere to Gemini function naming conventions (e.g., less than 64 characters).

  • description – A description of what the tool does, usually based on the API operation’s summary or description.

  • connection_name – The name of the Integration Connector connection.

  • connection_host – The hostname or IP address for the connection.

  • connection_service_name – The specific service name within the host.

  • entity – The Integration Connector entity being targeted.

  • operation – The specific operation being performed on the entity.

  • action – The action associated with the operation (e.g., ‘execute’).

  • rest_api_tool – An initialized RestApiTool instance that handles the underlying REST API communication based on an OpenAPI specification operation. This tool will be called by ApplicationIntegrationTool with added connection and context arguments. tool = [RestApiTool.from_parsed_operation(o) for o in operations]

EXCLUDE_FIELDS = ['connection_name', 'service_name', 'host', 'entity', 'operation', 'action', 'dynamic_auth_config']
OPTIONAL_FIELDS = ['page_size', 'page_token', 'filter', 'sortByColumns']
async run_async(*, args, tool_context)

Runs the tool with the given arguments and context.

Return type:

Dict[str, Any]

Note

  • Required if this tool needs to run at the client side.

  • Otherwise, can be skipped, e.g. for a built-in GoogleSearch tool for Gemini.

Parameters:
  • args – The LLM-filled arguments.

  • tool_context – The context of the tool.

Returns:

The result of running the tool.

google.adk.tools.authenticated_function_tool module

class google.adk.tools.authenticated_function_tool.AuthenticatedFunctionTool(*, func, auth_config=None, response_for_auth_required=None)

Bases: FunctionTool

A FunctionTool that handles authentication before the actual tool logic gets called. Functions can accept a special credential argument which is the credential ready for use.(Experimental)

Initializes the AuthenticatedFunctionTool.

Parameters:
  • func – The function to be called.

  • auth_config – The authentication configuration.

  • response_for_auth_required – The response to return when the tool is requesting auth credential from the client. There could be two case, the tool doesn’t configure any credentials (auth_config.raw_auth_credential is missing) or the credentials configured is not enough to authenticate the tool (e.g. an OAuth client id and client secrect is configured.) and needs client input (e.g. client need to involve the end user in an oauth flow and get back the oauth response.)

async run_async(*, args, tool_context)

Runs the tool with the given arguments and context.

Return type:

Any

Note

  • Required if this tool needs to run at the client side.

  • Otherwise, can be skipped, e.g. for a built-in GoogleSearch tool for Gemini.

Parameters:
  • args – The LLM-filled arguments.

  • tool_context – The context of the tool.

Returns:

The result of running the tool.

google.adk.tools.base_authenticated_tool module

class google.adk.tools.base_authenticated_tool.BaseAuthenticatedTool(*, name, description, auth_config=None, response_for_auth_required=None)

Bases: BaseTool

A base tool class that handles authentication before the actual tool logic gets called. Functions can accept a special credential argument which is the credential ready for use.(Experimental)

Parameters:
  • name – The name of the tool.

  • description – The description of the tool.

  • auth_config – The auth configuration of the tool.

  • response_for_auth_required – The response to return when the tool is requesting auth credential from the client. There could be two case, the tool doesn’t configure any credentials (auth_config.raw_auth_credential is missing) or the credentials configured is not enough to authenticate the tool (e.g. an OAuth client id and client secrect is configured.) and needs client input (e.g. client need to involve the end user in an oauth flow and get back the oauth response.)

async run_async(*, args, tool_context)

Runs the tool with the given arguments and context.

Return type:

Any

Note

  • Required if this tool needs to run at the client side.

  • Otherwise, can be skipped, e.g. for a built-in GoogleSearch tool for Gemini.

Parameters:
  • args – The LLM-filled arguments.

  • tool_context – The context of the tool.

Returns:

The result of running the tool.

google.adk.tools.base_tool module

class google.adk.tools.base_tool.BaseTool(*, name, description, is_long_running=False, custom_metadata=None)

Bases: ABC

The base class for all tools.

custom_metadata: Optional[dict[str, Any]] = None

The custom metadata of the BaseTool.

An optional key-value pair for storing and retrieving tool-specific metadata, such as tool manifests, etc.

NOTE: the entire dict must be JSON serializable.

description: str

The description of the tool.

classmethod from_config(config, config_abs_path)

Creates a tool instance from a config.

This default implementation uses inspect to automatically map config values to constructor arguments based on their type hints. Subclasses should override this method for custom initialization logic.

Return type:

TypeVar(SelfTool, bound= BaseTool)

Parameters:
  • config – The config for the tool.

  • config_abs_path – The absolute path to the config file that contains the tool config.

Returns:

The tool instance.

is_long_running: bool = False

Whether the tool is a long running operation, which typically returns a resource id first and finishes the operation later.

name: str

The name of the tool.

async process_llm_request(*, tool_context, llm_request)

Processes the outgoing LLM request for this tool.

Use cases: - Most common use case is adding this tool to the LLM request. - Some tools may just preprocess the LLM request before it’s sent out.

Return type:

None

Parameters:
  • tool_context – The context of the tool.

  • llm_request – The outgoing LLM request, mutable this method.

async run_async(*, args, tool_context)

Runs the tool with the given arguments and context.

Return type:

Any

Note

  • Required if this tool needs to run at the client side.

  • Otherwise, can be skipped, e.g. for a built-in GoogleSearch tool for Gemini.

Parameters:
  • args – The LLM-filled arguments.

  • tool_context – The context of the tool.

Returns:

The result of running the tool.

google.adk.tools.base_toolset module

class google.adk.tools.base_toolset.BaseToolset(*, tool_filter=None, tool_name_prefix=None)

Bases: ABC

Base class for toolset.

A toolset is a collection of tools that can be used by an agent.

Initialize the toolset.

Parameters:
  • tool_filter – Filter to apply to tools.

  • tool_name_prefix – The prefix to prepend to the names of the tools returned by the toolset.

async close()

Performs cleanup and releases resources held by the toolset.

Return type:

None

Note

This method is invoked, for example, at the end of an agent server’s lifecycle or when the toolset is no longer needed. Implementations should ensure that any open connections, files, or other managed resources are properly released to prevent leaks.

classmethod from_config(config, config_abs_path)

Creates a toolset instance from a config.

Return type:

TypeVar(SelfToolset, bound= BaseToolset)

Parameters:
  • config – The config for the tool.

  • config_abs_path – The absolute path to the config file that contains the tool config.

Returns:

The toolset instance.

abstractmethod async get_tools(readonly_context=None)

Return all tools in the toolset based on the provided context.

Return type:

list[BaseTool]

Parameters:

readonly_context (ReadonlyContext, optional) – Context used to filter tools available to the agent. If None, all tools in the toolset are returned.

Returns:

A list of tools available under the specified context.

Return type:

list[BaseTool]

final async get_tools_with_prefix(readonly_context=None)

Return all tools with optional prefix applied to tool names.

This method calls get_tools() and applies prefixing if tool_name_prefix is provided.

Return type:

list[BaseTool]

Parameters:

readonly_context (ReadonlyContext, optional) – Context used to filter tools available to the agent. If None, all tools in the toolset are returned.

Returns:

A list of tools with prefixed names if tool_name_prefix is provided.

Return type:

list[BaseTool]

async process_llm_request(*, tool_context, llm_request)

Processes the outgoing LLM request for this toolset. This method will be called before each tool processes the llm request.

Return type:

None

Use cases: - Instead of let each tool process the llm request, we can let the toolset

process the llm request. e.g. ComputerUseToolset can add computer use tool to the llm request.

Parameters:
  • tool_context – The context of the tool.

  • llm_request – The outgoing LLM request, mutable this method.

class google.adk.tools.base_toolset.ToolPredicate(*args, **kwargs)

Bases: Protocol

Base class for a predicate that defines the interface to decide whether a

tool should be exposed to LLM. Toolset implementer could consider whether to accept such instance in the toolset’s constructor and apply the predicate in get_tools method.

google.adk.tools.bigquery module

BigQuery Tools (Experimental).

BigQuery Tools under this module are hand crafted and customized while the tools under google.adk.tools.google_api_tool are auto generated based on API definition. The rationales to have customized tool are:

  1. BigQuery APIs have functions overlaps and LLM can’t tell what tool to use

  2. BigQuery APIs have a lot of parameters with some rarely used, which are not LLM-friendly

  3. We want to provide more high-level tools like forecasting, RAG, segmentation, etc.

  4. We want to provide extra access guardrails in those tools. For example, execute_sql can’t arbitrarily mutate existing data.

pydantic model google.adk.tools.bigquery.BigQueryCredentialsConfig

Bases: BaseGoogleCredentialsConfig

BigQuery Credentials Configuration for Google API tools (Experimental).

Please do not use this in production, as it may be deprecated later.

Show JSON schema
{
   "title": "BigQueryCredentialsConfig",
   "type": "object",
   "properties": {
      "credentials": {
         "default": null,
         "title": "Credentials"
      },
      "client_id": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Client Id"
      },
      "client_secret": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Client Secret"
      },
      "scopes": {
         "anyOf": [
            {
               "items": {
                  "type": "string"
               },
               "type": "array"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Scopes"
      }
   },
   "additionalProperties": false
}

Fields:

Validators:
  • __post_init__ » all fields

model_post_init(context, /)

This function is meant to behave like a BaseModel method to initialise private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Return type:

None

Parameters:
  • self – The BaseModel instance.

  • context – The context.

class google.adk.tools.bigquery.BigQueryToolset(*, tool_filter=None, credentials_config=None, bigquery_tool_config=None)

Bases: BaseToolset

BigQuery Toolset contains tools for interacting with BigQuery data and metadata.

Initialize the toolset.

Parameters:
  • tool_filter – Filter to apply to tools.

  • tool_name_prefix – The prefix to prepend to the names of the tools returned by the toolset.

async close()

Performs cleanup and releases resources held by the toolset.

Note

This method is invoked, for example, at the end of an agent server’s lifecycle or when the toolset is no longer needed. Implementations should ensure that any open connections, files, or other managed resources are properly released to prevent leaks.

async get_tools(readonly_context=None)

Get tools from the toolset.

Return type:

List[BaseTool]

google.adk.tools.crewai_tool module

class google.adk.tools.crewai_tool.CrewaiTool(tool, *, name, description)

Bases: FunctionTool

Use this class to wrap a CrewAI tool.

If the original tool name and description are not suitable, you can override them in the constructor.

Initializes the FunctionTool. Extracts metadata from a callable object.

Parameters:
  • func – The function to wrap.

  • require_confirmation – Wether this tool requires confirmation. A boolean or a callable that takes the function’s arguments and returns a boolean. If the callable returns True, the tool will require confirmation from the user.

classmethod from_config(config, config_abs_path)

Creates a tool instance from a config.

This default implementation uses inspect to automatically map config values to constructor arguments based on their type hints. Subclasses should override this method for custom initialization logic.

Return type:

CrewaiTool

Parameters:
  • config – The config for the tool.

  • config_abs_path – The absolute path to the config file that contains the tool config.

Returns:

The tool instance.

tool: CrewaiBaseTool

The wrapped CrewAI tool.

pydantic model google.adk.tools.crewai_tool.CrewaiToolConfig

Bases: BaseToolConfig

Show JSON schema
{
   "title": "CrewaiToolConfig",
   "type": "object",
   "properties": {
      "tool": {
         "title": "Tool",
         "type": "string"
      },
      "name": {
         "default": "",
         "title": "Name",
         "type": "string"
      },
      "description": {
         "default": "",
         "title": "Description",
         "type": "string"
      }
   },
   "additionalProperties": false,
   "required": [
      "tool"
   ]
}

Fields:
field description: str = ''

The description of the tool.

field name: str = ''

The name of the tool.

field tool: str [Required]

The fully qualified path of the CrewAI tool instance.

google.adk.tools.enterprise_search_tool module

class google.adk.tools.enterprise_search_tool.EnterpriseWebSearchTool

Bases: BaseTool

A Gemini 2+ built-in tool using web grounding for Enterprise compliance.

See the documentation for more details: https://cloud.google.com/vertex-ai/generative-ai/docs/grounding/web-grounding-enterprise.

Initializes the Vertex AI Search tool.

description: str

The description of the tool.

name: str

The name of the tool.

async process_llm_request(*, tool_context, llm_request)

Processes the outgoing LLM request for this tool.

Use cases: - Most common use case is adding this tool to the LLM request. - Some tools may just preprocess the LLM request before it’s sent out.

Return type:

None

Parameters:
  • tool_context – The context of the tool.

  • llm_request – The outgoing LLM request, mutable this method.

google.adk.tools.example_tool module

class google.adk.tools.example_tool.ExampleTool(examples)

Bases: BaseTool

A tool that adds (few-shot) examples to the LLM request.

examples

The examples to add to the LLM request.

classmethod from_config(config, config_abs_path)

Creates a tool instance from a config.

This default implementation uses inspect to automatically map config values to constructor arguments based on their type hints. Subclasses should override this method for custom initialization logic.

Return type:

ExampleTool

Parameters:
  • config – The config for the tool.

  • config_abs_path – The absolute path to the config file that contains the tool config.

Returns:

The tool instance.

async process_llm_request(*, tool_context, llm_request)

Processes the outgoing LLM request for this tool.

Use cases: - Most common use case is adding this tool to the LLM request. - Some tools may just preprocess the LLM request before it’s sent out.

Return type:

None

Parameters:
  • tool_context – The context of the tool.

  • llm_request – The outgoing LLM request, mutable this method.

pydantic model google.adk.tools.example_tool.ExampleToolConfig

Bases: BaseToolConfig

Show JSON schema
{
   "title": "ExampleToolConfig",
   "type": "object",
   "properties": {
      "examples": {
         "anyOf": [
            {
               "items": {
                  "$ref": "#/$defs/Example"
               },
               "type": "array"
            },
            {
               "type": "string"
            }
         ],
         "title": "Examples"
      }
   },
   "$defs": {
      "Blob": {
         "additionalProperties": false,
         "description": "Content blob.",
         "properties": {
            "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 not currently used in the Gemini GenerateContent calls.",
               "title": "Displayname"
            },
            "data": {
               "anyOf": [
                  {
                     "format": "base64url",
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Required. Raw bytes.",
               "title": "Data"
            },
            "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\nOnly generated when using the [CodeExecution] tool, and always follows a\n`part` containing the [ExecutableCode].",
         "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"
            }
         },
         "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\n      'model'. Useful to set for multi-turn conversations, otherwise can be\n      empty. If role is not specified, SDK will determine the role.",
               "title": "Role"
            }
         },
         "title": "Content",
         "type": "object"
      },
      "Example": {
         "description": "A few-shot example.\n\nAttributes:\n  input: The input content for the example.\n  output: The expected output content for the example.",
         "properties": {
            "input": {
               "$ref": "#/$defs/Content"
            },
            "output": {
               "items": {
                  "$ref": "#/$defs/Content"
               },
               "title": "Output",
               "type": "array"
            }
         },
         "required": [
            "input",
            "output"
         ],
         "title": "Example",
         "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`."
            }
         },
         "title": "ExecutableCode",
         "type": "object"
      },
      "FileData": {
         "additionalProperties": false,
         "description": "URI based data.",
         "properties": {
            "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. It is not currently used in the Gemini GenerateContent calls.",
               "title": "Displayname"
            },
            "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"
            }
         },
         "title": "FileData",
         "type": "object"
      },
      "FunctionCall": {
         "additionalProperties": false,
         "description": "A function call.",
         "properties": {
            "id": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The unique id of the function call. If populated, the client to execute the\n   `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": "Required. The name of the function to call. Matches [FunctionDeclaration.name].",
               "title": "Name"
            }
         },
         "title": "FunctionCall",
         "type": "object"
      },
      "FunctionResponse": {
         "additionalProperties": false,
         "description": "A function response.",
         "properties": {
            "willContinue": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "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 (see FunctionDeclaration.behavior for details), ignored otherwise. If false, the default, future responses will not be considered. 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.",
               "title": "Willcontinue"
            },
            "scheduling": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/FunctionResponseScheduling"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Specifies how the response should be scheduled in the conversation. Only applicable to NON_BLOCKING function calls, is ignored otherwise. Defaults to WHEN_IDLE."
            },
            "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"
      },
      "FunctionResponseScheduling": {
         "description": "Specifies how the response should be scheduled in the conversation.",
         "enum": [
            "SCHEDULING_UNSPECIFIED",
            "SILENT",
            "WHEN_IDLE",
            "INTERRUPT"
         ],
         "title": "FunctionResponseScheduling",
         "type": "string"
      },
      "Language": {
         "description": "Required. Programming language of the `code`.",
         "enum": [
            "LANGUAGE_UNSPECIFIED",
            "PYTHON"
         ],
         "title": "Language",
         "type": "string"
      },
      "Outcome": {
         "description": "Required. 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": {
            "videoMetadata": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/VideoMetadata"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Metadata for a given video."
            },
            "thought": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Indicates if the part is thought from the model.",
               "title": "Thought"
            },
            "inlineData": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/Blob"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Inlined bytes data."
            },
            "fileData": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/FileData"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. URI based data."
            },
            "thoughtSignature": {
               "anyOf": [
                  {
                     "format": "base64url",
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "An opaque signature for the thought so it can be reused in subsequent requests.",
               "title": "Thoughtsignature"
            },
            "codeExecutionResult": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/CodeExecutionResult"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Result of executing the [ExecutableCode]."
            },
            "executableCode": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/ExecutableCode"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Code generated by the model that is meant to be executed."
            },
            "functionCall": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/FunctionCall"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. A predicted [FunctionCall] returned from the model that contains a string representing the [FunctionDeclaration.name] with the parameters and their values."
            },
            "functionResponse": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/FunctionResponse"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. The result output of a [FunctionCall] that contains a string representing the [FunctionDeclaration.name] and a structured JSON object containing any output from the function call. It is used as context to the model."
            },
            "text": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Text part (can be code).",
               "title": "Text"
            }
         },
         "title": "Part",
         "type": "object"
      },
      "VideoMetadata": {
         "additionalProperties": false,
         "description": "Describes how the video in the Part should be used by the model.",
         "properties": {
            "fps": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The frame rate of the video sent to the model. If not specified, the\n        default value will be 1.0. The fps range is (0.0, 24.0].",
               "title": "Fps"
            },
            "endOffset": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. The end offset of the video.",
               "title": "Endoffset"
            },
            "startOffset": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. The start offset of the video.",
               "title": "Startoffset"
            }
         },
         "title": "VideoMetadata",
         "type": "object"
      }
   },
   "additionalProperties": false,
   "required": [
      "examples"
   ]
}

Fields:
field examples: Union[list[Example], str] [Required]

The examples to add to the LLM request. User can either provide a list of examples or a fully-qualified name to a BaseExampleProvider object in code.

google.adk.tools.exit_loop_tool module

google.adk.tools.exit_loop_tool.exit_loop(tool_context)

Exits the loop.

Call this function only when you are instructed to do so.

google.adk.tools.function_tool module

class google.adk.tools.function_tool.FunctionTool(func, *, require_confirmation=False)

Bases: BaseTool

A tool that wraps a user-defined Python function.

func

The function to wrap.

Initializes the FunctionTool. Extracts metadata from a callable object.

Parameters:
  • func – The function to wrap.

  • require_confirmation – Wether this tool requires confirmation. A boolean or a callable that takes the function’s arguments and returns a boolean. If the callable returns True, the tool will require confirmation from the user.

async run_async(*, args, tool_context)

Runs the tool with the given arguments and context.

Return type:

Any

Note

  • Required if this tool needs to run at the client side.

  • Otherwise, can be skipped, e.g. for a built-in GoogleSearch tool for Gemini.

Parameters:
  • args – The LLM-filled arguments.

  • tool_context – The context of the tool.

Returns:

The result of running the tool.

google.adk.tools.get_user_choice_tool module

google.adk.tools.get_user_choice_tool.get_user_choice(options, tool_context)

Provides the options to the user and asks them to choose one.

Return type:

Optional[str]

google.adk.tools.google_api_tool module

Auto-generated tools and toolsets for Google APIs.

These tools and toolsets are auto-generated based on the API specifications provided by the Google API Discovery API.

class google.adk.tools.google_api_tool.BigQueryToolset(client_id=None, client_secret=None, tool_filter=None, service_account=None, tool_name_prefix=None)

Bases: GoogleApiToolset

Auto-generated BigQuery toolset based on Google BigQuery API v2 spec exposed by Google API discovery API.

Parameters:
  • client_id – OAuth2 client ID for authentication.

  • client_secret – OAuth2 client secret for authentication.

  • tool_filter – Optional filter to include only specific tools or use a predicate function.

  • service_account – Optional service account for authentication.

  • tool_name_prefix – Optional prefix to add to all tool names in this toolset.

Initialize the toolset.

Parameters:
  • tool_filter – Filter to apply to tools.

  • tool_name_prefix – The prefix to prepend to the names of the tools returned by the toolset.

class google.adk.tools.google_api_tool.CalendarToolset(client_id=None, client_secret=None, tool_filter=None, service_account=None, tool_name_prefix=None)

Bases: GoogleApiToolset

Auto-generated Calendar toolset based on Google Calendar API v3 spec exposed by Google API discovery API.

Parameters:
  • client_id – OAuth2 client ID for authentication.

  • client_secret – OAuth2 client secret for authentication.

  • tool_filter – Optional filter to include only specific tools or use a predicate function.

  • service_account – Optional service account for authentication.

  • tool_name_prefix – Optional prefix to add to all tool names in this toolset.

Initialize the toolset.

Parameters:
  • tool_filter – Filter to apply to tools.

  • tool_name_prefix – The prefix to prepend to the names of the tools returned by the toolset.

class google.adk.tools.google_api_tool.DocsToolset(client_id=None, client_secret=None, tool_filter=None, service_account=None, tool_name_prefix=None)

Bases: GoogleApiToolset

Auto-generated Docs toolset based on Google Docs API v1 spec exposed by Google API discovery API.

Parameters:
  • client_id – OAuth2 client ID for authentication.

  • client_secret – OAuth2 client secret for authentication.

  • tool_filter – Optional filter to include only specific tools or use a predicate function.

  • service_account – Optional service account for authentication.

  • tool_name_prefix – Optional prefix to add to all tool names in this toolset.

Initialize the toolset.

Parameters:
  • tool_filter – Filter to apply to tools.

  • tool_name_prefix – The prefix to prepend to the names of the tools returned by the toolset.

class google.adk.tools.google_api_tool.GmailToolset(client_id=None, client_secret=None, tool_filter=None, service_account=None, tool_name_prefix=None)

Bases: GoogleApiToolset

Auto-generated Gmail toolset based on Google Gmail API v1 spec exposed by Google API discovery API.

Parameters:
  • client_id – OAuth2 client ID for authentication.

  • client_secret – OAuth2 client secret for authentication.

  • tool_filter – Optional filter to include only specific tools or use a predicate function.

  • service_account – Optional service account for authentication.

  • tool_name_prefix – Optional prefix to add to all tool names in this toolset.

Initialize the toolset.

Parameters:
  • tool_filter – Filter to apply to tools.

  • tool_name_prefix – The prefix to prepend to the names of the tools returned by the toolset.

class google.adk.tools.google_api_tool.GoogleApiTool(rest_api_tool, client_id=None, client_secret=None, service_account=None)

Bases: BaseTool

configure_auth(client_id, client_secret)
configure_sa_auth(service_account)
description: str

The description of the tool.

name: str

The name of the tool.

async run_async(*, args, tool_context)

Runs the tool with the given arguments and context.

Return type:

Dict[str, Any]

Note

  • Required if this tool needs to run at the client side.

  • Otherwise, can be skipped, e.g. for a built-in GoogleSearch tool for Gemini.

Parameters:
  • args – The LLM-filled arguments.

  • tool_context – The context of the tool.

Returns:

The result of running the tool.

class google.adk.tools.google_api_tool.GoogleApiToolset(api_name, api_version, client_id=None, client_secret=None, tool_filter=None, service_account=None, tool_name_prefix=None)

Bases: BaseToolset

Google API Toolset contains tools for interacting with Google APIs.

Usually one toolsets will contains tools only related to one Google API, e.g. Google Bigquery API toolset will contains tools only related to Google Bigquery API, like list dataset tool, list table tool etc.

Parameters:
  • api_name – The name of the Google API (e.g., “calendar”, “gmail”).

  • api_version – The version of the API (e.g., “v3”, “v1”).

  • client_id – OAuth2 client ID for authentication.

  • client_secret – OAuth2 client secret for authentication.

  • tool_filter – Optional filter to include only specific tools or use a predicate function.

  • service_account – Optional service account for authentication.

  • tool_name_prefix – Optional prefix to add to all tool names in this toolset.

Initialize the toolset.

Parameters:
  • tool_filter – Filter to apply to tools.

  • tool_name_prefix – The prefix to prepend to the names of the tools returned by the toolset.

async close()

Performs cleanup and releases resources held by the toolset.

Note

This method is invoked, for example, at the end of an agent server’s lifecycle or when the toolset is no longer needed. Implementations should ensure that any open connections, files, or other managed resources are properly released to prevent leaks.

configure_auth(client_id, client_secret)
configure_sa_auth(service_account)
async get_tools(readonly_context=None)

Get all tools in the toolset.

Return type:

List[GoogleApiTool]

set_tool_filter(tool_filter)
class google.adk.tools.google_api_tool.SheetsToolset(client_id=None, client_secret=None, tool_filter=None, service_account=None, tool_name_prefix=None)

Bases: GoogleApiToolset

Auto-generated Sheets toolset based on Google Sheets API v4 spec exposed by Google API discovery API.

Parameters:
  • client_id – OAuth2 client ID for authentication.

  • client_secret – OAuth2 client secret for authentication.

  • tool_filter – Optional filter to include only specific tools or use a predicate function.

  • service_account – Optional service account for authentication.

  • tool_name_prefix – Optional prefix to add to all tool names in this toolset.

Initialize the toolset.

Parameters:
  • tool_filter – Filter to apply to tools.

  • tool_name_prefix – The prefix to prepend to the names of the tools returned by the toolset.

class google.adk.tools.google_api_tool.SlidesToolset(client_id=None, client_secret=None, tool_filter=None, service_account=None, tool_name_prefix=None)

Bases: GoogleApiToolset

Auto-generated Slides toolset based on Google Slides API v1 spec exposed by Google API discovery API.

Parameters:
  • client_id – OAuth2 client ID for authentication.

  • client_secret – OAuth2 client secret for authentication.

  • tool_filter – Optional filter to include only specific tools or use a predicate function.

  • service_account – Optional service account for authentication.

  • tool_name_prefix – Optional prefix to add to all tool names in this toolset.

Initialize the toolset.

Parameters:
  • tool_filter – Filter to apply to tools.

  • tool_name_prefix – The prefix to prepend to the names of the tools returned by the toolset.

class google.adk.tools.google_api_tool.YoutubeToolset(client_id=None, client_secret=None, tool_filter=None, service_account=None, tool_name_prefix=None)

Bases: GoogleApiToolset

Auto-generated YouTube toolset based on YouTube API v3 spec exposed by Google API discovery API.

Parameters:
  • client_id – OAuth2 client ID for authentication.

  • client_secret – OAuth2 client secret for authentication.

  • tool_filter – Optional filter to include only specific tools or use a predicate function.

  • service_account – Optional service account for authentication.

  • tool_name_prefix – Optional prefix to add to all tool names in this toolset.

Initialize the toolset.

Parameters:
  • tool_filter – Filter to apply to tools.

  • tool_name_prefix – The prefix to prepend to the names of the tools returned by the toolset.

google.adk.tools.google_search_tool module

class google.adk.tools.google_search_tool.GoogleSearchTool

Bases: BaseTool

A built-in tool that is automatically invoked by Gemini 2 models to retrieve search results from Google Search.

This tool operates internally within the model and does not require or perform local code execution.

description: str

The description of the tool.

name: str

The name of the tool.

async process_llm_request(*, tool_context, llm_request)

Processes the outgoing LLM request for this tool.

Use cases: - Most common use case is adding this tool to the LLM request. - Some tools may just preprocess the LLM request before it’s sent out.

Return type:

None

Parameters:
  • tool_context – The context of the tool.

  • llm_request – The outgoing LLM request, mutable this method.

google.adk.tools.langchain_tool module

class google.adk.tools.langchain_tool.LangchainTool(tool, name=None, description=None)

Bases: FunctionTool

Adapter class that wraps a Langchain tool for use with ADK.

This adapter converts Langchain tools into a format compatible with Google’s generative AI function calling interface. It preserves the tool’s name, description, and functionality while adapting its schema.

The original tool’s name and description can be overridden if needed.

Parameters:
  • tool – A Langchain tool to wrap (BaseTool or a tool with a .run method)

  • name – Optional override for the tool’s name

  • description – Optional override for the tool’s description

Examples:

from langchain.tools import DuckDuckGoSearchTool
from google.genai.tools import LangchainTool

search_tool = DuckDuckGoSearchTool()
wrapped_tool = LangchainTool(search_tool)

Initializes the FunctionTool. Extracts metadata from a callable object.

Parameters:
  • func – The function to wrap.

  • require_confirmation – Wether this tool requires confirmation. A boolean or a callable that takes the function’s arguments and returns a boolean. If the callable returns True, the tool will require confirmation from the user.

classmethod from_config(config, config_abs_path)

Creates a tool instance from a config.

This default implementation uses inspect to automatically map config values to constructor arguments based on their type hints. Subclasses should override this method for custom initialization logic.

Return type:

LangchainTool

Parameters:
  • config – The config for the tool.

  • config_abs_path – The absolute path to the config file that contains the tool config.

Returns:

The tool instance.

pydantic model google.adk.tools.langchain_tool.LangchainToolConfig

Bases: BaseToolConfig

Show JSON schema
{
   "title": "LangchainToolConfig",
   "type": "object",
   "properties": {
      "tool": {
         "title": "Tool",
         "type": "string"
      },
      "name": {
         "default": "",
         "title": "Name",
         "type": "string"
      },
      "description": {
         "default": "",
         "title": "Description",
         "type": "string"
      }
   },
   "additionalProperties": false,
   "required": [
      "tool"
   ]
}

Fields:
field description: str = ''

The description of the tool.

field name: str = ''

The name of the tool.

field tool: str [Required]

The fully qualified path of the Langchain tool instance.

google.adk.tools.load_artifacts_tool module

class google.adk.tools.load_artifacts_tool.LoadArtifactsTool

Bases: BaseTool

A tool that loads the artifacts and adds them to the session.

description: str

The description of the tool.

name: str

The name of the tool.

async process_llm_request(*, tool_context, llm_request)

Processes the outgoing LLM request for this tool.

Use cases: - Most common use case is adding this tool to the LLM request. - Some tools may just preprocess the LLM request before it’s sent out.

Return type:

None

Parameters:
  • tool_context – The context of the tool.

  • llm_request – The outgoing LLM request, mutable this method.

async run_async(*, args, tool_context)

Runs the tool with the given arguments and context.

Return type:

Any

Note

  • Required if this tool needs to run at the client side.

  • Otherwise, can be skipped, e.g. for a built-in GoogleSearch tool for Gemini.

Parameters:
  • args – The LLM-filled arguments.

  • tool_context – The context of the tool.

Returns:

The result of running the tool.

google.adk.tools.load_memory_tool module

pydantic model google.adk.tools.load_memory_tool.LoadMemoryResponse

Bases: BaseModel

Show JSON schema
{
   "title": "LoadMemoryResponse",
   "type": "object",
   "properties": {
      "memories": {
         "items": {
            "$ref": "#/$defs/MemoryEntry"
         },
         "title": "Memories",
         "type": "array"
      }
   },
   "$defs": {
      "Blob": {
         "additionalProperties": false,
         "description": "Content blob.",
         "properties": {
            "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 not currently used in the Gemini GenerateContent calls.",
               "title": "Displayname"
            },
            "data": {
               "anyOf": [
                  {
                     "format": "base64url",
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Required. Raw bytes.",
               "title": "Data"
            },
            "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\nOnly generated when using the [CodeExecution] tool, and always follows a\n`part` containing the [ExecutableCode].",
         "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"
            }
         },
         "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\n      'model'. Useful to set for multi-turn conversations, otherwise can be\n      empty. If role is not specified, SDK will determine the role.",
               "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`."
            }
         },
         "title": "ExecutableCode",
         "type": "object"
      },
      "FileData": {
         "additionalProperties": false,
         "description": "URI based data.",
         "properties": {
            "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. It is not currently used in the Gemini GenerateContent calls.",
               "title": "Displayname"
            },
            "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"
            }
         },
         "title": "FileData",
         "type": "object"
      },
      "FunctionCall": {
         "additionalProperties": false,
         "description": "A function call.",
         "properties": {
            "id": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The unique id of the function call. If populated, the client to execute the\n   `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": "Required. The name of the function to call. Matches [FunctionDeclaration.name].",
               "title": "Name"
            }
         },
         "title": "FunctionCall",
         "type": "object"
      },
      "FunctionResponse": {
         "additionalProperties": false,
         "description": "A function response.",
         "properties": {
            "willContinue": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "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 (see FunctionDeclaration.behavior for details), ignored otherwise. If false, the default, future responses will not be considered. 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.",
               "title": "Willcontinue"
            },
            "scheduling": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/FunctionResponseScheduling"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Specifies how the response should be scheduled in the conversation. Only applicable to NON_BLOCKING function calls, is ignored otherwise. Defaults to WHEN_IDLE."
            },
            "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"
      },
      "FunctionResponseScheduling": {
         "description": "Specifies how the response should be scheduled in the conversation.",
         "enum": [
            "SCHEDULING_UNSPECIFIED",
            "SILENT",
            "WHEN_IDLE",
            "INTERRUPT"
         ],
         "title": "FunctionResponseScheduling",
         "type": "string"
      },
      "Language": {
         "description": "Required. Programming language of the `code`.",
         "enum": [
            "LANGUAGE_UNSPECIFIED",
            "PYTHON"
         ],
         "title": "Language",
         "type": "string"
      },
      "MemoryEntry": {
         "description": "Represent one memory entry.",
         "properties": {
            "content": {
               "$ref": "#/$defs/Content"
            },
            "author": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Author"
            },
            "timestamp": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Timestamp"
            }
         },
         "required": [
            "content"
         ],
         "title": "MemoryEntry",
         "type": "object"
      },
      "Outcome": {
         "description": "Required. 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": {
            "videoMetadata": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/VideoMetadata"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Metadata for a given video."
            },
            "thought": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Indicates if the part is thought from the model.",
               "title": "Thought"
            },
            "inlineData": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/Blob"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Inlined bytes data."
            },
            "fileData": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/FileData"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. URI based data."
            },
            "thoughtSignature": {
               "anyOf": [
                  {
                     "format": "base64url",
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "An opaque signature for the thought so it can be reused in subsequent requests.",
               "title": "Thoughtsignature"
            },
            "codeExecutionResult": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/CodeExecutionResult"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Result of executing the [ExecutableCode]."
            },
            "executableCode": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/ExecutableCode"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Code generated by the model that is meant to be executed."
            },
            "functionCall": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/FunctionCall"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. A predicted [FunctionCall] returned from the model that contains a string representing the [FunctionDeclaration.name] with the parameters and their values."
            },
            "functionResponse": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/FunctionResponse"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. The result output of a [FunctionCall] that contains a string representing the [FunctionDeclaration.name] and a structured JSON object containing any output from the function call. It is used as context to the model."
            },
            "text": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Text part (can be code).",
               "title": "Text"
            }
         },
         "title": "Part",
         "type": "object"
      },
      "VideoMetadata": {
         "additionalProperties": false,
         "description": "Describes how the video in the Part should be used by the model.",
         "properties": {
            "fps": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The frame rate of the video sent to the model. If not specified, the\n        default value will be 1.0. The fps range is (0.0, 24.0].",
               "title": "Fps"
            },
            "endOffset": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. The end offset of the video.",
               "title": "Endoffset"
            },
            "startOffset": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. The start offset of the video.",
               "title": "Startoffset"
            }
         },
         "title": "VideoMetadata",
         "type": "object"
      }
   }
}

Fields:
field memories: list[MemoryEntry] [Optional]
class google.adk.tools.load_memory_tool.LoadMemoryTool

Bases: FunctionTool

A tool that loads the memory for the current user.

NOTE: Currently this tool only uses text part from the memory.

Initializes the FunctionTool. Extracts metadata from a callable object.

Parameters:
  • func – The function to wrap.

  • require_confirmation – Wether this tool requires confirmation. A boolean or a callable that takes the function’s arguments and returns a boolean. If the callable returns True, the tool will require confirmation from the user.

async process_llm_request(*, tool_context, llm_request)

Processes the outgoing LLM request for this tool.

Use cases: - Most common use case is adding this tool to the LLM request. - Some tools may just preprocess the LLM request before it’s sent out.

Return type:

None

Parameters:
  • tool_context – The context of the tool.

  • llm_request – The outgoing LLM request, mutable this method.

async google.adk.tools.load_memory_tool.load_memory(query, tool_context)

Loads the memory for the current user.

Return type:

LoadMemoryResponse

Parameters:

query – The query to load the memory for.

Returns:

A list of memory results.

google.adk.tools.load_web_page module

Tool for web browse.

google.adk.tools.load_web_page.load_web_page(url)

Fetches the content in the url and returns the text in it.

Return type:

str

Parameters:

url (str) – The url to browse.

Returns:

The text content of the url.

Return type:

str

google.adk.tools.long_running_tool module

class google.adk.tools.long_running_tool.LongRunningFunctionTool(func)

Bases: FunctionTool

A function tool that returns the result asynchronously.

This tool is used for long-running operations that may take a significant amount of time to complete. The framework will call the function. Once the function returns, the response will be returned asynchronously to the framework which is identified by the function_call_id.

Example: `python tool = LongRunningFunctionTool(a_long_running_function) `

is_long_running

Whether the tool is a long running operation.

Initializes the FunctionTool. Extracts metadata from a callable object.

Parameters:
  • func – The function to wrap.

  • require_confirmation – Wether this tool requires confirmation. A boolean or a callable that takes the function’s arguments and returns a boolean. If the callable returns True, the tool will require confirmation from the user.

google.adk.tools.mcp_tool module

class google.adk.tools.mcp_tool.MCPTool(*args, **kwargs)

Bases: McpTool

Deprecated name, use McpTool instead.

Initializes an MCPTool.

This tool wraps an MCP Tool interface and uses a session manager to communicate with the MCP server.

Parameters:
  • mcp_tool – The MCP tool to wrap.

  • mcp_session_manager – The MCP session manager to use for communication.

  • auth_scheme – The authentication scheme to use.

  • auth_credential – The authentication credential to use.

Raises:

ValueError – If mcp_tool or mcp_session_manager is None.

class google.adk.tools.mcp_tool.MCPToolset(*args, **kwargs)

Bases: McpToolset

Deprecated name, use McpToolset instead.

Initializes the MCPToolset.

Parameters:
  • connection_params – The connection parameters to the MCP server. Can be: StdioConnectionParams for using local mcp server (e.g. using npx or python3); or SseConnectionParams for a local/remote SSE server; or StreamableHTTPConnectionParams for local/remote Streamable http server. Note, StdioServerParameters is also supported for using local mcp server (e.g. using npx or python3 ), but it does not support timeout, and we recommend to use StdioConnectionParams instead when timeout is needed.

  • tool_filter – Optional filter to select specific tools. Can be either: - A list of tool names to include - A ToolPredicate function for custom filtering logic

  • errlog – TextIO stream for error logging.

  • auth_scheme – The auth scheme of the tool for tool calling

  • auth_credential – The auth credential of the tool for tool calling

class google.adk.tools.mcp_tool.McpTool(*, mcp_tool, mcp_session_manager, auth_scheme=None, auth_credential=None)

Bases: BaseAuthenticatedTool

Turns an MCP Tool into an ADK Tool.

Internally, the tool initializes from a MCP Tool, and uses the MCP Session to call the tool.

Note: For API key authentication, only header-based API keys are supported. Query and cookie-based API keys will result in authentication errors.

Initializes an MCPTool.

This tool wraps an MCP Tool interface and uses a session manager to communicate with the MCP server.

Parameters:
  • mcp_tool – The MCP tool to wrap.

  • mcp_session_manager – The MCP session manager to use for communication.

  • auth_scheme – The authentication scheme to use.

  • auth_credential – The authentication credential to use.

Raises:

ValueError – If mcp_tool or mcp_session_manager is None.

class google.adk.tools.mcp_tool.McpToolset(*, connection_params, tool_filter=None, errlog=<_io.TextIOWrapper name='<stderr>' mode='w' encoding='utf-8'>, auth_scheme=None, auth_credential=None)

Bases: BaseToolset

Connects to a MCP Server, and retrieves MCP Tools into ADK Tools.

This toolset manages the connection to an MCP server and provides tools that can be used by an agent. It properly implements the BaseToolset interface for easy integration with the agent framework.

Usage:

toolset = MCPToolset(
    connection_params=StdioServerParameters(
        command='npx',
        args=["-y", "@modelcontextprotocol/server-filesystem"],
    ),
    tool_filter=['read_file', 'list_directory']  # Optional: filter specific tools
)

# Use in an agent
agent = LlmAgent(
    model='gemini-2.0-flash',
    name='enterprise_assistant',
    instruction='Help user accessing their file systems',
    tools=[toolset],
)

# Cleanup is handled automatically by the agent framework
# But you can also manually close if needed:
# await toolset.close()

Initializes the MCPToolset.

Parameters:
  • connection_params – The connection parameters to the MCP server. Can be: StdioConnectionParams for using local mcp server (e.g. using npx or python3); or SseConnectionParams for a local/remote SSE server; or StreamableHTTPConnectionParams for local/remote Streamable http server. Note, StdioServerParameters is also supported for using local mcp server (e.g. using npx or python3 ), but it does not support timeout, and we recommend to use StdioConnectionParams instead when timeout is needed.

  • tool_filter – Optional filter to select specific tools. Can be either: - A list of tool names to include - A ToolPredicate function for custom filtering logic

  • errlog – TextIO stream for error logging.

  • auth_scheme – The auth scheme of the tool for tool calling

  • auth_credential – The auth credential of the tool for tool calling

async close()

Performs cleanup and releases resources held by the toolset.

This method closes the MCP session and cleans up all associated resources. It’s designed to be safe to call multiple times and handles cleanup errors gracefully to avoid blocking application shutdown.

Return type:

None

classmethod from_config(config, config_abs_path)

Creates an MCPToolset from a configuration object.

Return type:

MCPToolset

async get_tools(readonly_context=None)

Return all tools in the toolset based on the provided context.

Return type:

List[BaseTool]

Parameters:

readonly_context – Context used to filter tools available to the agent. If None, all tools in the toolset are returned.

Returns:

A list of tools available under the specified context.

Return type:

List[BaseTool]

pydantic model google.adk.tools.mcp_tool.SseConnectionParams

Bases: BaseModel

Parameters for the MCP SSE connection.

See MCP SSE Client documentation for more details. https://github.com/modelcontextprotocol/python-sdk/blob/main/src/mcp/client/sse.py

url

URL for the MCP SSE server.

headers

Headers for the MCP SSE connection.

timeout

Timeout in seconds for establishing the connection to the MCP SSE server.

sse_read_timeout

Timeout in seconds for reading data from the MCP SSE server.

Show JSON schema
{
   "title": "SseConnectionParams",
   "description": "Parameters for the MCP SSE connection.\n\nSee MCP SSE Client documentation for more details.\nhttps://github.com/modelcontextprotocol/python-sdk/blob/main/src/mcp/client/sse.py\n\nAttributes:\n    url: URL for the MCP SSE server.\n    headers: Headers for the MCP SSE connection.\n    timeout: Timeout in seconds for establishing the connection to the MCP SSE\n      server.\n    sse_read_timeout: Timeout in seconds for reading data from the MCP SSE\n      server.",
   "type": "object",
   "properties": {
      "url": {
         "title": "Url",
         "type": "string"
      },
      "headers": {
         "anyOf": [
            {
               "additionalProperties": true,
               "type": "object"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Headers"
      },
      "timeout": {
         "default": 5.0,
         "title": "Timeout",
         "type": "number"
      },
      "sse_read_timeout": {
         "default": 300.0,
         "title": "Sse Read Timeout",
         "type": "number"
      }
   },
   "required": [
      "url"
   ]
}

Fields:
  • headers (dict[str, Any] | None)

  • sse_read_timeout (float)

  • timeout (float)

  • url (str)

field headers: dict[str, Any] | None = None
field sse_read_timeout: float = 300.0
field timeout: float = 5.0
field url: str [Required]
pydantic model google.adk.tools.mcp_tool.StdioConnectionParams

Bases: BaseModel

Parameters for the MCP Stdio connection.

server_params

Parameters for the MCP Stdio server.

timeout

Timeout in seconds for establishing the connection to the MCP stdio server.

Show JSON schema
{
   "title": "StdioConnectionParams",
   "description": "Parameters for the MCP Stdio connection.\n\nAttributes:\n    server_params: Parameters for the MCP Stdio server.\n    timeout: Timeout in seconds for establishing the connection to the MCP\n      stdio server.",
   "type": "object",
   "properties": {
      "server_params": {
         "$ref": "#/$defs/StdioServerParameters"
      },
      "timeout": {
         "default": 5.0,
         "title": "Timeout",
         "type": "number"
      }
   },
   "$defs": {
      "StdioServerParameters": {
         "properties": {
            "command": {
               "title": "Command",
               "type": "string"
            },
            "args": {
               "items": {
                  "type": "string"
               },
               "title": "Args",
               "type": "array"
            },
            "env": {
               "anyOf": [
                  {
                     "additionalProperties": {
                        "type": "string"
                     },
                     "type": "object"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Env"
            },
            "cwd": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "format": "path",
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Cwd"
            },
            "encoding": {
               "default": "utf-8",
               "title": "Encoding",
               "type": "string"
            },
            "encoding_error_handler": {
               "default": "strict",
               "enum": [
                  "strict",
                  "ignore",
                  "replace"
               ],
               "title": "Encoding Error Handler",
               "type": "string"
            }
         },
         "required": [
            "command"
         ],
         "title": "StdioServerParameters",
         "type": "object"
      }
   },
   "required": [
      "server_params"
   ]
}

Fields:
  • server_params (mcp.client.stdio.StdioServerParameters)

  • timeout (float)

field server_params: StdioServerParameters [Required]
field timeout: float = 5.0
pydantic model google.adk.tools.mcp_tool.StreamableHTTPConnectionParams

Bases: BaseModel

Parameters for the MCP Streamable HTTP connection.

See MCP Streamable HTTP Client documentation for more details. https://github.com/modelcontextprotocol/python-sdk/blob/main/src/mcp/client/streamable_http.py

url

URL for the MCP Streamable HTTP server.

headers

Headers for the MCP Streamable HTTP connection.

timeout

Timeout in seconds for establishing the connection to the MCP Streamable HTTP server.

sse_read_timeout

Timeout in seconds for reading data from the MCP Streamable HTTP server.

terminate_on_close

Whether to terminate the MCP Streamable HTTP server when the connection is closed.

Show JSON schema
{
   "title": "StreamableHTTPConnectionParams",
   "description": "Parameters for the MCP Streamable HTTP connection.\n\nSee MCP Streamable HTTP Client documentation for more details.\nhttps://github.com/modelcontextprotocol/python-sdk/blob/main/src/mcp/client/streamable_http.py\n\nAttributes:\n    url: URL for the MCP Streamable HTTP server.\n    headers: Headers for the MCP Streamable HTTP connection.\n    timeout: Timeout in seconds for establishing the connection to the MCP\n      Streamable HTTP server.\n    sse_read_timeout: Timeout in seconds for reading data from the MCP\n      Streamable HTTP server.\n    terminate_on_close: Whether to terminate the MCP Streamable HTTP server\n      when the connection is closed.",
   "type": "object",
   "properties": {
      "url": {
         "title": "Url",
         "type": "string"
      },
      "headers": {
         "anyOf": [
            {
               "additionalProperties": true,
               "type": "object"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Headers"
      },
      "timeout": {
         "default": 5.0,
         "title": "Timeout",
         "type": "number"
      },
      "sse_read_timeout": {
         "default": 300.0,
         "title": "Sse Read Timeout",
         "type": "number"
      },
      "terminate_on_close": {
         "default": true,
         "title": "Terminate On Close",
         "type": "boolean"
      }
   },
   "required": [
      "url"
   ]
}

Fields:
  • headers (dict[str, Any] | None)

  • sse_read_timeout (float)

  • terminate_on_close (bool)

  • timeout (float)

  • url (str)

field headers: dict[str, Any] | None = None
field sse_read_timeout: float = 300.0
field terminate_on_close: bool = True
field timeout: float = 5.0
field url: str [Required]
google.adk.tools.mcp_tool.adk_to_mcp_tool_type(tool)

Convert a Tool in ADK into MCP tool type.

This function transforms an ADK tool definition into its equivalent representation in the MCP (Model Context Protocol) system.

Return type:

Tool

Parameters:

tool – The ADK tool to convert. It should be an instance of a class derived from BaseTool.

Returns:

An object of MCP Tool type, representing the converted tool.

Examples

# Assuming ‘my_tool’ is an instance of a BaseTool derived class mcp_tool = adk_to_mcp_tool_type(my_tool) print(mcp_tool)

google.adk.tools.mcp_tool.gemini_to_json_schema(gemini_schema)

Converts a Gemini Schema object into a JSON Schema dictionary.

Return type:

Dict[str, Any]

Parameters:

gemini_schema – An instance of the Gemini Schema class.

Returns:

A dictionary representing the equivalent JSON Schema.

Raises:
  • TypeError – If the input is not an instance of the expected Schema class.

  • ValueError – If an invalid Gemini Type enum value is encountered.

google.adk.tools.openapi_tool module

class google.adk.tools.openapi_tool.OpenAPIToolset(*, spec_dict=None, spec_str=None, spec_str_type='json', auth_scheme=None, auth_credential=None, tool_filter=None)

Bases: BaseToolset

Class for parsing OpenAPI spec into a list of RestApiTool.

Usage:

# Initialize OpenAPI toolset from a spec string.
openapi_toolset = OpenAPIToolset(spec_str=openapi_spec_str,
  spec_str_type="json")
# Or, initialize OpenAPI toolset from a spec dictionary.
openapi_toolset = OpenAPIToolset(spec_dict=openapi_spec_dict)

# Add all tools to an agent.
agent = Agent(
  tools=[*openapi_toolset.get_tools()]
)
# Or, add a single tool to an agent.
agent = Agent(
  tools=[openapi_toolset.get_tool('tool_name')]
)

Initializes the OpenAPIToolset.

Usage:

# Initialize OpenAPI toolset from a spec string.
openapi_toolset = OpenAPIToolset(spec_str=openapi_spec_str,
  spec_str_type="json")
# Or, initialize OpenAPI toolset from a spec dictionary.
openapi_toolset = OpenAPIToolset(spec_dict=openapi_spec_dict)

# Add all tools to an agent.
agent = Agent(
  tools=[*openapi_toolset.get_tools()]
)
# Or, add a single tool to an agent.
agent = Agent(
  tools=[openapi_toolset.get_tool('tool_name')]
)
Parameters:
  • spec_dict – The OpenAPI spec dictionary. If provided, it will be used instead of loading the spec from a string.

  • spec_str – The OpenAPI spec string in JSON or YAML format. It will be used when spec_dict is not provided.

  • spec_str_type – The type of the OpenAPI spec string. Can be “json” or “yaml”.

  • auth_scheme – The auth scheme to use for all tools. Use AuthScheme or use helpers in google.adk.tools.openapi_tool.auth.auth_helpers

  • auth_credential – The auth credential to use for all tools. Use AuthCredential or use helpers in google.adk.tools.openapi_tool.auth.auth_helpers

  • tool_filter – The filter used to filter the tools in the toolset. It can be either a tool predicate or a list of tool names of the tools to expose.

async close()

Performs cleanup and releases resources held by the toolset.

Note

This method is invoked, for example, at the end of an agent server’s lifecycle or when the toolset is no longer needed. Implementations should ensure that any open connections, files, or other managed resources are properly released to prevent leaks.

get_tool(tool_name)

Get a tool by name.

Return type:

Optional[RestApiTool]

async get_tools(readonly_context=None)

Get all tools in the toolset.

Return type:

List[RestApiTool]

class google.adk.tools.openapi_tool.RestApiTool(name, description, endpoint, operation, auth_scheme=None, auth_credential=None, should_parse_operation=True)

Bases: BaseTool

A generic tool that interacts with a REST API.

  • Generates request params and body

  • Attaches auth credentials to API call.

Example:

# Each API operation in the spec will be turned into its own tool
# Name of the tool is the operationId of that operation, in snake case
operations = OperationGenerator().parse(openapi_spec_dict)
tool = [RestApiTool.from_parsed_operation(o) for o in operations]

Initializes the RestApiTool with the given parameters.

To generate RestApiTool from OpenAPI Specs, use OperationGenerator. Example:

# Each API operation in the spec will be turned into its own tool
# Name of the tool is the operationId of that operation, in snake case
operations = OperationGenerator().parse(openapi_spec_dict)
tool = [RestApiTool.from_parsed_operation(o) for o in operations]

Hint: Use google.adk.tools.openapi_tool.auth.auth_helpers to construct auth_scheme and auth_credential.

Parameters:
async call(*, args, tool_context)

Executes the REST API call.

Return type:

Dict[str, Any]

Parameters:
  • args – Keyword arguments representing the operation parameters.

  • tool_context – The tool context (not used here, but required by the interface).

Returns:

The API response as a dictionary.

configure_auth_credential(auth_credential=None)

Configures the authentication credential for the API call.

Parameters:

auth_credential – AuthCredential|dict - The authentication credential. The dict is converted to an AuthCredential object.

configure_auth_scheme(auth_scheme)

Configures the authentication scheme for the API call.

Parameters:

auth_scheme – AuthScheme|dict -: The authentication scheme. The dict is converted to a AuthScheme object.

description: str

The description of the tool.

classmethod from_parsed_operation(parsed)

Initializes the RestApiTool from a ParsedOperation object.

Return type:

RestApiTool

Parameters:

parsed – A ParsedOperation object.

Returns:

A RestApiTool object.

classmethod from_parsed_operation_str(parsed_operation_str)

Initializes the RestApiTool from a dict.

Return type:

RestApiTool

Parameters:

parsed – A dict representation of a ParsedOperation object.

Returns:

A RestApiTool object.

name: str

The name of the tool.

async run_async(*, args, tool_context)

Runs the tool with the given arguments and context.

Return type:

Dict[str, Any]

Note

  • Required if this tool needs to run at the client side.

  • Otherwise, can be skipped, e.g. for a built-in GoogleSearch tool for Gemini.

Parameters:
  • args – The LLM-filled arguments.

  • tool_context – The context of the tool.

Returns:

The result of running the tool.

google.adk.tools.preload_memory_tool module

class google.adk.tools.preload_memory_tool.PreloadMemoryTool

Bases: BaseTool

A tool that preloads the memory for the current user.

This tool will be automatically executed for each llm_request, and it won’t be called by the model.

NOTE: Currently this tool only uses text part from the memory.

description: str

The description of the tool.

name: str

The name of the tool.

async process_llm_request(*, tool_context, llm_request)

Processes the outgoing LLM request for this tool.

Use cases: - Most common use case is adding this tool to the LLM request. - Some tools may just preprocess the LLM request before it’s sent out.

Return type:

None

Parameters:
  • tool_context – The context of the tool.

  • llm_request – The outgoing LLM request, mutable this method.

google.adk.tools.retrieval module

class google.adk.tools.retrieval.BaseRetrievalTool(*, name, description, is_long_running=False, custom_metadata=None)

Bases: BaseTool

description: str

The description of the tool.

name: str

The name of the tool.

google.adk.tools.tool_context module

class google.adk.tools.tool_context.ToolContext(invocation_context, *, function_call_id=None, event_actions=None, tool_confirmation=None)

Bases: CallbackContext

The context of the tool.

This class provides the context for a tool invocation, including access to the invocation context, function call ID, event actions, and authentication response. It also provides methods for requesting credentials, retrieving authentication responses, listing artifacts, and searching memory.

invocation_context

The invocation context of the tool.

function_call_id

The function call id of the current tool call. This id was returned in the function call event from LLM to identify a function call. If LLM didn’t return this id, ADK will assign one to it. This id is used to map function call response to the original function call.

event_actions

The event actions of the current tool call.

tool_confirmation

The tool confirmation of the current tool call.

property actions: EventActions
get_auth_response(auth_config)
Return type:

AuthCredential

request_confirmation(*, hint=None, payload=None)

Requests confirmation for the given function call.

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.

request_credential(auth_config)
Return type:

None

async search_memory(query)

Searches the memory of the current user.

Return type:

SearchMemoryResponse

google.adk.tools.toolbox_toolset module

class google.adk.tools.toolbox_toolset.ToolboxToolset(server_url, toolset_name=None, tool_names=None, auth_token_getters=None, bound_params=None)

Bases: BaseToolset

A class that provides access to toolbox toolsets.

Example: `python toolbox_toolset = ToolboxToolset("http://127.0.0.1:5000", toolset_name="my-toolset") ) `

Parameters:

The resulting ToolboxToolset will contain both tools loaded by tool_names and toolset_name.

async close()

Performs cleanup and releases resources held by the toolset.

Note

This method is invoked, for example, at the end of an agent server’s lifecycle or when the toolset is no longer needed. Implementations should ensure that any open connections, files, or other managed resources are properly released to prevent leaks.

async get_tools(readonly_context=None)

Return all tools in the toolset based on the provided context.

Return type:

list[BaseTool]

Parameters:

readonly_context (ReadonlyContext, optional) – Context used to filter tools available to the agent. If None, all tools in the toolset are returned.

Returns:

A list of tools available under the specified context.

Return type:

list[BaseTool]

google.adk.tools.transfer_to_agent_tool module

google.adk.tools.transfer_to_agent_tool.transfer_to_agent(agent_name, tool_context)

Transfer the question to another agent.

This tool hands off control to another agent when it’s more suitable to answer the user’s question according to the agent’s description.

Return type:

None

Parameters:

agent_name – the agent name to transfer to.

google.adk.tools.url_context_tool module

class google.adk.tools.url_context_tool.UrlContextTool

Bases: BaseTool

A built-in tool that is automatically invoked by Gemini 2 models to retrieve content from the URLs and use that content to inform and shape its response.

This tool operates internally within the model and does not require or perform local code execution.

description: str

The description of the tool.

name: str

The name of the tool.

async process_llm_request(*, tool_context, llm_request)

Processes the outgoing LLM request for this tool.

Use cases: - Most common use case is adding this tool to the LLM request. - Some tools may just preprocess the LLM request before it’s sent out.

Return type:

None

Parameters:
  • tool_context – The context of the tool.

  • llm_request – The outgoing LLM request, mutable this method.

google.adk.tools.vertex_ai_search_tool module

class google.adk.tools.vertex_ai_search_tool.VertexAiSearchTool(*, data_store_id=None, data_store_specs=None, search_engine_id=None, filter=None, max_results=None)

Bases: BaseTool

A built-in tool using Vertex AI Search.

data_store_id

The Vertex AI search data store resource ID.

search_engine_id

The Vertex AI search engine resource ID.

Initializes the Vertex AI Search tool.

Parameters:
  • data_store_id – The Vertex AI search data store resource ID in the format of “projects/{project}/locations/{location}/collections/{collection}/dataStores/{dataStore}”.

  • data_store_specs – Specifications that define the specific DataStores to be searched. It should only be set if engine is used.

  • search_engine_id – The Vertex AI search engine resource ID in the format of “projects/{project}/locations/{location}/collections/{collection}/engines/{engine}”.

Raises:
  • ValueError – If both data_store_id and search_engine_id are not specified

  • or both are specified.

async process_llm_request(*, tool_context, llm_request)

Processes the outgoing LLM request for this tool.

Use cases: - Most common use case is adding this tool to the LLM request. - Some tools may just preprocess the LLM request before it’s sent out.

Return type:

None

Parameters:
  • tool_context – The context of the tool.

  • llm_request – The outgoing LLM request, mutable this method.

google.adk.utils module

google.adk.version module