o
    pkj|                    @   s  d Z ddlmZmZ ddlmZmZmZmZ ddl	m
Z
mZmZ ddlmZmZmZmZ ddlmZmZ ddlmZmZ ddlmZ d	d
lZd	dlmZmZmZmZm Z m!Z!m"Z" G dd deZ#G dd dZ$G dd dZ%G dd deZ&G dd dZ'G dd dZ(d
S )zACode generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.   )AsyncBaseSDKBaseSDK)errorsmodelstypesutils)AfterParseErrorContextHookContextResponseContext)OptionalNullableUNSETagentsinteractions)agent	agenttool)get_security_from_envresponse_helpers)unmarshal_json_response    N)AnyIterableListMappingOptionalUnioncastc                   @   &  e Zd Zedd Zedd Zdddddddddee dee d	ee d
ee dee	eef  dee	ee
f  deeeejf  dejfddZddddddddddddddee deeejejf  dee deeejejf  dee dee dee deeeej eej f  dee	eef  dee	ee
f  dee	ee
f  deeeejf  dejfddZddddddedee dee	eef  dee	ee
f  deeeejf  dejfddZddddddedee dee	eef  dee	ee
f  deeeejf  dejfdd Z dS )!Agentsc                 C      t | S N)AgentsWithRawResponseself r#   W/home/djax/ivt_ai_plugin/venv/lib/python3.10/site-packages/google/genai/_gaos/agents.pywith_raw_response"      zAgents.with_raw_responsec                 C   r   r   )AgentsWithStreamingResponser!   r#   r#   r$   with_streaming_response&   r&   zAgents.with_streaming_responseNapi_version	page_size
page_tokenparentextra_headersextra_querytimeoutr*   r+   r,   r-   r.   r/   r0   returnc                C   s  d}d}	t }
d}|}| |}|du r| jj}|dur|}n| ||	}tj||||d}t|\}}| j	d>i ddddd|d|	d	|d
dddddddddd|d|dtj
| jjjdd| jjddd|}|
t kr| jjt ur| jj}
ntjdtddddddd }
d}t|
tjr|
g d!f}d"d# }t| j|pd$d%dt| jjtjdd&d'd(d)d*d'd+d,d*d'd-d.d*d'd/d0d*git|d1d2d3}| j||d4d5 |d6k|d7}|d8kr:td9d:g|jr|  z|| W n! ty } zt| jjd; t||| W Y d}~nd}~ww |d6kr#tj ntj!}t"t#|||d<| t|| jj$d;d=S z||W S  tya } zt| jjd; t||| W Y d}~dS d}~ww )?  Lists all Agents.

        :param api_version: Which version of the API to use.
        :param page_size:
        :param page_token:
        :param parent:
        :param extra_headers: Additional headers to set or replace on requests.
        :param extra_query: Additional query parameters to append to requests.
        :param timeout: Override the default request timeout configuration for this method in seconds
        Nr*   r+   r,   r-   methodGETpath/{api_version}/agentsbase_urlurl_variablesrequestrequest_body_requiredFrequest_has_path_paramsTrequest_has_query_paramsuser_agent_header
user-agentaccept_header_valueapplication/jsonhttp_headersextra_query_params_globalsr*   securityallow_empty_value
timeout_msattempt-count-backoff  @     0u     max_retries4084094295XXc                 S   v   t | ddrt | }td| |t | ddr&t | }td| |t | ddr5ttj| ddS td	| 
N4XX*zAPI error occurredrU   defaultrA   F)validatezUnexpected response received)r   match_responsestream_to_textr   GenAiDefaultErrorr   r   AgentListResponsehttp_reshttp_res_textr#   r#   r$   _speakeasy_parse_response{      

z.Agents.list.<locals>._speakeasy_parse_response 
ListAgentsx-codeSampleslistshmcurl -X GET https://generativelanguage.googleapis.com/v1beta/agents \
  -H "x-goog-api-key: $GEMINI_API_KEY"
labellangsourcepythonfrom google import genai

client = genai.Client()
response = client.agents.list()
for agent in response.agents or []:
    print(agent.id)

javascriptimport {GoogleGenAI} from '@google/genai';

