> ## AI Agent Context > Get the complete documentation index at: https://aistudio.google.com/llms.txt > Use this file to discover all available pages. > For the full documentation in a single file, fetch: https://aistudio.google.com/llms-full.txt # Creating an agent {% callout type="note" %} This API is in Beta. Endpoints are under `/v1beta/`. {% /callout %} {% mark class="http-post" %}{% icon name="north_east" /%}`POST`{% /mark %} `https://generativelanguage.googleapis.com/v1beta/agents` Creates a new Agent (Typed version for SDK). {% two-column-layout %} {% left-column %} ## Parameters {% class="hide-from-toc" id="parameters" %} {% section class="api-ref-property-list" %} **parent**: {% mark %}required{% /mark %} `string` The parent resource where this agent will be created. Format: `projects/{project}/locations/{location}` {% /section %} ## Request Body {% class="hide-from-toc" id="request-body" %} {% section class="api-ref-property-list" %} **id**: `string` The unique identifier for the agent. {% hr /%} **base_agent**: `string` The base agent to extend. {% hr /%} **system_instruction**: `string` System instruction for the agent. {% hr /%} **description**: `string` Agent description for developers to quickly read and understand. {% hr /%} {% details %} {% summary %} **agent_config**: `AntigravityAgentConfig` Configuration parameters for the agent. {% /summary %} **type**: {% mark %}required{% /mark %} `object` Value: `antigravity` **model**: `string` The model to use for agent reasoning. **max_total_tokens**: `string` Max total tokens for the agent run. {% /details %} {% hr /%} {% details %} {% summary %} **base_environment**: `EnvironmentConfig` or `string` The environment configuration for the agent. {% /summary %} **Possible Types:** {% class="api-ref-label" %} {% details %} {% summary %} **EnvironmentConfig** {% /summary %} Configuration for a custom environment. **type**: {% mark %}required{% /mark %} `object` Value: `remote` {% details %} {% summary %} **sources**: `Source array` {% /summary %} {% details %} {% summary %} **type**: `string enum` {% /summary %} Possible values: - `gcs`: A Cloud Storage bucket. - `inline`: Inline content. - `repository`: A generic repository. The protocol prefix in the source URL identifies the provider (e.g., github://, gcs://). {% /details %} **source**: `string` The source of the environment. For Cloud Storage, this is the Cloud Storage path. For GitHub, this is the GitHub path. **target**: `string` Where the source should appear in the environment. **content**: `string` The inline content if `type` is `INLINE`. **encoding**: `string` Optional encoding for inline content (e.g. `base64`). {% /details %} {% details %} {% summary %} **network**: `EnvironmentNetworkEgressAllowlist` or `string enum` Network configuration for the environment. {% /summary %} **Possible Types:** {% class="api-ref-label" %} {% details %} {% summary %} **EnvironmentNetworkEgressAllowlist** {% /summary %} Network egress configuration for the environment. {% details %} {% summary %} **allowlist**: `EgressRule array` or `string enum` List of allowed domains and their configurations. Set to `"disabled"` to block all network egress. {% /summary %} **Possible Types:** {% class="api-ref-label" %} {% details %} {% summary %} **EgressRule array** {% /summary %} A single domain allowlist rule with optional header injection. **domain**: {% mark %}required{% /mark %} `string` Domain to allow outbound requests to. Supports wildcards (e.g. '*.googleapis.com'). Use '*' to allow all domains. **transform**: `object` Headers to inject into requests matching this rule. Key: header name (e.g., "Authorization"). Value: header value (e.g., "Bearer your-token"). **credential**: `string` Optional. Reference to a server-managed Credential resource by ID. {% /details %} {% details %} {% summary %} **string enum** {% /summary %} Possible values: - `disabled`: All network egress is blocked. {% /details %} {% /details %} {% /details %} {% details %} {% summary %} **string enum** {% /summary %} Possible values: - `disabled`: All network egress is blocked. {% /details %} {% /details %} **environment_id**: `string` Optional. The environment ID for the interaction. If specified, the request will update the existing environment instead of creating a new one. {% details %} {% summary %} **env**: `object` or `string` Environment variables to set in the sandbox environment. {% /summary %} **Possible Types:** {% class="api-ref-label" %} {% details %} {% summary %} **string** {% /summary %} A direct string value. {% /details %} {% /details %} {% /details %} {% details %} {% summary %} **string** {% /summary %} A direct string value. {% /details %} {% /details %} {% hr /%} {% details %} {% summary %} **tools**: `AgentTool array` The tools available to the agent. {% /summary %} **Possible Types:** {% class="api-ref-label" %} {% details %} {% summary %} **CodeExecution** {% /summary %} A tool that can be used by the model to execute code. **type**: {% mark %}required{% /mark %} `object` Value: `code_execution` {% /details %} {% details %} {% summary %} **Function** {% /summary %} A tool that can be used by the model. **type**: {% mark %}required{% /mark %} `object` Value: `function` **name**: `string` The name of the function. **description**: `string` A description of the function. **parameters**: `object` The JSON Schema for the function's parameters. Supports a subset of JSON Schema. `minLength`, `maxLength`, `minProperties`, `maxProperties`, `uniqueItems`, `contains`, `minContains`, and `maxContains` are ignored and not enforced. {% /details %} {% details %} {% summary %} **GoogleSearch** {% /summary %} A tool that can be used by the model to search Google. **type**: {% mark %}required{% /mark %} `object` Value: `google_search` {% details %} {% summary %} **search_types**: `string enum array` The types of search grounding to enable. {% /summary %} Possible values: - `web_search`: Setting this field enables web search. Only text results are returned. - `image_search`: Setting this field enables image search. Image bytes are returned. {% /details %} {% /details %} {% details %} {% summary %} **McpServer** {% /summary %} A MCPServer is a server that can be called by the model to perform actions. **type**: {% mark %}required{% /mark %} `object` Value: `mcp_server` **name**: `string` The name of the MCPServer. **url**: `string` The full URL for the MCPServer endpoint. Example: "https://api.example.com/mcp" **headers**: `object` Optional: Fields for authentication headers, timeouts, etc., if needed. {% details %} {% summary %} **allowed_tools**: `AllowedTools array` The allowed tools. {% /summary %} {% details %} {% summary %} **mode**: `string enum` The mode of the tool choice. {% /summary %} Possible values: - `auto`: Auto tool choice. - `any`: Any tool choice. - `none`: No tool choice. - `validated`: Validated tool choice. {% /details %} **tools**: `string array` The names of the allowed tools. {% /details %} {% /details %} {% details %} {% summary %} **UrlContext** {% /summary %} A tool that can be used by the model to fetch URL context. **type**: {% mark %}required{% /mark %} `object` Value: `url_context` {% /details %} {% /details %} {% /section %} {% /left-column %} {% right-column class="sticky" %} **Example request** {% class="example-heading" %} {% tabs %} {% tab label="Create Agent" %} {% tabs %} {% tab label="REST" %} ```sh curl -X POST https://generativelanguage.googleapis.com/v1beta/agents \ -H "x-goog-api-key: $GEMINI_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "id": "research-assistant-abc123", "base_agent": "antigravity-preview-05-2026", "description": "A helpful research assistant.", "system_instruction": "You are a helpful research assistant.", "base_environment": "remote", "tools": [{"type": "google_search"}] }' ``` {% /tab %} {% tab label="Python" %} ```python import uuid from google import genai client = genai.Client() agent = client.agents.create( id=f"research-assistant-{uuid.uuid4().hex[:8]}", base_agent="antigravity-preview-05-2026", description="A helpful research assistant.", system_instruction="You are a helpful research assistant.", base_environment="remote", tools=[{"type": "google_search"}], ) print(agent.id) ``` {% /tab %} {% tab label="JavaScript" %} ```javascript import {GoogleGenAI} from '@google/genai'; const ai = new GoogleGenAI({}); const agentId = `research-assistant-${crypto.randomUUID().slice(0, 8)}`; const agent = await ai.agents.create({ id: agentId, base_agent: 'antigravity-preview-05-2026', description: 'A helpful research assistant.', system_instruction: 'You are a helpful research assistant.', base_environment: 'remote', tools: [{type: 'google_search'}], }); if (!agent.id) { throw new Error('Agent creation failed: ID is undefined'); } console.log(agent.id); ``` {% /tab %} {% tab label="Java" %} ```java import com.google.genai.gaos.models.agents.Agent; import com.google.genai.gaos.models.agents.BaseEnvironment; import com.google.genai.Client; import com.google.genai.gaos.models.operations.CreateAgentResponse; import com.google.genai.gaos.models.interactions.GoogleSearch; Client client = new Client(); String agentId = "research-assistant-" + UUID.randomUUID().toString().substring(0, 8); Agent agent = Agent.builder() .id(agentId) .baseAgent("antigravity-preview-05-2026") .description("A helpful research assistant.") .systemInstruction("You are a helpful research assistant.") .baseEnvironment(BaseEnvironment.of("remote")) .tools(List.of(new GoogleSearch())) .build(); CreateAgentResponse response = client.agents.create(agent); System.out.println(response.agent().flatMap(Agent::id).orElse("")); ``` {% /tab %} {% tab label="Go" %} ```go package main import ( "context" "fmt" "log" "time" "google.golang.org/genai" gaos_agents "google.golang.org/genai/interactions/models/agents" gaos_interactions "google.golang.org/genai/interactions/models/interactions" "google.golang.org/genai/interactions/models/operations" ) func main() { ctx := context.Background() client, err := genai.NewClient(ctx, nil) if err != nil { log.Fatal(err) } agentID := fmt.Sprintf("research-assistant-%d", time.Now().UnixNano()) req := operations.CreateAgentRequest{ Body: gaos_agents.Agent{ ID: genai.Ptr(agentID), BaseAgent: genai.Ptr("antigravity-preview-05-2026"), Description: genai.Ptr("A helpful research assistant."), SystemInstruction: genai.Ptr("You are a helpful research assistant."), BaseEnvironment: genai.Ptr(gaos_agents.NewBaseEnvironment("remote")), Tools: []gaos_agents.AgentTool{ gaos_agents.NewAgentTool(gaos_interactions.GoogleSearch{}), }, }, } res, err := client.Agents.Create(ctx, req) if err != nil { log.Fatal(err) } if res.Agent != nil && res.Agent.ID != nil { fmt.Println(*res.Agent.ID) } } ``` {% /tab %} {% /tabs %} {% /tab %} {% tab label="Agent with Sources" %} {% tabs %} {% tab label="REST" %} ```sh curl -X POST https://generativelanguage.googleapis.com/v1beta/agents \ -H "x-goog-api-key: $GEMINI_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "id": "data-analyst-abc123", "base_agent": "antigravity-preview-05-2026", "system_instruction": "You are a data analyst. Always include visualizations and export results as PDF.", "base_environment": { "type": "remote", "sources": [ { "type": "inline", "target": ".agents/AGENTS.md", "content": "Always use matplotlib for charts. Include a summary table in every report." }, { "type": "repository", "source": "https://github.com/my-org/analysis-templates", "target": "/workspace/templates" } ] } }' ``` {% /tab %} {% tab label="Python" %} ```python import uuid from google import genai client = genai.Client() agent = client.agents.create( id=f"data-analyst-{uuid.uuid4().hex[:8]}", base_agent="antigravity-preview-05-2026", system_instruction=( "You are a data analyst. Always include visualizations and export" " results as PDF." ), base_environment={ "type": "remote", "sources": [ { "type": "inline", "target": ".agents/AGENTS.md", "content": ( "Always use matplotlib for charts. Include a summary" " table in every report." ), }, { "type": "repository", "source": "https://github.com/my-org/analysis-templates", "target": "/workspace/templates", }, ], }, ) print(f"Created agent: {agent.id}") ``` {% /tab %} {% tab label="JavaScript" %} ```javascript import {GoogleGenAI} from '@google/genai'; const ai = new GoogleGenAI({}); const agentId = `data-analyst-${crypto.randomUUID().slice(0, 8)}`; const agent = await ai.agents.create({ id: agentId, base_agent: 'antigravity-preview-05-2026', system_instruction: 'You are a data analyst. Always include visualizations and export results as PDF.', base_environment: { type: 'remote', sources: [ { type: 'inline', target: '.agents/AGENTS.md', content: 'Always use matplotlib for charts. Include a summary table in every report.', }, { type: 'repository', source: 'https://github.com/my-org/analysis-templates', target: '/workspace/templates', }, ], }, }); console.log(`Created agent: ${agent.id}`); ``` {% /tab %} {% tab label="Java" %} ```java import com.google.genai.gaos.models.agents.Agent; import com.google.genai.gaos.models.agents.BaseEnvironment; import com.google.genai.Client; import com.google.genai.gaos.models.operations.CreateAgentResponse; import com.google.genai.gaos.models.environments.Environment; import com.google.genai.gaos.models.interactions.Source; import com.google.genai.gaos.models.interactions.SourceType; Client client = new Client(); String agentId = "data-analyst-" + UUID.randomUUID().toString().substring(0, 8); com.google.genai.gaos.models.interactions.Environment env = com.google.genai.gaos.models.interactions.Environment.builder() .sources( List.of( Source.builder() .type(SourceType.INLINE) .target(".agents/AGENTS.md") .content( "Always use matplotlib for charts. Include a summary table in every" + " report.") .build(), Source.builder() .type(SourceType.REPOSITORY) .source("https://github.com/my-org/analysis-templates") .target("/workspace/templates") .build())) .build(); Agent agent = Agent.builder() .id(agentId) .baseAgent("antigravity-preview-05-2026") .systemInstruction( "You are a data analyst. Always include visualizations and export results as PDF.") .baseEnvironment(BaseEnvironment.of(env)) .build(); CreateAgentResponse response = client.agents.create(agent); System.out.println("Created agent: " + response.agent().flatMap(Agent::id).orElse("")); ``` {% /tab %} {% tab label="Go" %} ```go package main import ( "context" "fmt" "log" "time" "google.golang.org/genai" gaos_agents "google.golang.org/genai/interactions/models/agents" gaos_interactions "google.golang.org/genai/interactions/models/interactions" "google.golang.org/genai/interactions/models/operations" ) func main() { ctx := context.Background() client, err := genai.NewClient(ctx, nil) if err != nil { log.Fatal(err) } agentID := fmt.Sprintf("data-analyst-%d", time.Now().UnixNano()) env := gaos_interactions.Environment{ Sources: []gaos_interactions.Source{ { Type: genai.Ptr(gaos_interactions.SourceTypeInline), Target: genai.Ptr(".agents/AGENTS.md"), Content: genai.Ptr("Always use matplotlib for charts. Include a summary table in every report."), }, { Type: genai.Ptr(gaos_interactions.SourceTypeRepository), Source: genai.Ptr("https://github.com/my-org/analysis-templates"), Target: genai.Ptr("/workspace/templates"), }, }, } req := operations.CreateAgentRequest{ Body: gaos_agents.Agent{ ID: genai.Ptr(agentID), BaseAgent: genai.Ptr("antigravity-preview-05-2026"), SystemInstruction: genai.Ptr("You are a data analyst. Always include visualizations and export results as PDF."), BaseEnvironment: genai.Ptr(gaos_agents.NewBaseEnvironment(env)), }, } res, err := client.Agents.Create(ctx, req) if err != nil { log.Fatal(err) } if res.Agent != nil && res.Agent.ID != nil { fmt.Printf("Created agent: %s\n", *res.Agent.ID) } } ``` {% /tab %} {% /tabs %} {% /tab %} {% tab label="Agent Forked from Environment" %} {% tabs %} {% tab label="REST" %} ```sh # Step 1: Set up the environment interactively RESPONSE=$(curl -s -X POST https://generativelanguage.googleapis.com/v1beta/interactions \ -H "x-goog-api-key: $GEMINI_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "agent": "antigravity-preview-05-2026", "input": "Write a basic Hello World template to /workspace/template.py.", "environment": "remote" }') ENV_ID=$(echo "$RESPONSE" | python3 -c "import sys,json; print(json.load(sys.stdin)['environment_id'])") # Step 2: Fork that environment into a named agent curl -X POST https://generativelanguage.googleapis.com/v1beta/agents \ -H "x-goog-api-key: $GEMINI_API_KEY" \ -H "Content-Type: application/json" \ -d "{ \"id\": \"my-data-analyst\", \"base_agent\": \"antigravity-preview-05-2026\", \"system_instruction\": \"You are a data analyst. Use the template at /workspace/template.py for all reports.\", \"base_environment\": \"$ENV_ID\" }" ``` {% /tab %} {% tab label="Python" %} ```python import uuid from google import genai client = genai.Client() # Step 1: Set up the environment interactively. interaction = client.interactions.create( agent="antigravity-preview-05-2026", input="Write a basic Hello World template to /workspace/template.py.", environment="remote", ) # Step 2: Fork that environment into a named agent. agent_id = f"my-data-analyst-{uuid.uuid4().hex[:8]}" agent = client.agents.create( id=agent_id, base_agent="antigravity-preview-05-2026", system_instruction=( "You are a data analyst. Use the template at /workspace/template.py" " for all reports." ), base_environment=interaction.environment_id, ) print(f"Forked agent: {agent.id}") ``` {% /tab %} {% tab label="JavaScript" %} ```javascript import {GoogleGenAI} from '@google/genai'; const ai = new GoogleGenAI({}); // Step 1: Set up the environment interactively. const interaction = await ai.interactions.create({ agent: 'antigravity-preview-05-2026', input: 'Write a basic Hello World template to /workspace/template.py.', environment: 'remote', }); // Step 2: Fork that environment into a named agent. const agentId = `my-data-analyst-${crypto.randomUUID().slice(0, 8)}`; const agent = await ai.agents.create({ id: agentId, base_agent: 'antigravity-preview-05-2026', system_instruction: 'You are a data analyst. Use the template at /workspace/template.py for all reports.', base_environment: interaction.environment_id, }); console.log(`Forked agent: ${agent.id}`); ``` {% /tab %} {% tab label="Java" %} ```java import com.google.genai.gaos.models.agents.Agent; import com.google.genai.gaos.models.interactions.AgentOption; import com.google.genai.gaos.models.agents.BaseEnvironment; import com.google.genai.Client; import com.google.genai.gaos.models.interactions.CreateAgentInteraction; import com.google.genai.gaos.models.interactions.CreateAgentInteractionEnvironment; import com.google.genai.gaos.models.operations.CreateAgentResponse; import com.google.genai.gaos.models.operations.CreateInteractionRequestBody; import com.google.genai.gaos.models.operations.CreateInteractionResponse; import com.google.genai.gaos.models.interactions.Interaction; import com.google.genai.gaos.models.interactions.InteractionsInput; import com.google.genai.gaos.models.interactions.Step; Client client = new Client(); // Step 1: Set up the environment interactively. CreateAgentInteraction params = CreateAgentInteraction.builder() .agent(AgentOption.of("antigravity-preview-05-2026")) .input( InteractionsInput.of( "Write a basic Hello World template to /workspace/template.py.")) .environment(CreateAgentInteractionEnvironment.of("remote")) .build(); CreateInteractionResponse interactionResponse = client.interactions.create(CreateInteractionRequestBody.of(params)); Interaction interaction = interactionResponse .interaction() .orElseThrow(() -> new RuntimeException("No interaction returned")); // Step 2: Fork that environment into a named agent. String agentId = "my-data-analyst-" + UUID.randomUUID().toString().substring(0, 8); Agent agent = Agent.builder() .id(agentId) .baseAgent("antigravity-preview-05-2026") .systemInstruction( "You are a data analyst. Use the template at /workspace/template.py for all" + " reports.") .baseEnvironment(BaseEnvironment.of(interaction.environmentId().orElse(""))) .build(); CreateAgentResponse agentResponse = client.agents.create(agent); System.out.println("Forked agent: " + agentResponse.agent().flatMap(Agent::id).orElse("")); ``` {% /tab %} {% tab label="Go" %} ```go package main import ( "context" "fmt" "log" "time" "google.golang.org/genai" gaos_agents "google.golang.org/genai/interactions/models/agents" gaos_interactions "google.golang.org/genai/interactions/models/interactions" "google.golang.org/genai/interactions/models/operations" ) func main() { ctx := context.Background() client, err := genai.NewClient(ctx, nil) if err != nil { log.Fatal(err) } // Step 1: Set up the environment interactively. interactionReq := operations.CreateInteractionRequest{ Body: operations.NewCreateInteractionRequestBody(gaos_interactions.CreateAgentInteraction{ Agent: gaos_interactions.AgentOption("antigravity-preview-05-2026"), Input: genai.Ptr(gaos_interactions.NewInteractionsInput("Write a basic Hello World template to /workspace/template.py.")), Environment: genai.Ptr(gaos_interactions.NewCreateAgentInteractionEnvironment("remote")), }), } interactionRes, err := client.Interactions.Create(ctx, interactionReq) if err != nil { log.Fatal(err) } envID := "" if interactionRes.Interaction != nil && interactionRes.Interaction.EnvironmentID != nil { envID = *interactionRes.Interaction.EnvironmentID } // Step 2: Fork that environment into a named agent. agentID := fmt.Sprintf("my-data-analyst-%d", time.Now().UnixNano()) req := operations.CreateAgentRequest{ Body: gaos_agents.Agent{ ID: genai.Ptr(agentID), BaseAgent: genai.Ptr("antigravity-preview-05-2026"), SystemInstruction: genai.Ptr("You are a data analyst. Use the template at /workspace/template.py for all reports."), BaseEnvironment: genai.Ptr(gaos_agents.NewBaseEnvironment(envID)), }, } res, err := client.Agents.Create(ctx, req) if err != nil { log.Fatal(err) } if res.Agent != nil && res.Agent.ID != nil { fmt.Printf("Forked agent: %s\n", *res.Agent.ID) } } ``` {% /tab %} {% /tabs %} {% /tab %} {% /tabs %} {% /right-column %} {% /two-column-layout %} {% two-column-layout %} {% left-column %} ## Response {% class="hide-from-toc" id="response" %} {% section class="api-ref-property-list" %} **id**: `string` The unique identifier for the agent. {% hr /%} **base_agent**: `string` The base agent to extend. {% hr /%} **system_instruction**: `string` System instruction for the agent. {% hr /%} **description**: `string` Agent description for developers to quickly read and understand. {% hr /%} {% details %} {% summary %} **agent_config**: `AntigravityAgentConfig` Configuration parameters for the agent. {% /summary %} **type**: {% mark %}required{% /mark %} `object` Value: `antigravity` **model**: `string` The model to use for agent reasoning. **max_total_tokens**: `string` Max total tokens for the agent run. {% /details %} {% hr /%} {% details %} {% summary %} **base_environment**: `EnvironmentConfig` or `string` The environment configuration for the agent. {% /summary %} **Possible Types:** {% class="api-ref-label" %} {% details %} {% summary %} **EnvironmentConfig** {% /summary %} Configuration for a custom environment. **type**: {% mark %}required{% /mark %} `object` Value: `remote` {% details %} {% summary %} **sources**: `Source array` {% /summary %} {% details %} {% summary %} **type**: `string enum` {% /summary %} Possible values: - `gcs`: A Cloud Storage bucket. - `inline`: Inline content. - `repository`: A generic repository. The protocol prefix in the source URL identifies the provider (e.g., github://, gcs://). {% /details %} **source**: `string` The source of the environment. For Cloud Storage, this is the Cloud Storage path. For GitHub, this is the GitHub path. **target**: `string` Where the source should appear in the environment. **content**: `string` The inline content if `type` is `INLINE`. **encoding**: `string` Optional encoding for inline content (e.g. `base64`). {% /details %} {% details %} {% summary %} **network**: `EnvironmentNetworkEgressAllowlist` or `string enum` Network configuration for the environment. {% /summary %} **Possible Types:** {% class="api-ref-label" %} {% details %} {% summary %} **EnvironmentNetworkEgressAllowlist** {% /summary %} Network egress configuration for the environment. {% details %} {% summary %} **allowlist**: `EgressRule array` or `string enum` List of allowed domains and their configurations. Set to `"disabled"` to block all network egress. {% /summary %} **Possible Types:** {% class="api-ref-label" %} {% details %} {% summary %} **EgressRule array** {% /summary %} A single domain allowlist rule with optional header injection. **domain**: {% mark %}required{% /mark %} `string` Domain to allow outbound requests to. Supports wildcards (e.g. '*.googleapis.com'). Use '*' to allow all domains. **transform**: `object` Headers to inject into requests matching this rule. Key: header name (e.g., "Authorization"). Value: header value (e.g., "Bearer your-token"). **credential**: `string` Optional. Reference to a server-managed Credential resource by ID. {% /details %} {% details %} {% summary %} **string enum** {% /summary %} Possible values: - `disabled`: All network egress is blocked. {% /details %} {% /details %} {% /details %} {% details %} {% summary %} **string enum** {% /summary %} Possible values: - `disabled`: All network egress is blocked. {% /details %} {% /details %} **environment_id**: `string` Optional. The environment ID for the interaction. If specified, the request will update the existing environment instead of creating a new one. {% details %} {% summary %} **env**: `object` or `string` Environment variables to set in the sandbox environment. {% /summary %} **Possible Types:** {% class="api-ref-label" %} {% details %} {% summary %} **string** {% /summary %} A direct string value. {% /details %} {% /details %} {% /details %} {% details %} {% summary %} **string** {% /summary %} A direct string value. {% /details %} {% /details %} {% hr /%} {% details %} {% summary %} **tools**: `AgentTool array` The tools available to the agent. {% /summary %} **Possible Types:** {% class="api-ref-label" %} {% details %} {% summary %} **CodeExecution** {% /summary %} A tool that can be used by the model to execute code. **type**: {% mark %}required{% /mark %} `object` Value: `code_execution` {% /details %} {% details %} {% summary %} **Function** {% /summary %} A tool that can be used by the model. **type**: {% mark %}required{% /mark %} `object` Value: `function` **name**: `string` The name of the function. **description**: `string` A description of the function. **parameters**: `object` The JSON Schema for the function's parameters. Supports a subset of JSON Schema. `minLength`, `maxLength`, `minProperties`, `maxProperties`, `uniqueItems`, `contains`, `minContains`, and `maxContains` are ignored and not enforced. {% /details %} {% details %} {% summary %} **GoogleSearch** {% /summary %} A tool that can be used by the model to search Google. **type**: {% mark %}required{% /mark %} `object` Value: `google_search` {% details %} {% summary %} **search_types**: `string enum array` The types of search grounding to enable. {% /summary %} Possible values: - `web_search`: Setting this field enables web search. Only text results are returned. - `image_search`: Setting this field enables image search. Image bytes are returned. {% /details %} {% /details %} {% details %} {% summary %} **McpServer** {% /summary %} A MCPServer is a server that can be called by the model to perform actions. **type**: {% mark %}required{% /mark %} `object` Value: `mcp_server` **name**: `string` The name of the MCPServer. **url**: `string` The full URL for the MCPServer endpoint. Example: "https://api.example.com/mcp" **headers**: `object` Optional: Fields for authentication headers, timeouts, etc., if needed. {% details %} {% summary %} **allowed_tools**: `AllowedTools array` The allowed tools. {% /summary %} {% details %} {% summary %} **mode**: `string enum` The mode of the tool choice. {% /summary %} Possible values: - `auto`: Auto tool choice. - `any`: Any tool choice. - `none`: No tool choice. - `validated`: Validated tool choice. {% /details %} **tools**: `string array` The names of the allowed tools. {% /details %} {% /details %} {% details %} {% summary %} **UrlContext** {% /summary %} A tool that can be used by the model to fetch URL context. **type**: {% mark %}required{% /mark %} `object` Value: `url_context` {% /details %} {% /details %} {% /section %} {% /left-column %} {% right-column class="sticky" %} **Example response** {% class="example-heading" %} {% tabs %} {% tab label="Create Agent" %} ```json { "description": "A helpful research assistant.", "base_agent": "antigravity-preview-05-2026", "base_environment": "remote", "id": "research-assistant-abc123", "system_instruction": "You are a helpful research assistant.", "tools": [ { "type": "google_search" } ] } ``` {% /tab %} {% tab label="Agent with Sources" %} ```json { "base_agent": "antigravity-preview-05-2026", "base_environment": { "type": "remote", "sources": [ { "type": "inline", "content": "Always use matplotlib for charts. Include a summary table in every report.", "target": ".agents/AGENTS.md" }, { "type": "repository", "source": "https://github.com/my-org/analysis-templates", "target": "/workspace/templates" } ] }, "id": "data-analyst-abc123", "system_instruction": "You are a data analyst. Always include visualizations and export results as PDF." } ``` {% /tab %} {% tab label="Agent Forked from Environment" %} ```json { "base_agent": "antigravity-preview-05-2026", "base_environment": "env_abc123", "id": "my-data-analyst-abc123", "system_instruction": "You are a data analyst. Use the template at /workspace/template.py for all reports." } ``` {% /tab %} {% /tabs %} {% /right-column %} {% /two-column-layout %}