Agents are systems that leverage Gemini models, a set of tools, and reasoning capabilities to perform complex, multi-step tasks and achieve specific goals. Unlike a single model call, an agent can plan, execute a series of actions, interact with external systems, and synthesize information to fulfill a user's request.
CreateAgent
Creates a new Agent (Typed version for SDK).
Request body
The request body contains data with the following structure:
The base agent to extend.
base_environment EnvironmentConfig (optional)
The environment configuration for the agent.
Fields
Optional. The environment ID for the interaction. If specified, the request will update the existing environment instead of creating a new one.
network EnvironmentNetworkEgressAllowlist (optional)
Network configuration for the environment.
Possible Types
object
Outbound networking configuration for the sandbox. When specified, restricts which external domains the sandbox can reach. Omit entirely to allow all outbound traffic with no header injection.
allowlist AllowlistEntry (optional)
List of allowed outbound domains. Only requests to listed domains are permitted. Use [{'domain': '*'}] to allow all domains while still injecting headers on specific ones.
Fields
Domain to allow outbound requests to. Supports wildcards (e.g. '*.googleapis.com'). Use '*' to allow all domains.
Headers to inject on all outbound requests matching this domain. Accepts a single dict or a list of dicts. The egress proxy injects these automatically.
string
Turns all network off.
Possible values
-
disabledTurns all network off.
sources Source (optional)
No description provided.
Fields
The inline content if `type` is `INLINE`.
Optional encoding for inline content (e.g. `base64`).
The source of the environment. For GCS, this is the GCS path. For GitHub, this is the GitHub path.
Where the source should appear in the environment.
No description provided.
Possible values:
-
gcsA GCS bucket.
-
inlineInline content.
-
repositoryA generic repository. The protocol prefix in the source URL identifies the provider (e.g., github://, gcs://).
-
skill_registryA skill resource from the Skill Registry Service. Skill: projects/{project}/locations/{location}/skills/{skill} SkillRevision: projects/{project}/locations/{location}/skills/{skill}/revisions/{revision} Support mounting all skills under a project: projects/{project}/locations/{location}/skills.
No description provided.
Always set to "remote".
Agent description for developers to quickly read and understand.
The unique identifier for the agent.
System instruction for the agent.
tools AgentTool (optional)
The tools available to the agent.
Possible Types
Polymorphic discriminator: type
CodeExecution
A tool that can be used by the model to execute code.
No description provided.
Always set to "code_execution".
GoogleSearch
A tool that can be used by the model to search Google.
The types of search grounding to enable.
Possible values:
-
web_searchSetting this field enables web search. Only text results are returned.
-
image_searchSetting this field enables image search. Image bytes are returned.
-
enterprise_web_searchSetting this field enables enterprise web search.
No description provided.
Always set to "google_search".
UrlContext
A tool that can be used by the model to fetch URL context.
No description provided.
Always set to "url_context".
McpServer
A MCPServer is a server that can be called by the model to perform actions.
allowed_tools AllowedTools (optional)
The allowed tools.
Fields
The mode of the tool choice.
Possible values:
-
autoAuto tool choice.
-
anyAny tool choice.
-
noneNo tool choice.
-
validatedValidated tool choice.
The names of the allowed tools.
Optional: Fields for authentication headers, timeouts, etc., if needed.
The name of the MCPServer.
No description provided.
Always set to "mcp_server".
The full URL for the MCPServer endpoint. Example: "https://api.example.com/mcp"
Function
A tool that can be used by the model.
A description of the function.
The name of the function.
The JSON Schema for the function's parameters.
No description provided.
Always set to "function".
Response
If successful, the response body contains data with the following structure:
The base agent to extend.
base_environment EnvironmentConfig (optional)
The environment configuration for the agent.
Fields
Optional. The environment ID for the interaction. If specified, the request will update the existing environment instead of creating a new one.
network EnvironmentNetworkEgressAllowlist (optional)
Network configuration for the environment.
Possible Types
object
Outbound networking configuration for the sandbox. When specified, restricts which external domains the sandbox can reach. Omit entirely to allow all outbound traffic with no header injection.
allowlist AllowlistEntry (optional)
List of allowed outbound domains. Only requests to listed domains are permitted. Use [{'domain': '*'}] to allow all domains while still injecting headers on specific ones.
Fields
Domain to allow outbound requests to. Supports wildcards (e.g. '*.googleapis.com'). Use '*' to allow all domains.
Headers to inject on all outbound requests matching this domain. Accepts a single dict or a list of dicts. The egress proxy injects these automatically.
string
Turns all network off.
Possible values
-
disabledTurns all network off.
sources Source (optional)
No description provided.
Fields
The inline content if `type` is `INLINE`.
Optional encoding for inline content (e.g. `base64`).
The source of the environment. For GCS, this is the GCS path. For GitHub, this is the GitHub path.
Where the source should appear in the environment.
No description provided.
Possible values:
-
gcsA GCS bucket.
-
inlineInline content.
-
repositoryA generic repository. The protocol prefix in the source URL identifies the provider (e.g., github://, gcs://).
-
skill_registryA skill resource from the Skill Registry Service. Skill: projects/{project}/locations/{location}/skills/{skill} SkillRevision: projects/{project}/locations/{location}/skills/{skill}/revisions/{revision} Support mounting all skills under a project: projects/{project}/locations/{location}/skills.
No description provided.
Always set to "remote".
Agent description for developers to quickly read and understand.
The unique identifier for the agent.
System instruction for the agent.
tools AgentTool (optional)
The tools available to the agent.
Possible Types
Polymorphic discriminator: type
CodeExecution
A tool that can be used by the model to execute code.
No description provided.
Always set to "code_execution".
GoogleSearch
A tool that can be used by the model to search Google.
The types of search grounding to enable.
Possible values:
-
web_searchSetting this field enables web search. Only text results are returned.
-
image_searchSetting this field enables image search. Image bytes are returned.
-
enterprise_web_searchSetting this field enables enterprise web search.
No description provided.
Always set to "google_search".
UrlContext
A tool that can be used by the model to fetch URL context.
No description provided.
Always set to "url_context".
McpServer
A MCPServer is a server that can be called by the model to perform actions.
allowed_tools AllowedTools (optional)
The allowed tools.
Fields
The mode of the tool choice.
Possible values:
-
autoAuto tool choice.
-
anyAny tool choice.
-
noneNo tool choice.
-
validatedValidated tool choice.
The names of the allowed tools.
Optional: Fields for authentication headers, timeouts, etc., if needed.
The name of the MCPServer.
No description provided.
Always set to "mcp_server".
The full URL for the MCPServer endpoint. Example: "https://api.example.com/mcp"
Function
A tool that can be used by the model.
A description of the function.
The name of the function.
The JSON Schema for the function's parameters.
No description provided.
Always set to "function".
Create Agent
Example Response
{ "id": "ag_abc123", "display_name": "My Research Agent", "system_instruction": "You are a helpful research assistant.", "tools": [ { "type": "google_search" } ], "object": "agent", "created": "2025-11-26T12:25:15Z", "updated": "2025-11-26T12:25:15Z" }
Agent with Sources
Example Response
{ "id": "data-analyst-abc123", "system_instruction": "You are a data analyst. Always include visualizations and export results as PDF.", "object": "agent", "created": "2025-11-26T12:25:15Z", "updated": "2025-11-26T12:25:15Z" }
Agent Forked from Environment
Example Response
{ "id": "my-data-analyst", "system_instruction": "You are a data analyst. Use the template at /workspace/template.py for all reports.", "object": "agent", "created": "2025-11-26T12:25:15Z", "updated": "2025-11-26T12:25:15Z" }
ListAgents
Lists all Agents.
Path / Query Parameters
No description provided.
No description provided.
No description provided.
Response
If successful, the response body contains data with the following structure:
No description provided.
No description provided.
List Agents
Example Response
{ "object": "list", "data": [ { "id": "ag_abc123", "display_name": "My Research Agent", "system_instruction": "You are a helpful research assistant.", "object": "agent", "created": "2025-11-26T12:25:15Z", "updated": "2025-11-26T12:25:15Z" } ] }
GetAgent
Gets a specific Agent.
Path / Query Parameters
No description provided.
Response
If successful, the response body contains data with the following structure:
The base agent to extend.
base_environment EnvironmentConfig (optional)
The environment configuration for the agent.
Fields
Optional. The environment ID for the interaction. If specified, the request will update the existing environment instead of creating a new one.
network EnvironmentNetworkEgressAllowlist (optional)
Network configuration for the environment.
Possible Types
object
Outbound networking configuration for the sandbox. When specified, restricts which external domains the sandbox can reach. Omit entirely to allow all outbound traffic with no header injection.
allowlist AllowlistEntry (optional)
List of allowed outbound domains. Only requests to listed domains are permitted. Use [{'domain': '*'}] to allow all domains while still injecting headers on specific ones.
Fields
Domain to allow outbound requests to. Supports wildcards (e.g. '*.googleapis.com'). Use '*' to allow all domains.
Headers to inject on all outbound requests matching this domain. Accepts a single dict or a list of dicts. The egress proxy injects these automatically.
string
Turns all network off.
Possible values
-
disabledTurns all network off.
sources Source (optional)
No description provided.
Fields
The inline content if `type` is `INLINE`.
Optional encoding for inline content (e.g. `base64`).
The source of the environment. For GCS, this is the GCS path. For GitHub, this is the GitHub path.
Where the source should appear in the environment.
No description provided.
Possible values:
-
gcsA GCS bucket.
-
inlineInline content.
-
repositoryA generic repository. The protocol prefix in the source URL identifies the provider (e.g., github://, gcs://).
-
skill_registryA skill resource from the Skill Registry Service. Skill: projects/{project}/locations/{location}/skills/{skill} SkillRevision: projects/{project}/locations/{location}/skills/{skill}/revisions/{revision} Support mounting all skills under a project: projects/{project}/locations/{location}/skills.
No description provided.
Always set to "remote".
Agent description for developers to quickly read and understand.
The unique identifier for the agent.
System instruction for the agent.
tools AgentTool (optional)
The tools available to the agent.
Possible Types
Polymorphic discriminator: type
CodeExecution
A tool that can be used by the model to execute code.
No description provided.
Always set to "code_execution".
GoogleSearch
A tool that can be used by the model to search Google.
The types of search grounding to enable.
Possible values:
-
web_searchSetting this field enables web search. Only text results are returned.
-
image_searchSetting this field enables image search. Image bytes are returned.
-
enterprise_web_searchSetting this field enables enterprise web search.
No description provided.
Always set to "google_search".
UrlContext
A tool that can be used by the model to fetch URL context.
No description provided.
Always set to "url_context".
McpServer
A MCPServer is a server that can be called by the model to perform actions.
allowed_tools AllowedTools (optional)
The allowed tools.
Fields
The mode of the tool choice.
Possible values:
-
autoAuto tool choice.
-
anyAny tool choice.
-
noneNo tool choice.
-
validatedValidated tool choice.
The names of the allowed tools.
Optional: Fields for authentication headers, timeouts, etc., if needed.
The name of the MCPServer.
No description provided.
Always set to "mcp_server".
The full URL for the MCPServer endpoint. Example: "https://api.example.com/mcp"
Function
A tool that can be used by the model.
A description of the function.
The name of the function.
The JSON Schema for the function's parameters.
No description provided.
Always set to "function".
Get Agent
Example Response
{ "id": "ag_abc123", "display_name": "My Research Agent", "system_instruction": "You are a helpful research assistant.", "tools": [ { "type": "google_search" } ], "object": "agent", "created": "2025-11-26T12:25:15Z", "updated": "2025-11-26T12:25:15Z" }
DeleteAgent
Deletes an Agent.
Path / Query Parameters
No description provided.
Response
If successful, the response is empty.
Delete Agent
Resources
Agent
An agent definition for the CreateAgent API. This message is the target for annotation-parser-based JSON parsing. New format: { "id": "customer-sentinel", "base_agent": "", "system_instruction": "...", "base_environment": { "type": "remote", "sources": [...] }, "tools": [ {"type": "code_execution"} ] }
Fields
The base agent to extend.
base_environment EnvironmentConfig (optional)
The environment configuration for the agent.
Fields
Optional. The environment ID for the interaction. If specified, the request will update the existing environment instead of creating a new one.
network EnvironmentNetworkEgressAllowlist (optional)
Network configuration for the environment.
Possible Types
object
Outbound networking configuration for the sandbox. When specified, restricts which external domains the sandbox can reach. Omit entirely to allow all outbound traffic with no header injection.
allowlist AllowlistEntry (optional)
List of allowed outbound domains. Only requests to listed domains are permitted. Use [{'domain': '*'}] to allow all domains while still injecting headers on specific ones.
Fields
Domain to allow outbound requests to. Supports wildcards (e.g. '*.googleapis.com'). Use '*' to allow all domains.
Headers to inject on all outbound requests matching this domain. Accepts a single dict or a list of dicts. The egress proxy injects these automatically.
string
Turns all network off.
Possible values
-
disabledTurns all network off.
sources Source (optional)
No description provided.
Fields
The inline content if `type` is `INLINE`.
Optional encoding for inline content (e.g. `base64`).
The source of the environment. For GCS, this is the GCS path. For GitHub, this is the GitHub path.
Where the source should appear in the environment.
No description provided.
Possible values:
-
gcsA GCS bucket.
-
inlineInline content.
-
repositoryA generic repository. The protocol prefix in the source URL identifies the provider (e.g., github://, gcs://).
-
skill_registryA skill resource from the Skill Registry Service. Skill: projects/{project}/locations/{location}/skills/{skill} SkillRevision: projects/{project}/locations/{location}/skills/{skill}/revisions/{revision} Support mounting all skills under a project: projects/{project}/locations/{location}/skills.
No description provided.
Always set to "remote".
Agent description for developers to quickly read and understand.
The unique identifier for the agent.
System instruction for the agent.
tools AgentTool (optional)
The tools available to the agent.
Possible Types
Polymorphic discriminator: type
CodeExecution
A tool that can be used by the model to execute code.
No description provided.
Always set to "code_execution".
GoogleSearch
A tool that can be used by the model to search Google.
The types of search grounding to enable.
Possible values:
-
web_searchSetting this field enables web search. Only text results are returned.
-
image_searchSetting this field enables image search. Image bytes are returned.
-
enterprise_web_searchSetting this field enables enterprise web search.
No description provided.
Always set to "google_search".
UrlContext
A tool that can be used by the model to fetch URL context.
No description provided.
Always set to "url_context".
McpServer
A MCPServer is a server that can be called by the model to perform actions.
allowed_tools AllowedTools (optional)
The allowed tools.
Fields
The mode of the tool choice.
Possible values:
-
autoAuto tool choice.
-
anyAny tool choice.
-
noneNo tool choice.
-
validatedValidated tool choice.
The names of the allowed tools.
Optional: Fields for authentication headers, timeouts, etc., if needed.
The name of the MCPServer.
No description provided.
Always set to "mcp_server".
The full URL for the MCPServer endpoint. Example: "https://api.example.com/mcp"
Function
A tool that can be used by the model.
A description of the function.
The name of the function.
The JSON Schema for the function's parameters.
No description provided.
Always set to "function".