const ai = new GoogleGenAI({});
const agents = await ai.agents.list();
for (const agent of (agents.agents ?? [])) {
    console.log(agent.id);
}
java  import com.google.genai.Client;
import com.google.genai.gaos.models.agents.Agent;
import com.google.genai.gaos.models.agents.AgentListResponse;
import com.google.genai.gaos.models.operations.ListAgentsResponse;
import java.util.List;

Client client = new Client();
ListAgentsResponse response = client.agents.list().call();
List<Agent> agents = response.agentListResponse()
    .flatMap(AgentListResponse::agents)
    .orElse(List.of());
for (Agent agent : agents) {
  agent.id().ifPresent(System.out::println);
}
syncmode	executionconfigr8   operation_idoauth2_scopessecurity_sourcetags
extensionsresponsec                 S      t ddg| S NrX   rU   r   match_status_codescr#   r#   r$   <lambda>       zAgents.list.<locals>.<lambda>	streaminghook_ctxr:   is_error_status_codestreamretry_configparsedrX   rU   _hooksbufferedrawparserrw   
client_refr   hooksr#   )%r   _coerce_timeout_mssdk_configurationrH   _get_urlr   ListAgentsRequestr   consume_response_mode_build_requestListAgentsGlobalsglobalsr*   rF   r   r   RetryConfigBackoffStrategy
isinstancer	   r   r   Securityr
   
do_requestr   status_coderead	Exceptionraise_parse_error__dict__r   StreamedAPIResponseAPIResponser   r   getr"   r*   r+   r,   r-   r.   r/   r0   r8   r9   retries
server_urlrB   rH   r:   _speakeasy_response_modereqr   rc   _speakeasy_hook_ctxra   
parse_exc__speakeasy_response_clsr#   r#   r$   rh   *   s"  

	



#


	

zAgents.listr*   agent_config
base_agentbase_environmentdescriptionidsystem_instructiontoolsr.   r/   
extra_bodyr0   r   r   r   r   r   r   r   r   c                   sb  d}d}t }d}|	}| |}|du r| jj}|dur|}n| ||}tj|tjt	
|ttj |t	
|ttj |||t	
|tttj  ddt|\}}| jdJi ddddd|d	|d
ddddddddddd|d|
dtj| jjjdd| jjd fddddd|}|t kr| jjt ur| jj}nt	jdt	ddd d!dd"d#}d}t|t	jr|g d$f}d%d& }t| j|pd'd(dt| jjtjdd)d*d+d,d-d*d.d/d-d*d0d1d-d*d2d3d-d4d+d5d-d4d.d6d-d4d0d7d-d4d2d8d-d9d+d:d-d9d.d;d-d9d0d<d-d9d2d=d-git|d>d?d@}| j ||dAd |dBk|dC}|dDkrt	!dEdFg|j"rj|#  z|| W n! t$yi } zt%| jj&dG t'||| W Y d}~nd}~ww |dBkrrtj(ntj)}t*t+|||dH| t'|| jj&,dGdIS z||W S  t$y } zt%| jj&dG t'||| W Y d}~dS d}~ww )K  Creates a new Agent (Typed version for SDK).

        :param api_version: Which version of the API to use.
        :param agent_config: Configuration parameters for the agent.
        :param base_agent: The base agent to extend.
        :param base_environment: The environment configuration for the agent.
        :param description: Agent description for developers to quickly read and understand.
        :param id: The unique identifier for the agent.
        :param system_instruction: System instruction for the agent.
        :param tools: The tools available to the agent.
        :param extra_headers: Additional headers to set or replace on requests.
        :param extra_query: Additional query parameters to append to requests.
        :param extra_body: Additional JSON object fields to merge into request bodies.
        :param timeout: Override the default request timeout configuration for this method in seconds
        Nr   r   r   r   r   r   r   r*   bodyr4   POSTr6   r7   r8   r9   r:   r;   Tr<   r=   r>   r?   r@   rA   rB   rC   rD   rE   rF   get_serialized_bodyc                         t jjdddtj dS NFjson)r   r   serialize_request_bodyr   r   Agentr#   r   r:   r#   r$   r   8      zAgents.create.<locals>.<lambda>rG   rH   rI   rJ   rK   rL   rM   rN   rO   rQ   c                 S   rV   rW   r   r\   r]   r   r^   r   r   r   r`   r#   r#   r$   rc   N     

z0Agents.create.<locals>._speakeasy_parse_responsere   CreateAgentrg   createri     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"}]
  }'
rk   ro     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)

# [cleanup]
client.agents.delete(agent.id)
# [/cleanup]
rq   b  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);

// [cleanup]
await ai.agents.delete(agent.id);
// [/cleanup]
rs     import com.google.genai.Client;
import com.google.genai.gaos.models.agents.Agent;
import com.google.genai.gaos.models.agents.BaseEnvironment;
import com.google.genai.gaos.models.interactions.GoogleSearch;
import com.google.genai.gaos.models.operations.CreateAgentResponse;
import java.util.List;
import java.util.UUID;

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(""));

// [cleanup]
client.agents.delete(agentId);
// [/cleanup]
with_sources  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"
        }
      ]
    }
  }'
q  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}")

# [cleanup]
client.agents.delete(agent.id)
# [/cleanup]
  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}`);

// [cleanup]
if (agent.id) await ai.agents.delete(agent.id);
// [/cleanup]
  import com.google.genai.Client;
import com.google.genai.gaos.models.agents.Agent;
import com.google.genai.gaos.models.agents.BaseEnvironment;
import com.google.genai.gaos.models.interactions.Environment;
import com.google.genai.gaos.models.interactions.Source;
import com.google.genai.gaos.models.interactions.SourceType;
import com.google.genai.gaos.models.operations.CreateAgentResponse;
import java.util.List;
import java.util.UUID;

Client client = new Client();
String agentId = "data-analyst-" + UUID.randomUUID().toString().substring(0, 8);
Environment env = 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(""));

// [cleanup]
client.agents.delete(agentId);
// [/cleanup]
fork_from_env  # 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\"
  }"
  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}")

# [cleanup]
client.agents.delete(agent.id)
# [/cleanup]
D  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}`);

// [cleanup]
if (agent.id) await ai.agents.delete(agent.id);
// [/cleanup]
  import com.google.genai.Client;
import com.google.genai.gaos.models.agents.Agent;
import com.google.genai.gaos.models.agents.BaseEnvironment;
import com.google.genai.gaos.models.interactions.AgentOption;
import com.google.genai.gaos.models.interactions.CreateAgentInteraction;
import com.google.genai.gaos.models.interactions.CreateAgentInteractionEnvironment;
import com.google.genai.gaos.models.interactions.Interaction;
import com.google.genai.gaos.models.interactions.InteractionsInput;
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 java.util.UUID;

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(""));

// [cleanup]
client.agents.delete(agentId);
// [/cleanup]
ru   rv   ry   c                 S   r   r   r   r   r#   r#   r$   r     r   r   r   r   rX   rU   r   r   r   r#   )-r   r   r   rH   r   r   CreateAgentRequestr   r   r   get_pydantic_modelr   AgentConfigBaseEnvironmentr   	AgentToolr   r   r   CreateAgentGlobalsr   r*   rF   r   r   r   r   r	   r   r   r   r
   r   r   r   r   r   r   r   r   r   r   r   r   r   r"   r*   r   r   r   r   r   r   r   r.   r/   r   r0   r8   r9   r   r   rB   rH   r   r   r   rc   r   ra   r   r   r#   r   r$   r      sz  (



	



@K


	

zAgents.creater*   r.   r/   r0   c                C     d}d}t }d}	|}
| |}|du r| jj}|	dur|	}n| ||}tj||d}t|
\}}
| j	d>i ddddd|d|d	|d
dddddddddd|
d|dtj
| jjjdd| jjddd|}|t kr| jjt ur| jj}ntjdtddddddd }d}t|tjr|g d!f}d"d# }t| j|pd$d%dt| jjtjdd&d'd(d)d*d'd+d,d*d'd-d.d*d'd/d0d*git|d1d2d3}| j||d4d5 |d6k|d7}|d8kr8td9d:g|jr|  z|| W n! ty } zt| jjd; t||| W Y d}~nd}~ww |d6kr!tj ntj!}t"t#|||d<| t|| jj$d;d=S z||W S  ty_ } zt| jjd; t||| W Y d}~dS d}~ww )?p  Deletes an Agent.

        :param id:
        :param api_version: Which version of the API to use.
        :param extra_headers: Additional headers to set or replace on requests.
        :param extra_query: Additional query parameters to append to requests.
        :param timeout: Override the default request timeout configuration for this method in seconds
        Nr*   r   r4   DELETEr6   /{api_version}/agents/{id}r8   r9   r:   r;   Fr<   Tr=   r>   r?   r@   rA   rB   rC   rD   rE   rF   rG   rH   rI   rJ   rK   rL   rM   rN   rO   rQ   c                 S   rV   rW   )r   r\   r]   r   r^   r   r   Emptyr`   r#   r#   r$   rc   !  rd   z0Agents.delete.<locals>._speakeasy_parse_responsere   DeleteAgentrg   deleteri   zcurl -X DELETE https://generativelanguage.googleapis.com/v1beta/agents/ag_abc123 \
  -H "x-goog-api-key: $GEMINI_API_KEY"
rk   ro   q  import uuid
from google import genai

client = genai.Client()

# [setup]
agent_id = f"delete-test-{uuid.uuid4().hex[:8]}"
client.agents.create(
    id=agent_id,
    base_agent="antigravity-preview-05-2026",
    description="Temporary agent for deletion.",
    base_environment="remote",
)
# [/setup]

client.agents.delete(agent_id)
print("Agent deleted successfully.")
rq     import {GoogleGenAI} from '@google/genai';

const ai = new GoogleGenAI({});

// [setup]
const agentId = `delete-test-${crypto.randomUUID().slice(0, 8)}`;
await ai.agents.create({
    id: agentId,
    base_agent: 'antigravity-preview-05-2026',
    description: 'Temporary agent for deletion.',
    base_environment: 'remote',
});
// [/setup]

await ai.agents.delete(agentId);
console.log('Agent deleted successfully.');
rs   W  import com.google.genai.Client;
import com.google.genai.gaos.models.agents.Agent;
import com.google.genai.gaos.models.agents.BaseEnvironment;
import java.util.UUID;

Client client = new Client();

// [setup]
String agentId = "delete-test-" + UUID.randomUUID().toString().substring(0, 8);
client.agents.create(Agent.builder()
    .id(agentId)
    .baseAgent("antigravity-preview-05-2026")
    .description("Temporary agent for deletion.")
    .baseEnvironment(BaseEnvironment.of("remote"))
    .build());
// [/setup]

client.agents.delete(agentId);
System.out.println("Agent deleted successfully.");
ru   rv   ry   c                 S   r   r   r   r   r#   r#   r$   r   Y  r   zAgents.delete.<locals>.<lambda>r   r   r   rX   rU   r   r   r   r#   )%r   r   r   rH   r   r   DeleteAgentRequestr   r   r   DeleteAgentGlobalsr   r*   rF   r   r   r   r   r   r	   r   r   r   r
   r   r   r   r   r   r   r   r   r   r   r   r   r   r"   r   r*   r.   r/   r0   r8   r9   r   r   rB   rH   r:   r   r   r   rc   r   ra   r   r   r#   r#   r$   r     s  

	



#


	

zAgents.deletec                C   r   )?u  Gets a specific Agent.

        :param id:
        :param api_version: Which version of the API to use.
        :param extra_headers: Additional headers to set or replace on requests.
        :param extra_query: Additional query parameters to append to requests.
        :param timeout: Override the default request timeout configuration for this method in seconds
        Nr   r4   r5   r6   r   r8   r9   r:   r;   Fr<   Tr=   r>   r?   r@   rA   rB   rC   rD   rE   rF   rG   rH   rI   rJ   rK   rL   rM   rN   rO   rQ   c                 S   rV   rW   r   r`   r#   r#   r$   rc     r   z-Agents.get.<locals>._speakeasy_parse_responsere   GetAgentrg   r   ri   wcurl -X GET https://generativelanguage.googleapis.com/v1beta/agents/ag_abc123 \
  -H "x-goog-api-key: $GEMINI_API_KEY"
rk   ro     import uuid
from google import genai

client = genai.Client()

# [setup]
agent_id = f"test-agent-{uuid.uuid4().hex[:8]}"
client.agents.create(
    id=agent_id,
    base_agent="antigravity-preview-05-2026",
    description="A test agent.",
    base_environment="remote",
)
# [/setup]

agent = client.agents.get(agent_id)
print(agent.id)

# [cleanup]
client.agents.delete(agent.id)
# [/cleanup]
rq     import {GoogleGenAI} from '@google/genai';

const ai = new GoogleGenAI({});

// [setup]
const agentId = `test-agent-${crypto.randomUUID().slice(0, 8)}`;
await ai.agents.create({
    id: agentId,
    base_agent: 'antigravity-preview-05-2026',
    description: 'A test agent.',
    base_environment: 'remote',
});
// [/setup]

const agent = await ai.agents.get(agentId);
if (!agent.id) {
    throw new Error('Agent retrieval failed: ID is undefined');
}
console.log(agent.id);

// [cleanup]
await ai.agents.delete(agent.id);
// [/cleanup]
rs   0  import com.google.genai.Client;
import com.google.genai.gaos.models.agents.Agent;
import com.google.genai.gaos.models.agents.BaseEnvironment;
import com.google.genai.gaos.models.operations.GetAgentResponse;
import java.util.UUID;

Client client = new Client();

// [setup]
String agentId = "test-agent-" + UUID.randomUUID().toString().substring(0, 8);
client.agents.create(Agent.builder()
    .id(agentId)
    .baseAgent("antigravity-preview-05-2026")
    .description("A test agent.")
    .baseEnvironment(BaseEnvironment.of("remote"))
    .build());
// [/setup]

GetAgentResponse response = client.agents.get(agentId);
Agent agent = response.agent().orElseThrow(() -> new RuntimeException("No agent returned"));
System.out.println(agent.id().orElse(""));

// [cleanup]
client.agents.delete(agentId);
// [/cleanup]
ru   rv   ry   c                 S   r   r   r   r   r#   r#   r$   r     r   zAgents.get.<locals>.<lambda>r   r   r   rX   rU   r   r   r   r#   )%r   r   r   rH   r   r   GetAgentRequestr   r   r   GetAgentGlobalsr   r*   rF   r   r   r   r   r   r	   r   r   r   r
   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r#   r#   r$   r     s  

	



#


	

z
Agents.get!__name__
__module____qualname__propertyr%   r(   r   strintr   r   r   floathttpxTimeoutr   r_   rh   agents_agentr   AgentConfigParamr   BaseEnvironmentParamr   agents_agenttoolr   AgentToolParamr   r   r   r   r   r   r#   r#   r#   r$   r   !   s    

	

 7
 ~
 2r   c                   @      e Zd ZdeddfddZdS )r    sdkr1   Nc                 C   J   || _ t|jd| _t|jd| _t|jd| _t|jd| _d S Nr.   )_sdkr   to_raw_response_wrapperrh   r   r   r   r"   r  r#   r#   r$   __init__0  s   zAgentsWithRawResponse.__init__r   r   r   r   r  r#   r#   r#   r$   r    /      r    c                   @   r  )r'   r  r1   Nc                 C   r  r  )r  r   to_streamed_response_wrapperrh   r   r   r   r  r#   r#   r$   r  =     
z$AgentsWithStreamingResponse.__init__r  r#   r#   r#   r$   r'   <  r  r'   c                   @   r   )!AsyncAgentsc                 C   r   r   )AsyncAgentsWithRawResponser!   r#   r#   r$   r%   N  r&   zAsyncAgents.with_raw_responsec                 C   r   r   ) AsyncAgentsWithStreamingResponser!   r#   r#   r$   r(   R  r&   z#AsyncAgents.with_streaming_responseNr)   r*   r+   r,   r-   r.   r/   r0   r1   c                   s  d}d}	t }
d}|}| |}|du r| jj}|dur|}n| ||	}tj||||d}t|\}}| j	d?i ddddd|d|	d	|d
dddddddddd|d|dtj
| jjjdd| jjddd|}|
t kr| jjt ur| jj}
ntjdtddddddd }
d}t|
tjr|
g d!f}d"d# }t| j|pd$d%dt| jjtjdd&d'd(d)d*d'd+d,d*d'd-d.d*d'd/d0d*git|d1d2d3}| j||d4d5 |d6k|d7I dH }|d8krTtd9d:g|jr/| I dH  z	||I dH  W n+ ty. } zt| jjd;| jjd<t |||I dH  W Y d}~nd}~ww |d6kr7tj!ntj"}t#t$|||d=| t || jjd<| jjd;d>S z||I dH W S  ty } zt| jjd;| jjd<t |||I dH  W Y d}~dS d}~ww )@r2   Nr3   r4   r5   r6   r7   r8   r9   r:   r;   Fr<   Tr=   r>   r?   r@   rA   rB   rC   rD   rE   rF   rG   rH   rI   rJ   rK   rL   rM   rN   rO   rQ   c                       t | ddrt | I d H }td| |t | ddr-t | I d H }td| |t | ddr<ttj| ddS td	| rW   )r   r\   stream_to_text_asyncr   r^   r   r   r_   r`   r#   r#   r$   rc         z3AsyncAgents.list.<locals>._speakeasy_parse_responsere   rf   rg   rh   ri   rj   rk   ro   rp   rq   rr   rs   rt   asyncrv   ry   c                 S   r   r   r   r   r#   r#   r$   r     r   z"AsyncAgents.list.<locals>.<lambda>r   r   r   rX   rU   _async_hooksr   r   r   r   rw   r   r   r   async_hooksr#   )%r   r   r   rH   r   r   r   r   r   _build_request_asyncr   r   r*   rF   r   r   r   r   r   r	   r   r   r   r
   do_request_asyncr   r   areadr   raise_parse_error_asyncr   r   r   AsyncStreamedAPIResponseAsyncAPIResponser   r   r   r#   r#   r$   rh   V  s*  

	



#


zAsyncAgents.listr   r   r   r   r   r   r   r   r   c                   s  d}d}t }d}|	}| |}|du r| jj}|dur|}n| ||}tj|tjt	
|ttj |t	
|ttj |||t	
|tttj  ddt|\}}| jdKi ddddd|d	|d
ddddddddddd|d|
dtj| jjjdd| jjd fddddd|}|t kr| jjt ur| jj}nt	jdt	ddd d!dd"d#}d}t|t	jr|g d$f}d%d& }t| j|pd'd(dt| jjtjdd)d*d+d,d-d*d.d/d-d*d0d1d-d*d2d3d-d4d+d5d-d4d.d6d-d4d0d7d-d4d2d8d-d9d+d:d-d9d.d;d-d9d0d<d-d9d2d=d-git|d>d?d@}| j ||dAd |dBk|dCI dH }|dDkrt	!dEdFg|j"r~|# I dH  z	||I dH  W n+ t$y} } zt%| jj&'dG| jj&'dHt(|||I dH  W Y d}~nd}~ww |dBkrtj)ntj*}t+t,|||dI| t(|| jj&'dH| jj&'dGdJS z||I dH W S  t$y } zt%| jj&'dG| jj&'dHt(|||I dH  W Y d}~dS d}~ww )Lr   Nr   r   r4   r   r6   r7   r8   r9   r:   r;   Tr<   r=   r>   r?   r@   rA   rB   rC   rD   rE   rF   r   c                      r   r   r   r#   r   r#   r$   r   g  r   z$AsyncAgents.create.<locals>.<lambda>rG   rH   rI   rJ   rK   rL   rM   rN   rO   rQ   c                    r  rW   r   r\   r  r   r^   r   r   r   r`   r#   r#   r$   rc   }     z5AsyncAgents.create.<locals>._speakeasy_parse_responsere   r   rg   r   ri   r   rk   ro   r   rq   r   rs   r   r   r   r   r   r   r   r   r   r   r   r  rv   ry   c                 S   r   r   r   r   r#   r#   r$   r     r   r   r   r   rX   rU   r  r   r   r  r#   )-r   r   r   rH   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r!  r   r   r*   rF   r   r   r   r   r	   r   r   r   r
   r"  r   r   r#  r   r$  r   r   r   r%  r&  r   r   r   r#   r   r$   r     s  (



	



@K


zAsyncAgents.creater   c                     d}d}t }d}	|}
| |}|du r| jj}|	dur|	}n| ||}tj||d}t|
\}}
| j	d?i ddddd|d|d	|d
dddddddddd|
d|dtj
| jjjdd| jjddd|}|t kr| jjt ur| jj}ntjdtddddddd }d}t|tjr|g d!f}d"d# }t| j|pd$d%dt| jjtjdd&d'd(d)d*d'd+d,d*d'd-d.d*d'd/d0d*git|d1d2d3}| j||d4d5 |d6k|d7I dH }|d8krRtd9d:g|jr-| I dH  z	||I dH  W n+ ty, } zt| jjd;| jjd<t |||I dH  W Y d}~nd}~ww |d6kr5tj!ntj"}t#t$|||d=| t || jjd<| jjd;d>S z||I dH W S  ty } zt| jjd;| jjd<t |||I dH  W Y d}~dS d}~ww )@r   Nr   r4   r   r6   r   r8   r9   r:   r;   Fr<   Tr=   r>   r?   r@   rA   rB   rC   rD   rE   rF   rG   rH   rI   rJ   rK   rL   rM   rN   rO   rQ   c                    r  rW   )r   r\   r  r   r^   r   r   r   r`   r#   r#   r$   rc   S  r  z5AsyncAgents.delete.<locals>._speakeasy_parse_responsere   r   rg   r   ri   r   rk   ro   r   rq   r   rs   r   r  rv   ry   c                 S   r   r   r   r   r#   r#   r$   r     r   z$AsyncAgents.delete.<locals>.<lambda>r   r   r   rX   rU   r  r   r   r  r#   )%r   r   r   rH   r   r   r   r   r   r!  r   r   r*   rF   r   r   r   r   r   r	   r   r   r   r
   r"  r   r   r#  r   r$  r   r   r   r%  r&  r   r   r   r#   r#   r$   r     s&  

	



#


zAsyncAgents.deletec                   r)  )@r   Nr   r4   r5   r6   r   r8   r9   r:   r;   Fr<   Tr=   r>   r?   r@   rA   rB   rC   rD   rE   rF   rG   rH   rI   rJ   rK   rL   rM   rN   rO   rQ   c                    r  rW   r'  r`   r#   r#   r$   rc     r(  z2AsyncAgents.get.<locals>._speakeasy_parse_responsere   r   rg   r   ri   r   rk   ro   r   rq   r   rs   r   r  rv   ry   c                 S   r   r   r   r   r#   r#   r$   r   9  r   z!AsyncAgents.get.<locals>.<lambda>r   r   r   rX   rU   r  r   r   r  r#   )%r   r   r   rH   r   r   r   r   r   r!  r   r   r*   rF   r   r   r   r   r   r	   r   r   r   r
   r"  r   r   r#  r   r$  r   r   r   r%  r&  r   r   r   r#   r#   r$   r     s&  

	



#


zAsyncAgents.getr   r#   r#   r#   r$   r  M  s    

	

 :
  
 5r  c                   @   r  )r  r  r1   Nc                 C   r  r  )r  r   async_to_raw_response_wrapperrh   r   r   r   r  r#   r#   r$   r  h  r  z#AsyncAgentsWithRawResponse.__init__r   r   r   r  r  r#   r#   r#   r$   r  g  r  r  c                   @   r  )r  r  r1   Nc                 C   r  r  )r  r   "async_to_streamed_response_wrapperrh   r   r   r   r  r#   r#   r$   r  y  r  z)AsyncAgentsWithStreamingResponse.__init__r+  r#   r#   r#   r$   r  x  r  r  ))__doc__basesdkr   r   re   r   r   r   r   r   r   r	   r
   r   r   r   r   types.agentsr   r  r   r	  r   r   utils.unmarshal_json_responser   r  typingr   r   r   r   r   r   r   r   r    r'   r  r  r  r#   r#   r#   r$   <module>   s8   $             