> ## AI Agent Context
> - Full documentation index: https://aistudio.google.com/llms.txt
> - Gemini Docs MCP server (consistent live info): https://gemini-api-docs-mcp.dev
> - Coding agent skills & setup guide: https://aistudio.google.com/docs/coding-agents.md

# Creating an interaction

{% mark class="http-post" %}{% icon name="north_east" /%}`POST`{% /mark %} `https://generativelanguage.googleapis.com/v1/interactions`

Creates a new interaction.

{% two-column-layout %}
  {% left-column %}
## Request Body  {% class="hide-from-toc" id="request-body" %}

  {% section class="api-ref-property-list" %}
  {% details %}
  {% summary %}
  **model**: `ModelOption`

  The name of the `Model` used for generating the interaction. **Required if `agent` is not provided.**

  {% /summary %}

  Possible values:

  - `gemma-4-26b-a4b-it`: Gemma 4 26B A4B IT
  - `gemma-4-31b-it`: Gemma 4 31B IT
  - `gemini-2.5-flash`: Our first hybrid reasoning model which supports a 1M token context window and has thinking budgets.
  - `gemini-2.5-pro`: Our state-of-the-art multipurpose model, which excels at coding and complex reasoning tasks.
  - `gemini-2.5-flash-lite`: Our smallest and most cost effective model, built for at scale usage.
  - `gemini-3.5-flash-lite`: Gemini 3.5 Flash-Lite - Our fastest, most cost-effective 3.5 model for high-throughput execution.
  - `gemini-2.5-flash-image`: Our native image generation model, optimized for speed, flexibility, and contextual understanding. Text input and output is priced the same as 2.5 Flash.
  - `gemini-3.1-flash-lite`: Our most cost-efficient model, optimized for high-volume agentic tasks, translation, and simple data processing.
  - `gemini-3.1-flash-lite-image`: Gemini 3.1 Flash Lite Image.
  - `gemini-3-pro-image`: Gemini 3 Pro Image
  - `gemini-3.1-flash-image`: Gemini 3.1 Flash Image.
  - `gemini-nano-banana-2.1`: Gemini Nano Banana 2.1.
  - `gemini-3.5-flash`: Gemini 3.5 Flash - Our earlier Flash model, built for speed and foundational performance across routine, high-throughput workloads.
  - `gemini-3.6-flash`: Gemini 3.6 Flash - Our previous generation Flash model, balancing speed and multimodal capabilities across general agentic and everyday tasks.
  - `gemini-3.7-flash`: Gemini 3.7 Flash - Our high-speed, efficient Flash model built for everyday coding, agentic tool use, and reliable multi-step execution.
  - `gemini-3.8-flash`: Gemini 3.8 Flash - Our most intelligent Flash model, engineered for long-horizon software engineering, autonomous agents, and complex enterprise workflows.
  - `gemini-4-argon`: Gemini 4 Argon - Our new frontier model, built to solve the hardest problems with depth and precision across real-world software engineering and knowledge work.
  - `gemini-4-carbon`: Gemini 4 Carbon - Our most capable reasoning model, built for sustained agentic coding, multimodal knowledge work, scientific discovery, and cybersecurity defense.
  - `gemini-4-hydrogen`: Gemini 4 Hydrogen - A model with frontier-level intelligence, built for fast, dependable execution across coding, agentic workflows, and multimodal knowledge work.
  - `gemini-4-neon`: Gemini 4 Neon - Frontier-level intelligence with fast end-to-end task completion across complex software engineering, analytical, and science workflows.

  {% /details %}

  {% hr /%}

  {% details %}
  {% summary %}
  **agent**: `AgentOption`

  The name of the `Agent` used for generating the interaction. **Required if `model` is not provided.**

  {% /summary %}

  Possible values:

  - `deep-research-preview-04-2026`: Gemini Deep Research Agent
  - `deep-research-max-preview-04-2026`: Gemini Deep Research Max Agent
  - `antigravity-preview-05-2026`: Use the Antigravity managed agent to perform multi-step tasks that require reasoning, file operations, and tool use.
  - `antigravity-preview-09-2026`: Use the Antigravity managed agent to perform multi-step tasks that require reasoning, file operations, and tool use.

  {% /details %}

  {% hr /%}

  **input**: {% mark %}required{% /mark %} [`Content`](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:Content) or [`Content`](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:Content) `array` or [`Step`](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:Step) `array` or `string`

  The inputs for the interaction (common to both Model and Agent).

  {% hr /%}

  {% details %}
  {% summary %}
  **generation_config**: `GenerationConfig`

  **Model Configuration** Configuration parameters for the model interaction. *Alternative to `agent_config`. Only applicable when `model` is set.*

  {% /summary %}

  **seed**: `integer`

  Seed used in decoding for reproducibility.

  **stop_sequences**: `string array`

  A list of character sequences that will stop output interaction.

  {% details %}
  {% summary %}
  **tool_choice**: [`ToolChoiceConfig`](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:ToolChoiceConfig) or `string enum`

  The tool choice configuration.

  {% /summary %}

  **Possible Types:** {% class="api-ref-label" %}

  {% details %}
  {% summary %}
  **[ToolChoiceConfig](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:ToolChoiceConfig)**

  {% /summary %}

  The tool choice configuration containing allowed tools.

  {% details %}
  {% summary %}
  **allowed_tools**: `AllowedTools`

  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 %}
  **string enum**

  {% /summary %}

  Possible values:

  - `auto`: Auto tool choice.
  - `any`: Any tool choice.
  - `none`: No tool choice.
  - `validated`: Validated tool choice.

  {% /details %}

  {% /details %}

  {% details %}
  {% summary %}
  **thinking_level**: `ThinkingLevel`

  The level of thought tokens that the model should generate.

  {% /summary %}

  Possible values:

  - `minimal`: Little to no thinking.
  - `low`: Low thinking level.
  - `medium`: Medium thinking level.
  - `high`: High thinking level.
  - `xhigh`: Extra high thinking level, above `high`.

  {% /details %}

  {% details %}
  {% summary %}
  **thinking_summaries**: `ThinkingSummaries`

  Whether to include thought summaries in the response.

  {% /summary %}

  Possible values:

  - `auto`: Auto thinking summaries.
  - `none`: No thinking summaries.

  {% /details %}

  **max_output_tokens**: `integer`

  The maximum number of tokens to include in the response.

  {% details %}
  {% summary %}
  **video_config**: `VideoConfig`

  Configuration for video generation.

  {% /summary %}

  {% details %}
  {% summary %}
  **task**: `string enum`

  Optional task mode for video generation. If not specified, the model automatically determines the appropriate mode based on the provided text prompt and input media.

  {% /summary %}

  Possible values:

  - `text_to_video`: Generates video solely from a text prompt.
  - `image_to_video`: Generates video from one or two source images. The first image defines the starting frame, and the optional second image defines the ending frame.
  - `reference_to_video`: Generates video using reference media (such as images, audio, or video).
  - `edit`: Modifies an existing input video.
  - `extend`: Extends an existing input video.

  {% /details %}

  {% /details %}

  {% /details %}

  {% hr /%}

  {% details %}
  {% summary %}
  **agent_config**: `DynamicAgentConfig`

  **Agent Configuration** Configuration for the agent. *Alternative to `generation_config`. Only applicable when `agent` is set.*

  {% /summary %}

  **type**: {% mark %}required{% /mark %} `object`

  Value: `dynamic`

  {% /details %}

  {% hr /%}

  **system_instruction**: `string`

  System instruction for the interaction.

  {% hr /%}

  **tools**: [`Tool`](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:Tool) `array`

  A list of tool declarations the model may call during interaction.

  {% hr /%}

  {% details %}
  {% summary %}
  **response_format**: [`ResponseFormat`](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:ResponseFormat) or [`ResponseFormat`](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:ResponseFormat) `array`

  Enforces that the generated response is a JSON object that complies with the JSON schema specified in this field.

  {% /summary %}

  **Possible Types:** {% class="api-ref-label" %}

  {% details %}
  {% summary %}
  **[ResponseFormat](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:ResponseFormat)**

  {% /summary %}

  {% /details %}

  {% details %}
  {% summary %}
  **[ResponseFormat](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:ResponseFormat) array**

  {% /summary %}

  A list where each item is one of: `AudioResponseFormat`, `ImageResponseFormat`, `TextResponseFormat`, `VideoResponseFormat`.

  {% /details %}

  {% /details %}

  {% hr /%}

  **previous_interaction_id**: `string`

  The ID of the previous interaction, if any.

  {% hr /%}

  {% details %}
  {% summary %}
  **service_tier**: `ServiceTier`

  The service tier for the interaction.

  {% /summary %}

  Possible values:

  - `flex`: Flex service tier.
  - `standard`: Standard service tier.
  - `priority`: Priority service tier.

  {% /details %}

  {% hr /%}

  {% details %}
  {% summary %}
  **safety_settings**: `SafetySetting array`

  Safety settings for the interaction.

  {% /summary %}

  {% details %}
  {% summary %}
  **type**: {% mark %}required{% /mark %} `HarmCategory`

  The type of harm category to be blocked.

  {% /summary %}

  Possible values:

  - `hate_speech`: Content that promotes violence or incites hatred against individuals or groups based on certain attributes.
  - `dangerous_content`: Content that promotes, facilitates, or enables dangerous activities.
  - `harassment`: Abusive, threatening, or content intended to bully, torment, or ridicule.
  - `sexually_explicit`: Content that contains sexually explicit material.
  - `jailbreak`: Prompts designed to bypass safety filters.

  {% /details %}

  {% details %}
  {% summary %}
  **threshold**: {% mark %}required{% /mark %} `string enum`

  The threshold for blocking content. If the harm probability exceeds this threshold, the content will be blocked.

  {% /summary %}

  Possible values:

  - `block_low_and_above`: Block content with a low harm probability or higher.
  - `block_medium_and_above`: Block content with a medium harm probability or higher.
  - `block_only_high`: Block content with a high harm probability.
  - `off`: Turn off the safety filter entirely.

  {% /details %}

  {% details %}
  {% summary %}
  **method**: `string enum`

  Optional. The method for blocking content. If not specified, the default behavior is to use the probability score.

  {% /summary %}

  Possible values:

  - `severity`: The harm block method uses both probability and severity scores.
  - `probability`: The harm block method uses the probability score.

  {% /details %}

  {% /details %}

  {% hr /%}

  **continuation_token**: `string`

  Opaque token to resume a long decode. Output: set when status is REQUIRES_CONTINUATION and decoding can be resumed. Input: pass the latest token back unchanged when creating the next interaction to continue decoding.

  {% hr /%}

  **stream**: `boolean`

  Input only. Whether the interaction will be streamed.

  {% hr /%}

  **store**: `boolean`

  Input only. Whether to store the response and request for later retrieval.

  {% hr /%}

  **background**: `boolean`

  Input only. Whether to run the model interaction in the background.

  {% /section %}

  {% /left-column %}

  {% right-column class="sticky" %}
  **Example request** {% class="example-heading" %}

  {% tabs %}
  {% tab label="Simple Request" %}
  {% tabs %}
  {% tab label="REST" %}
  ```sh
  curl -X POST https://generativelanguage.googleapis.com/v1/interactions \
    -H "x-goog-api-key: $GEMINI_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "gemini-3.8-flash",
      "input": "Hello, how are you?"
    }'
  ```

  {% /tab %}

  {% tab label="Python" %}
  ```python
  from google import genai
  
  client = genai.Client()
  interaction = client.interactions.create(
      model="gemini-3.8-flash",
      input="Hello, how are you?",
  )
  print(interaction.output_text)
  ```

  {% /tab %}

  {% tab label="JavaScript" %}
  ```javascript
  import {GoogleGenAI} from '@google/genai';
  
  const ai = new GoogleGenAI({});
  const interaction = await ai.interactions.create({
    model: 'gemini-3.8-flash',
    input: 'Hello, how are you?',
  });
  console.log(interaction.output_text);
  ```

  {% /tab %}

  {% tab label="Java" %}
  ```java
  import com.google.genai.Client;
  import com.google.genai.gaos.models.interactions.CreateModelInteraction;
  import com.google.genai.gaos.models.interactions.Interaction;
  import com.google.genai.gaos.models.interactions.InteractionsInput;
  import com.google.genai.gaos.models.operations.CreateInteractionRequestBody;
  import com.google.genai.gaos.models.operations.CreateInteractionResponse;
  
  Client client = new Client();
  CreateModelInteraction params =
      CreateModelInteraction.builder()
          .model("gemini-3.8-flash")
          .input(InteractionsInput.of("Hello, how are you?"))
          .build();
  CreateInteractionResponse response =
      client.interactions.create(CreateInteractionRequestBody.of(params));
  Interaction interaction =
      response.interaction().orElseThrow(() -> new RuntimeException("No interaction returned"));
  System.out.println(interaction.outputText().orElse(""));
  ```

  {% /tab %}

  {% tab label="Go" %}
  ```go
  package main
  
  import (
      "context"
      "fmt"
      "log"
      "google.golang.org/genai"
      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)
      }
  
      body := operations.NewCreateInteractionRequestBody(gaos_interactions.CreateModelInteraction{
          Model: gaos_interactions.Model("gemini-3.8-flash"),
          Input: genai.Ptr(gaos_interactions.NewInteractionsInput("Hello, how are you?")),
      })
  
      res, err := client.Interactions.Create(ctx, operations.CreateInteractionRequest{Body: body})
      if err != nil {
          log.Fatal(err)
      }
  
      if res.Interaction != nil && res.Interaction.OutputText != nil {
          fmt.Println(*res.Interaction.OutputText)
      }
  }
  ```

  {% /tab %}

  {% /tabs %}

  {% /tab %}

  {% tab label="Multi-turn" %}
  {% tabs %}
  {% tab label="REST" %}
  ```sh
  curl -X POST https://generativelanguage.googleapis.com/v1/interactions \
    -H "x-goog-api-key: $GEMINI_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "gemini-3.8-flash",
      "input": [
        { "type": "user_input", "content": [{ "type": "text", "text": "Hello!" }] },
        { "type": "model_output", "content": [{ "type": "text", "text": "Hi there! How can I help you today?" }] },
        { "type": "user_input", "content": [{ "type": "text", "text": "What is the capital of France?" }] }
      ]
    }'
  ```

  {% /tab %}

  {% tab label="Python" %}
  ```python
  from google import genai
  
  client = genai.Client()
  response = client.interactions.create(
      model="gemini-3.8-flash",
      input=[
          {
              "type": "user_input",
              "content": [{"type": "text", "text": "Hello!"}],
          },
          {
              "type": "model_output",
              "content": [{
                  "type": "text",
                  "text": "Hi there! How can I help you today?",
              }],
          },
          {
              "type": "user_input",
              "content": [
                  {"type": "text", "text": "What is the capital of France?"}
              ],
          },
      ],
  )
  print(response.output_text)
  ```

  {% /tab %}

  {% tab label="JavaScript" %}
  ```javascript
  import {GoogleGenAI} from '@google/genai';
  
  const ai = new GoogleGenAI({});
  const interaction = await ai.interactions.create({
    model: 'gemini-3.8-flash',
    input: [
      {type: 'user_input', content: [{type: 'text', text: 'Hello'}]},
      {
        type: 'model_output',
        content: [
          {type: 'text', text: 'Hi there! How can I help you today?'},
        ],
      },
      {
        type: 'user_input',
        content: [{type: 'text', text: 'What is the capital of France?'}],
      },
    ],
  });
  console.log(interaction.output_text);
  ```

  {% /tab %}

  {% tab label="Java" %}
  ```java
  import com.google.genai.Client;
  import com.google.genai.gaos.models.interactions.CreateModelInteraction;
  import com.google.genai.gaos.models.interactions.Interaction;
  import com.google.genai.gaos.models.interactions.InteractionsInput;
  import com.google.genai.gaos.models.interactions.ModelOutputStep;
  import com.google.genai.gaos.models.interactions.Step;
  import com.google.genai.gaos.models.interactions.TextContent;
  import com.google.genai.gaos.models.interactions.UserInputStep;
  import com.google.genai.gaos.models.operations.CreateInteractionRequestBody;
  import com.google.genai.gaos.models.operations.CreateInteractionResponse;
  import java.util.List;
  
  Client client = new Client();
  List<Step> conversation =
      List.of(
          UserInputStep.builder()
              .content(List.of(TextContent.builder().text("Hello!").build()))
              .build(),
          ModelOutputStep.builder()
              .content(
                  List.of(
                      TextContent.builder().text("Hi there! How can I help you today?").build()))
              .build(),
          UserInputStep.builder()
              .content(
                  List.of(TextContent.builder().text("What is the capital of France?").build()))
              .build());
  CreateModelInteraction params =
      CreateModelInteraction.builder()
          .model("gemini-3.8-flash")
          .input(InteractionsInput.ofStep(conversation))
          .build();
  CreateInteractionResponse response =
      client.interactions.create(CreateInteractionRequestBody.of(params));
  Interaction interaction =
      response.interaction().orElseThrow(() -> new RuntimeException("No interaction returned"));
  System.out.println(interaction.outputText().orElse(""));
  ```

  {% /tab %}

  {% tab label="Go" %}
  ```go
  package main
  
  import (
      "context"
      "fmt"
      "log"
      "google.golang.org/genai"
      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)
      }
  
      history := []gaos_interactions.Step{
          gaos_interactions.NewStep(gaos_interactions.UserInputStep{
              Content: []gaos_interactions.Content{
                  gaos_interactions.NewContent(gaos_interactions.TextContent{
                      Text: "Hello!",
                  }),
              },
          }),
          gaos_interactions.NewStep(gaos_interactions.ModelOutputStep{
              Content: []gaos_interactions.Content{
                  gaos_interactions.NewContent(gaos_interactions.TextContent{
                      Text: "Hi there! How can I help you today?",
                  }),
              },
          }),
          gaos_interactions.NewStep(gaos_interactions.UserInputStep{
              Content: []gaos_interactions.Content{
                  gaos_interactions.NewContent(gaos_interactions.TextContent{
                      Text: "What is the capital of France?",
                  }),
              },
          }),
      }
  
      body := operations.NewCreateInteractionRequestBody(gaos_interactions.CreateModelInteraction{
          Model: gaos_interactions.Model("gemini-3.8-flash"),
          Input: genai.Ptr(gaos_interactions.NewInteractionsInput(history)),
      })
  
      res, err := client.Interactions.Create(ctx, operations.CreateInteractionRequest{Body: body})
      if err != nil {
          log.Fatal(err)
      }
  
      if res.Interaction != nil && res.Interaction.OutputText != nil {
          fmt.Println(*res.Interaction.OutputText)
      }
  }
  ```

  {% /tab %}

  {% /tabs %}

  {% /tab %}

  {% tab label="Image Input" %}
  {% tabs %}
  {% tab label="REST" %}
  ```sh
  curl -X POST https://generativelanguage.googleapis.com/v1/interactions \
    -H "x-goog-api-key: $GEMINI_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "gemini-3.8-flash",
      "input": [
        {
          "type": "text",
          "text": "What is in this picture?"
        },
        {
          "type": "image",
          "data": "BASE64_ENCODED_IMAGE",
          "mime_type": "image/png"
        }
      ]
    }'
  ```

  {% /tab %}

  {% tab label="Python" %}
  ```python
  from google import genai
  
  client = genai.Client()
  response = client.interactions.create(
      model="gemini-3.8-flash",
      input=[
          {"type": "text", "text": "What is in this picture?"},
          {
              "type": "image",
              "data": "BASE64_ENCODED_IMAGE",
              "mime_type": "image/png",
          },
      ],
  )
  print(response.output_text)
  ```

  {% /tab %}

  {% tab label="JavaScript" %}
  ```javascript
  import {GoogleGenAI} from '@google/genai';
  
  const ai = new GoogleGenAI({});
  const interaction = await ai.interactions.create({
    model: 'gemini-3.8-flash',
    input: [
      {type: 'text', text: 'What is in this picture?'},
      {type: 'image', data: 'BASE64_ENCODED_IMAGE', mime_type: 'image/png'},
    ],
  });
  console.log(interaction.output_text);
  ```

  {% /tab %}

  {% tab label="Java" %}
  ```java
  import com.google.genai.Client;
  import com.google.genai.gaos.models.interactions.Content;
  import com.google.genai.gaos.models.interactions.CreateModelInteraction;
  import com.google.genai.gaos.models.interactions.ImageContent;
  import com.google.genai.gaos.models.interactions.ImageContentMimeType;
  import com.google.genai.gaos.models.interactions.Interaction;
  import com.google.genai.gaos.models.interactions.InteractionsInput;
  import com.google.genai.gaos.models.interactions.TextContent;
  import com.google.genai.gaos.models.operations.CreateInteractionRequestBody;
  import com.google.genai.gaos.models.operations.CreateInteractionResponse;
  import java.util.List;
  
  Client client = new Client();
  List<Content> content =
      List.of(
          TextContent.builder().text("What is in this picture?").build(),
          ImageContent.builder()
              .data("BASE64_ENCODED_IMAGE")
              .mimeType(ImageContentMimeType.IMAGE_PNG)
              .build());
  CreateModelInteraction params =
      CreateModelInteraction.builder()
          .model("gemini-3.8-flash")
          .input(InteractionsInput.ofContent(content))
          .build();
  CreateInteractionResponse response =
      client.interactions.create(CreateInteractionRequestBody.of(params));
  Interaction interaction =
      response.interaction().orElseThrow(() -> new RuntimeException("No interaction returned"));
  System.out.println(interaction.outputText().orElse(""));
  ```

  {% /tab %}

  {% tab label="Go" %}
  ```go
  package main
  
  import (
      "context"
      "fmt"
      "log"
      "google.golang.org/genai"
      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)
      }
  
      contents := []gaos_interactions.Content{
          gaos_interactions.NewContent(gaos_interactions.TextContent{
              Text: "What is in this picture?",
          }),
          gaos_interactions.NewContent(gaos_interactions.ImageContent{
              Data:     genai.Ptr("BASE64_ENCODED_IMAGE"),
              MimeType: gaos_interactions.ImageContentMimeTypeImagePng.ToPointer(),
          }),
      }
  
      body := operations.NewCreateInteractionRequestBody(gaos_interactions.CreateModelInteraction{
          Model: gaos_interactions.Model("gemini-3.8-flash"),
          Input: genai.Ptr(gaos_interactions.NewInteractionsInput(contents)),
      })
  
      res, err := client.Interactions.Create(ctx, operations.CreateInteractionRequest{Body: body})
      if err != nil {
          log.Fatal(err)
      }
  
      if res.Interaction != nil && res.Interaction.OutputText != nil {
          fmt.Println(*res.Interaction.OutputText)
      }
  }
  ```

  {% /tab %}

  {% /tabs %}

  {% /tab %}

  {% tab label="Function Calling" %}
  {% tabs %}
  {% tab label="REST" %}
  ```sh
  curl -X POST https://generativelanguage.googleapis.com/v1/interactions \
    -H "x-goog-api-key: $GEMINI_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "gemini-3.8-flash",
      "tools": [
        {
          "type": "function",
          "name": "get_weather",
          "description": "Get the current weather in a given location",
          "parameters": {
            "type": "object",
            "properties": {
              "location": {
                "type": "string",
                "description": "The city and state, e.g. San Francisco, CA"
              }
            },
            "required": [
              "location"
            ]
          }
        }
      ],
      "input": "What is the weather like in Boston, MA?"
    }'
  ```

  {% /tab %}

  {% tab label="Python" %}
  ```python
  from google import genai
  
  client = genai.Client()
  response = client.interactions.create(
      model="gemini-3.8-flash",
      tools=[{
          "type": "function",
          "name": "get_weather",
          "description": "Get the current weather in a given location",
          "parameters": {
              "type": "object",
              "properties": {
                  "location": {
                      "type": "string",
                      "description": (
                          "The city and state, e.g. San Francisco, CA"
                      ),
                  }
              },
              "required": ["location"],
          },
      }],
      input="What is the weather like in Boston, MA?",
  )
  print(response.steps[-1])
  ```

  {% /tab %}

  {% tab label="JavaScript" %}
  ```javascript
  import {GoogleGenAI} from '@google/genai';
  
  const ai = new GoogleGenAI({});
  const interaction = await ai.interactions.create({
    model: 'gemini-3.8-flash',
    tools: [
      {
        type: 'function',
        name: 'get_weather',
        description: 'Get the current weather in a given location',
        parameters: {
          type: 'object',
          properties: {
            location: {
              type: 'string',
              description: 'The city and state, e.g. San Francisco, CA',
            },
          },
          required: ['location'],
        },
      },
    ],
    input: 'What is the weather like in Boston, MA?',
  });
  console.log(interaction.steps.at(-1));
  ```

  {% /tab %}

  {% tab label="Java" %}
  ```java
  import com.google.genai.Client;
  import com.google.genai.gaos.models.interactions.CreateModelInteraction;
  import com.google.genai.gaos.models.interactions.Function;
  import com.google.genai.gaos.models.interactions.Interaction;
  import com.google.genai.gaos.models.interactions.InteractionsInput;
  import com.google.genai.gaos.models.interactions.Step;
  import com.google.genai.gaos.models.operations.CreateInteractionRequestBody;
  import com.google.genai.gaos.models.operations.CreateInteractionResponse;
  import java.util.List;
  import java.util.Map;
  
  Client client = new Client();
  Map<String, Object> parameters =
      Map.of(
          "type", "object",
          "properties",
              Map.of(
                  "location",
                  Map.of(
                      "type", "string",
                      "description", "The city and state, e.g. San Francisco, CA")),
          "required", List.of("location"));
  Function functionTool =
      Function.builder()
          .name("get_weather")
          .description("Get the current weather in a given location")
          .parameters(parameters)
          .build();
  CreateModelInteraction params =
      CreateModelInteraction.builder()
          .model("gemini-3.8-flash")
          .tools(List.of(functionTool))
          .input(InteractionsInput.of("What is the weather like in Boston, MA?"))
          .build();
  CreateInteractionResponse response =
      client.interactions.create(CreateInteractionRequestBody.of(params));
  Interaction interaction =
      response.interaction().orElseThrow(() -> new RuntimeException("No interaction returned"));
  List<Step> steps = interaction.steps().orElse(List.of());
  if (!steps.isEmpty()) {
    System.out.println(steps.get(steps.size() - 1));
  }
  ```

  {% /tab %}

  {% tab label="Go" %}
  ```go
  package main
  
  import (
      "context"
      "fmt"
      "log"
      "google.golang.org/genai"
      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)
      }
  
      function := gaos_interactions.Function{
          Name:        genai.Ptr("get_weather"),
          Description: genai.Ptr("Get the current weather in a given location"),
          Parameters: map[string]any{
              "type": "object",
              "properties": map[string]any{
                  "location": map[string]any{
                      "type":        "string",
                      "description": "The city and state, e.g. San Francisco, CA",
                  },
              },
              "required": []string{"location"},
          },
      }
  
      tool := gaos_interactions.NewTool(function)
  
      body := operations.NewCreateInteractionRequestBody(gaos_interactions.CreateModelInteraction{
          Model: gaos_interactions.Model("gemini-3.8-flash"),
          Input: genai.Ptr(gaos_interactions.NewInteractionsInput("What is the weather like in Boston, MA?")),
          Tools: []gaos_interactions.Tool{tool},
      })
  
      res, err := client.Interactions.Create(ctx, operations.CreateInteractionRequest{Body: body})
      if err != nil {
          log.Fatal(err)
      }
  
      if res.Interaction != nil {
          for _, step := range res.Interaction.Steps {
              if step.FunctionCallStep != nil {
                  fmt.Println("Function Call:", step.FunctionCallStep.Name)
                  fmt.Println("Arguments:", step.FunctionCallStep.Arguments)
              }
          }
      }
  }
  ```

  {% /tab %}

  {% /tabs %}

  {% /tab %}

  {% tab label="Deep Research" %}
  {% tabs %}
  {% tab label="REST" %}
  ```sh
  curl -X POST https://generativelanguage.googleapis.com/v1/interactions \
    -H "x-goog-api-key: $GEMINI_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "agent": "deep-research-preview-04-2026",
      "input": "Find a cure to cancer",
      "background": true
    }'
  ```

  {% /tab %}

  {% tab label="Python" %}
  ```python
  from google import genai
  
  client = genai.Client()
  interaction = client.interactions.create(
      agent="deep-research-preview-04-2026",
      input="find a cure to cancer",
      background=True,
  )
  print(interaction.status)
  ```

  {% /tab %}

  {% tab label="JavaScript" %}
  ```javascript
  import {GoogleGenAI} from '@google/genai';
  
  const ai = new GoogleGenAI({});
  const interaction = await ai.interactions.create({
    agent: 'deep-research-preview-04-2026',
    input: 'find a cure to cancer',
    background: true,
  });
  console.log(interaction.status);
  ```

  {% /tab %}

  {% tab label="Java" %}
  ```java
  import com.google.genai.Client;
  import com.google.genai.gaos.models.interactions.AgentOption;
  import com.google.genai.gaos.models.interactions.CreateAgentInteraction;
  import com.google.genai.gaos.models.interactions.Interaction;
  import com.google.genai.gaos.models.interactions.InteractionStatus;
  import com.google.genai.gaos.models.interactions.InteractionsInput;
  import com.google.genai.gaos.models.operations.CreateInteractionRequestBody;
  import com.google.genai.gaos.models.operations.CreateInteractionResponse;
  
  Client client = new Client();
  CreateAgentInteraction params =
      CreateAgentInteraction.builder()
          .agent(AgentOption.of("deep-research-preview-04-2026"))
          .input(InteractionsInput.of("find a cure to cancer"))
          .background(true)
          .build();
  CreateInteractionResponse response =
      client.interactions.create(CreateInteractionRequestBody.of(params));
  Interaction interaction =
      response.interaction().orElseThrow(() -> new RuntimeException("No interaction returned"));
  System.out.println(interaction.status().map(InteractionStatus::value).orElse(""));
  ```

  {% /tab %}

  {% tab label="Go" %}
  ```go
  package main
  
  import (
      "context"
      "fmt"
      "log"
      "google.golang.org/genai"
      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)
      }
  
      body := operations.NewCreateInteractionRequestBody(gaos_interactions.CreateAgentInteraction{
          Agent:      gaos_interactions.AgentOption("deep-research-preview-04-2026"),
          Input:      genai.Ptr(gaos_interactions.NewInteractionsInput("find a cure to cancer")),
          Background: genai.Ptr(true),
      })
  
      req := operations.CreateInteractionRequest{
          Body: body,
      }
  
      res, err := client.Interactions.Create(ctx, req)
      if err != nil {
          log.Fatal(err)
      }
  
      if res.Interaction != nil {
          fmt.Println(res.Interaction.Status)
      }
  }
  ```

  {% /tab %}

  {% /tabs %}

  {% /tab %}

  {% tab label="Document" %}
  {% tabs %}
  {% tab label="REST" %}
  ```sh
  # Write the request to a file: inline base64 data can exceed the shell's
  # argument size limit.
  cat > request.json <<EOF
  {
    "model": "gemini-4-hydrogen",
    "input": [
      {"type": "text", "text": "Summarize this document."},
      {
        "type": "document",
        "mime_type": "application/pdf",
        "data": "$(base64 -w0 report.pdf)"
      }
    ]
  }
  EOF
  
  curl -X POST https://generativelanguage.googleapis.com/v1/interactions \
    -H "x-goog-api-key: $GEMINI_API_KEY" \
    -H "Content-Type: application/json" \
    -d @request.json
  ```

  {% /tab %}

  {% tab label="Python" %}
  ```python
  import pathlib
  from google import genai
  
  
  client = genai.Client()
  interaction = client.interactions.create(
      model="gemini-4-hydrogen",
      input=[
          {"type": "text", "text": "Summarize this document."},
          {
              "type": "document",
              "data": pathlib.Path("report.pdf"),
              "mime_type": "application/pdf",
          },
      ],
  )
  print(interaction.output_text)
  ```

  {% /tab %}

  {% tab label="JavaScript" %}
  ```javascript
  import {GoogleGenAI} from '@google/genai';
  import * as fs from 'fs';
  
  const ai = new GoogleGenAI({});
  const interaction = await ai.interactions.create({
    model: 'gemini-4-hydrogen',
    input: [
      {type: 'text', text: 'Summarize this document.'},
      {
        type: 'document',
        data: fs.readFileSync('report.pdf', 'base64'),
        mime_type: 'application/pdf',
      },
    ],
  });
  console.log(interaction.output_text);
  ```

  {% /tab %}

  {% tab label="Java" %}
  ```java
  import com.google.genai.Client;
  import com.google.genai.gaos.models.interactions.Content;
  import com.google.genai.gaos.models.interactions.CreateModelInteraction;
  import com.google.genai.gaos.models.interactions.DocumentContent;
  import com.google.genai.gaos.models.interactions.DocumentContentMimeType;
  import com.google.genai.gaos.models.interactions.Interaction;
  import com.google.genai.gaos.models.interactions.InteractionsInput;
  import com.google.genai.gaos.models.interactions.TextContent;
  import com.google.genai.gaos.models.operations.CreateInteractionRequestBody;
  import com.google.genai.gaos.models.operations.CreateInteractionResponse;
  import java.nio.file.Files;
  import java.nio.file.Path;
  import java.util.Base64;
  import java.util.List;
  
  Client client = new Client();
  Path path = Path.of("report.pdf");
  
  
  String data = Base64.getEncoder().encodeToString(Files.readAllBytes(path));
  List<Content> content =
      List.of(
          TextContent.builder().text("Summarize this document.").build(),
          DocumentContent.builder()
              .data(data)
              .mimeType(DocumentContentMimeType.APPLICATION_PDF)
              .build());
  CreateModelInteraction params =
      CreateModelInteraction.builder()
          .model("gemini-4-hydrogen")
          .input(InteractionsInput.ofContent(content))
          .build();
  CreateInteractionResponse response =
      client.interactions.create(CreateInteractionRequestBody.of(params));
  Interaction interaction =
      response.interaction().orElseThrow(() -> new RuntimeException("No interaction returned"));
  System.out.println(interaction.outputText().orElse(""));
  ```

  {% /tab %}

  {% tab label="Go" %}
  ```go
  package main
  
  import (
      "context"
      "encoding/base64"
      "fmt"
      "log"
      "os"
      "google.golang.org/genai"
      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)
      }
  
  
      data, err := os.ReadFile("report.pdf")
      if err != nil {
          log.Fatal(err)
      }
  
      contents := []gaos_interactions.Content{
          gaos_interactions.NewContent(gaos_interactions.TextContent{
              Text: "Summarize this document.",
          }),
          gaos_interactions.NewContent(gaos_interactions.DocumentContent{
              Data:     genai.Ptr(base64.StdEncoding.EncodeToString(data)),
              MimeType: gaos_interactions.DocumentContentMimeTypeApplicationPdf.ToPointer(),
          }),
      }
  
      body := operations.NewCreateInteractionRequestBody(gaos_interactions.CreateModelInteraction{
          Model: gaos_interactions.Model("gemini-4-hydrogen"),
          Input: genai.Ptr(gaos_interactions.NewInteractionsInput(contents)),
      })
  
      res, err := client.Interactions.Create(ctx, operations.CreateInteractionRequest{Body: body})
      if err != nil {
          log.Fatal(err)
      }
  
      if res.Interaction != nil && res.Interaction.OutputText != nil {
          fmt.Println(*res.Interaction.OutputText)
      }
  }
  ```

  {% /tab %}

  {% /tabs %}

  {% /tab %}

  {% /tabs %}

  {% /right-column %}

{% /two-column-layout %}

{% two-column-layout %}
  {% left-column %}
## Response  {% class="hide-from-toc" id="response" %}

  Returns [`Interaction`](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:Interaction) resources.

  When streaming, returns a stream of [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events) (`text/event-stream`) instead, each with an [`InteractionSseEvent`](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:InteractionSseEvent) as its `data`.

  {% /left-column %}

  {% right-column class="sticky" %}
  **Example response** {% class="example-heading" %}

  {% tabs %}
  {% tab label="Simple Request" %}
  ```json
  {
    "created": "2025-11-26T12:25:15Z",
    "id": "v1_ChdPU0F4YWFtNkFwS2kxZThQZ05lbXdROBIXT1NBeGFhbTZBcEtpMWU4UGdOZW13UTg",
    "model": "gemini-3.8-flash",
    "object": "interaction",
    "status": "completed",
    "steps": [
      {
        "type": "model_output",
        "content": [
          {
            "type": "text",
            "text": "Hello! I'm functioning perfectly and ready to assist you.\n\nHow are you doing today?"
          }
        ]
      }
    ],
    "updated": "2025-11-26T12:25:15Z",
    "usage": {
      "input_tokens_by_modality": [
        {
          "modality": "text",
          "tokens": 7
        }
      ],
      "total_cached_tokens": 0,
      "total_input_tokens": 7,
      "total_output_tokens": 20,
      "total_thought_tokens": 22,
      "total_tokens": 49,
      "total_tool_use_tokens": 0
    }
  }
  ```

  {% /tab %}

  {% tab label="Multi-turn" %}
  ```json
  {
    "created": "2025-11-26T12:22:47Z",
    "id": "v1_ChdPU0F4YWFtNkFwS2kxZThQZ05lbXdROBIXT1NBeGFhbTZBcEtpMWU4UGdOZW13UTg",
    "model": "gemini-3.8-flash",
    "object": "interaction",
    "status": "completed",
    "steps": [
      {
        "type": "model_output",
        "content": [
          {
            "type": "text",
            "text": "The capital of France is Paris."
          }
        ]
      }
    ],
    "updated": "2025-11-26T12:22:47Z",
    "usage": {
      "input_tokens_by_modality": [
        {
          "modality": "text",
          "tokens": 50
        }
      ],
      "total_cached_tokens": 0,
      "total_input_tokens": 50,
      "total_output_tokens": 10,
      "total_thought_tokens": 0,
      "total_tokens": 60,
      "total_tool_use_tokens": 0
    }
  }
  ```

  {% /tab %}

  {% tab label="Image Input" %}
  ```json
  {
    "created": "2025-11-26T12:22:47Z",
    "id": "v1_ChdPU0F4YWFtNkFwS2kxZThQZ05lbXdROBIXT1NBeGFhbTZBcEtpMWU4UGdOZW13UTg",
    "model": "gemini-3.8-flash",
    "object": "interaction",
    "status": "completed",
    "steps": [
      {
        "type": "model_output",
        "content": [
          {
            "type": "text",
            "text": "A white humanoid robot with glowing blue eyes stands holding a red skateboard."
          }
        ]
      }
    ],
    "updated": "2025-11-26T12:22:47Z",
    "usage": {
      "input_tokens_by_modality": [
        {
          "modality": "text",
          "tokens": 10
        },
        {
          "modality": "image",
          "tokens": 258
        }
      ],
      "total_cached_tokens": 0,
      "total_input_tokens": 268,
      "total_output_tokens": 20,
      "total_thought_tokens": 0,
      "total_tokens": 288,
      "total_tool_use_tokens": 0
    }
  }
  ```

  {% /tab %}

  {% tab label="Function Calling" %}
  ```json
  {
    "created": "2025-11-26T12:22:47Z",
    "id": "v1_ChdPU0F4YWFtNkFwS2kxZThQZ05lbXdROBIXT1NBeGFhbTZBcEtpMWU4UGdOZW13UTg",
    "model": "gemini-3.8-flash",
    "object": "interaction",
    "status": "requires_action",
    "steps": [
      {
        "name": "get_weather",
        "type": "function_call",
        "arguments": {
          "location": "Boston, MA"
        },
        "id": "gth23981"
      }
    ],
    "updated": "2025-11-26T12:22:47Z",
    "usage": {
      "input_tokens_by_modality": [
        {
          "modality": "text",
          "tokens": 100
        }
      ],
      "total_cached_tokens": 0,
      "total_input_tokens": 100,
      "total_output_tokens": 25,
      "total_thought_tokens": 0,
      "total_tokens": 125,
      "total_tool_use_tokens": 50
    }
  }
  ```

  {% /tab %}

  {% /tabs %}

  {% /right-column %}

{% /two-column-layout %}

## Resources  {% class="hide-from-toc" id="resources" %}

### Interaction  {% class="hide-from-toc" id="Resource:Interaction" %}

The Interaction resource.

{% two-column-layout %}
  {% left-column %}
  **Properties:**

  {% section class="api-ref-property-list" %}
  **id**: {% mark %}required{% /mark %} `string`

  Output only. A unique identifier for the interaction completion.

  {% hr /%}

  {% details %}
  {% summary %}
  **status**: {% mark %}required{% /mark %} `string enum`

  Output only. The status of the interaction.

  {% /summary %}

  Possible values:

  - `in_progress`: The interaction is in progress.
  - `requires_action`: The interaction requires action/input from the user.
  - `completed`: The interaction is completed.
  - `failed`: The interaction failed.
  - `cancelled`: The interaction was cancelled.
  - `incomplete`: The interaction is completed, but contains incomplete results (e.g. hitting max_tokens).
  - `requires_continuation`: The interaction requires at least one more request for it to be completed. The next request should set the continuation_token to the one returned by this request.

  {% /details %}

  {% hr /%}

  **created**: {% mark %}required{% /mark %} `string`

  Output only. The time at which the response was created in ISO 8601 format (YYYY-MM-DDThh:mm:ssZ).

  {% hr /%}

  **updated**: {% mark %}required{% /mark %} `string`

  Output only. The time at which the response was last updated in ISO 8601 format (YYYY-MM-DDThh:mm:ssZ).

  {% hr /%}

  **steps**: {% mark %}required{% /mark %} [`Step`](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:Step) `array`

  Output only. The steps that make up the interaction, when included in the response.

  {% hr /%}

  {% details %}
  {% summary %}
  **model**: `ModelOption`

  The name of the `Model` used for generating the interaction.

  {% /summary %}

  Possible values:

  - `gemma-4-26b-a4b-it`: Gemma 4 26B A4B IT
  - `gemma-4-31b-it`: Gemma 4 31B IT
  - `gemini-2.5-flash`: Our first hybrid reasoning model which supports a 1M token context window and has thinking budgets.
  - `gemini-2.5-pro`: Our state-of-the-art multipurpose model, which excels at coding and complex reasoning tasks.
  - `gemini-2.5-flash-lite`: Our smallest and most cost effective model, built for at scale usage.
  - `gemini-3.5-flash-lite`: Gemini 3.5 Flash-Lite - Our fastest, most cost-effective 3.5 model for high-throughput execution.
  - `gemini-2.5-flash-image`: Our native image generation model, optimized for speed, flexibility, and contextual understanding. Text input and output is priced the same as 2.5 Flash.
  - `gemini-3.1-flash-lite`: Our most cost-efficient model, optimized for high-volume agentic tasks, translation, and simple data processing.
  - `gemini-3.1-flash-lite-image`: Gemini 3.1 Flash Lite Image.
  - `gemini-3-pro-image`: Gemini 3 Pro Image
  - `gemini-3.1-flash-image`: Gemini 3.1 Flash Image.
  - `gemini-nano-banana-2.1`: Gemini Nano Banana 2.1.
  - `gemini-3.5-flash`: Gemini 3.5 Flash - Our earlier Flash model, built for speed and foundational performance across routine, high-throughput workloads.
  - `gemini-3.6-flash`: Gemini 3.6 Flash - Our previous generation Flash model, balancing speed and multimodal capabilities across general agentic and everyday tasks.
  - `gemini-3.7-flash`: Gemini 3.7 Flash - Our high-speed, efficient Flash model built for everyday coding, agentic tool use, and reliable multi-step execution.
  - `gemini-3.8-flash`: Gemini 3.8 Flash - Our most intelligent Flash model, engineered for long-horizon software engineering, autonomous agents, and complex enterprise workflows.
  - `gemini-4-argon`: Gemini 4 Argon - Our new frontier model, built to solve the hardest problems with depth and precision across real-world software engineering and knowledge work.
  - `gemini-4-carbon`: Gemini 4 Carbon - Our most capable reasoning model, built for sustained agentic coding, multimodal knowledge work, scientific discovery, and cybersecurity defense.
  - `gemini-4-hydrogen`: Gemini 4 Hydrogen - A model with frontier-level intelligence, built for fast, dependable execution across coding, agentic workflows, and multimodal knowledge work.
  - `gemini-4-neon`: Gemini 4 Neon - Frontier-level intelligence with fast end-to-end task completion across complex software engineering, analytical, and science workflows.

  {% /details %}

  {% hr /%}

  {% details %}
  {% summary %}
  **generation_config**: `GenerationConfig`

  Input only. Configuration parameters for the model interaction.

  {% /summary %}

  **seed**: `integer`

  Seed used in decoding for reproducibility.

  **stop_sequences**: `string array`

  A list of character sequences that will stop output interaction.

  {% details %}
  {% summary %}
  **tool_choice**: [`ToolChoiceConfig`](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:ToolChoiceConfig) or `string enum`

  The tool choice configuration.

  {% /summary %}

  **Possible Types:** {% class="api-ref-label" %}

  {% details %}
  {% summary %}
  **[ToolChoiceConfig](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:ToolChoiceConfig)**

  {% /summary %}

  The tool choice configuration containing allowed tools.

  {% details %}
  {% summary %}
  **allowed_tools**: `AllowedTools`

  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 %}
  **string enum**

  {% /summary %}

  Possible values:

  - `auto`: Auto tool choice.
  - `any`: Any tool choice.
  - `none`: No tool choice.
  - `validated`: Validated tool choice.

  {% /details %}

  {% /details %}

  {% details %}
  {% summary %}
  **thinking_level**: `ThinkingLevel`

  The level of thought tokens that the model should generate.

  {% /summary %}

  Possible values:

  - `minimal`: Little to no thinking.
  - `low`: Low thinking level.
  - `medium`: Medium thinking level.
  - `high`: High thinking level.
  - `xhigh`: Extra high thinking level, above `high`.

  {% /details %}

  {% details %}
  {% summary %}
  **thinking_summaries**: `ThinkingSummaries`

  Whether to include thought summaries in the response.

  {% /summary %}

  Possible values:

  - `auto`: Auto thinking summaries.
  - `none`: No thinking summaries.

  {% /details %}

  **max_output_tokens**: `integer`

  The maximum number of tokens to include in the response.

  {% details %}
  {% summary %}
  **video_config**: `VideoConfig`

  Configuration for video generation.

  {% /summary %}

  {% details %}
  {% summary %}
  **task**: `string enum`

  Optional task mode for video generation. If not specified, the model automatically determines the appropriate mode based on the provided text prompt and input media.

  {% /summary %}

  Possible values:

  - `text_to_video`: Generates video solely from a text prompt.
  - `image_to_video`: Generates video from one or two source images. The first image defines the starting frame, and the optional second image defines the ending frame.
  - `reference_to_video`: Generates video using reference media (such as images, audio, or video).
  - `edit`: Modifies an existing input video.
  - `extend`: Extends an existing input video.

  {% /details %}

  {% /details %}

  {% /details %}

  {% hr /%}

  **system_instruction**: `string`

  System instruction for the interaction.

  {% hr /%}

  **tools**: [`Tool`](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:Tool) `array`

  A list of tool declarations the model may call during interaction.

  {% hr /%}

  **input**: [`Content`](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:Content) or [`Content`](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:Content) `array` or [`Step`](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:Step) `array` or `string`

  The input for the interaction.

  {% hr /%}

  {% details %}
  {% summary %}
  **usage**: `Usage`

  Output only. Statistics on the interaction request's token usage.

  {% /summary %}

  **total_input_tokens**: `integer`

  Number of tokens in the prompt (context).

  **initial_input_tokens**: `integer`

  Number of input tokens used in the first turn of this interaction.

  {% details %}
  {% summary %}
  **input_tokens_by_modality**: `ModalityTokens array`

  A breakdown of input token usage by modality.

  {% /summary %}

  {% details %}
  {% summary %}
  **modality**: `ResponseModality`

  The modality associated with the token count.

  {% /summary %}

  Possible values:

  - `text`: Indicates the model should return text.
  - `image`: Indicates the model should return images.
  - `audio`: Indicates the model should return audio.
  - `video`: Indicates the model should return video.
  - `document`: Indicates the model should return documents.

  {% /details %}

  **tokens**: `integer`

  Number of tokens for the modality.

  {% /details %}

  **total_cached_tokens**: `integer`

  Number of tokens in the cached part of the prompt (the cached content).

  {% details %}
  {% summary %}
  **cached_tokens_by_modality**: `ModalityTokens array`

  A breakdown of cached token usage by modality.

  {% /summary %}

  {% details %}
  {% summary %}
  **modality**: `ResponseModality`

  The modality associated with the token count.

  {% /summary %}

  Possible values:

  - `text`: Indicates the model should return text.
  - `image`: Indicates the model should return images.
  - `audio`: Indicates the model should return audio.
  - `video`: Indicates the model should return video.
  - `document`: Indicates the model should return documents.

  {% /details %}

  **tokens**: `integer`

  Number of tokens for the modality.

  {% /details %}

  **total_output_tokens**: `integer`

  Total number of tokens across all the generated responses.

  {% details %}
  {% summary %}
  **output_tokens_by_modality**: `ModalityTokens array`

  A breakdown of output token usage by modality.

  {% /summary %}

  {% details %}
  {% summary %}
  **modality**: `ResponseModality`

  The modality associated with the token count.

  {% /summary %}

  Possible values:

  - `text`: Indicates the model should return text.
  - `image`: Indicates the model should return images.
  - `audio`: Indicates the model should return audio.
  - `video`: Indicates the model should return video.
  - `document`: Indicates the model should return documents.

  {% /details %}

  **tokens**: `integer`

  Number of tokens for the modality.

  {% /details %}

  **total_tool_use_tokens**: `integer`

  Number of tokens present in tool-use prompt(s).

  {% details %}
  {% summary %}
  **tool_use_tokens_by_modality**: `ModalityTokens array`

  A breakdown of tool-use token usage by modality.

  {% /summary %}

  {% details %}
  {% summary %}
  **modality**: `ResponseModality`

  The modality associated with the token count.

  {% /summary %}

  Possible values:

  - `text`: Indicates the model should return text.
  - `image`: Indicates the model should return images.
  - `audio`: Indicates the model should return audio.
  - `video`: Indicates the model should return video.
  - `document`: Indicates the model should return documents.

  {% /details %}

  **tokens**: `integer`

  Number of tokens for the modality.

  {% /details %}

  **total_thought_tokens**: `integer`

  Number of tokens of thoughts for thinking models.

  **total_tokens**: `integer`

  Total token count for the interaction request (prompt + responses + other internal tokens).

  {% details %}
  {% summary %}
  **grounding_tool_count**: `GroundingToolCount array`

  Grounding tool count.

  {% /summary %}

  {% details %}
  {% summary %}
  **type**: `string enum`

  The grounding tool type associated with the count.

  {% /summary %}

  Possible values:

  - `google_search`: Grounding with Google Web Search and Image Search, & Web Grounding for Enterprise.
  - `google_maps`: Grounding with Google Maps.

  {% /details %}

  **count**: `integer`

  The number of grounding tool counts.

  {% /details %}

  {% /details %}

  {% hr /%}

  {% details %}
  {% summary %}
  **response_format**: [`ResponseFormat`](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:ResponseFormat) or [`ResponseFormat`](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:ResponseFormat) `array`

  Enforces that the generated response is a JSON object that complies with the JSON schema specified in this field.

  {% /summary %}

  **Possible Types:** {% class="api-ref-label" %}

  {% details %}
  {% summary %}
  **[ResponseFormat](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:ResponseFormat)**

  {% /summary %}

  {% /details %}

  {% details %}
  {% summary %}
  **[ResponseFormat](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:ResponseFormat) array**

  {% /summary %}

  A list where each item is one of: `AudioResponseFormat`, `ImageResponseFormat`, `TextResponseFormat`, `VideoResponseFormat`.

  {% /details %}

  {% /details %}

  {% hr /%}

  **previous_interaction_id**: `string`

  The ID of the previous interaction, if any.

  {% hr /%}

  {% details %}
  {% summary %}
  **service_tier**: `ServiceTier`

  The service tier for the interaction.

  {% /summary %}

  Possible values:

  - `flex`: Flex service tier.
  - `standard`: Standard service tier.
  - `priority`: Priority service tier.

  {% /details %}

  {% hr /%}

  {% details %}
  {% summary %}
  **safety_settings**: `SafetySetting array`

  Safety settings for the interaction.

  {% /summary %}

  {% details %}
  {% summary %}
  **type**: {% mark %}required{% /mark %} `HarmCategory`

  The type of harm category to be blocked.

  {% /summary %}

  Possible values:

  - `hate_speech`: Content that promotes violence or incites hatred against individuals or groups based on certain attributes.
  - `dangerous_content`: Content that promotes, facilitates, or enables dangerous activities.
  - `harassment`: Abusive, threatening, or content intended to bully, torment, or ridicule.
  - `sexually_explicit`: Content that contains sexually explicit material.
  - `jailbreak`: Prompts designed to bypass safety filters.

  {% /details %}

  {% details %}
  {% summary %}
  **threshold**: {% mark %}required{% /mark %} `string enum`

  The threshold for blocking content. If the harm probability exceeds this threshold, the content will be blocked.

  {% /summary %}

  Possible values:

  - `block_low_and_above`: Block content with a low harm probability or higher.
  - `block_medium_and_above`: Block content with a medium harm probability or higher.
  - `block_only_high`: Block content with a high harm probability.
  - `off`: Turn off the safety filter entirely.

  {% /details %}

  {% details %}
  {% summary %}
  **method**: `string enum`

  Optional. The method for blocking content. If not specified, the default behavior is to use the probability score.

  {% /summary %}

  Possible values:

  - `severity`: The harm block method uses both probability and severity scores.
  - `probability`: The harm block method uses the probability score.

  {% /details %}

  {% /details %}

  {% hr /%}

  {% details %}
  {% summary %}
  **errors**: `Error array`

  Output only. Diagnostic faults / platform errors recorded on the interaction.

  {% /summary %}

  **code**: `string`

  A URI that identifies the error type.

  **message**: `string`

  A human-readable error message.

  {% /details %}

  {% hr /%}

  **continuation_token**: `string`

  Opaque token to resume a long decode. Output: set when status is REQUIRES_CONTINUATION and decoding can be resumed. Input: pass the latest token back unchanged when creating the next interaction to continue decoding.

  {% hr /%}

  **stream**: `boolean`

  Input only. Whether the interaction will be streamed.

  {% hr /%}

  **store**: `boolean`

  Input only. Whether to store the response and request for later retrieval.

  {% hr /%}

  **background**: `boolean`

  Input only. Whether to run the model interaction in the background.

  {% hr /%}

  {% details %}
  {% summary %}
  **agent**: `AgentOption`

  The name of the `Agent` used for generating the interaction.

  {% /summary %}

  Possible values:

  - `deep-research-preview-04-2026`: Gemini Deep Research Agent
  - `deep-research-max-preview-04-2026`: Gemini Deep Research Max Agent
  - `antigravity-preview-05-2026`: Use the Antigravity managed agent to perform multi-step tasks that require reasoning, file operations, and tool use.
  - `antigravity-preview-09-2026`: Use the Antigravity managed agent to perform multi-step tasks that require reasoning, file operations, and tool use.

  {% /details %}

  {% hr /%}

  {% details %}
  {% summary %}
  **agent_config**: `DynamicAgentConfig`

  Configuration parameters for the agent interaction.

  {% /summary %}

  **type**: {% mark %}required{% /mark %} `object`

  Value: `dynamic`

  {% /details %}

  {% hr /%}

  **max_total_tokens**: `string`

  Max total tokens for the agent run.

  {% /section %}

  {% /left-column %}

  {% right-column class="sticky" %}
  **Example**

  ```json
  {
    "created": "2025-12-04T15:01:45Z",
    "id": "v1_ChdXS0l4YWZXTk9xbk0xZThQczhEcmlROBIXV0tJeGFmV05PcW5NMWU4UHM4RHJpUTg",
    "model": "gemini-3.8-flash",
    "object": "interaction",
    "status": "completed",
    "steps": [
      {
        "type": "model_output",
        "content": [
          {
            "type": "text",
            "text": "Hello! I'm doing well, functioning as expected. Thank you for asking! How are you doing today?"
          }
        ]
      }
    ],
    "updated": "2025-12-04T15:01:45Z",
    "usage": {
      "input_tokens_by_modality": [
        {
          "modality": "text",
          "tokens": 7
        }
      ],
      "total_cached_tokens": 0,
      "total_input_tokens": 7,
      "total_output_tokens": 23,
      "total_thought_tokens": 49,
      "total_tokens": 79,
      "total_tool_use_tokens": 0
    }
  }
  ```

  {% /right-column %}

{% /two-column-layout %}

## Data Models  {% class="hide-from-toc" id="data-models" %}

### Content  {% class="hide-from-toc" id="Resource:Content" %}

The content of the response.

**Polymorphic Types:**

{% details %}
  {% summary %}
  **[AudioContent](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:AudioContent)**

  {% /summary %}

  An audio content block.

  {% two-column-layout %}
  {% left-column %}
  {% section class="api-ref-property-list" %}
  **type**: {% mark %}required{% /mark %} `object`

  Value: `audio`

  {% hr /%}

  **data**: `string`

  The audio content.

  {% hr /%}

  **uri**: `string`

  The URI of the audio.

  {% hr /%}

  **channels**: `integer`

  The number of audio channels.

  {% hr /%}

  **sample_rate**: `integer`

  The sample rate of the audio.

  {% hr /%}

  {% details %}
  {% summary %}
  **processing**: `AudioMediaProcessing` or `string enum`

  How the model processes this audio for understanding.

  {% /summary %}

  **Possible Types:** {% class="api-ref-label" %}

  {% details %}
  {% summary %}
  **AudioMediaProcessing**

  {% /summary %}

  **type**: {% mark %}required{% /mark %} `object`

  Value: `static`

  **start_offset**: `string`

  Optional. Segment start time, relative to the start of the audio stream. Specified as a decimal number of seconds followed by an 's' suffix, e.g., "10.5s". Must be non-negative.

  **end_offset**: `string`

  Optional. Segment end time, relative to the start of the audio stream. Specified as a decimal number of seconds followed by an 's' suffix, e.g., "30s". Must be positive and greater than `start_offset` if `start_offset` is set.

  {% /details %}

  {% details %}
  {% summary %}
  **string enum**

  {% /summary %}

  Possible values:

  - `static`: All audio placed in context.

  {% /details %}

  {% /details %}

  {% hr /%}

  {% details %}
  {% summary %}
  **mime_type**: `string enum`

  The mime type of the audio.

  {% /summary %}

  Possible values:

  - `audio/wav`: WAV audio format
  - `audio/mp3`: MP3 audio format
  - `audio/aiff`: AIFF audio format
  - `audio/aac`: AAC audio format
  - `audio/ogg`: OGG audio format
  - `audio/flac`: FLAC audio format
  - `audio/mpeg`: MPEG audio format
  - `audio/m4a`: M4A audio format
  - `audio/l16`: L16 audio format
  - `audio/opus`: OPUS audio format
  - `audio/alaw`: ALAW audio format
  - `audio/mulaw`: MULAW audio format
  - `audio/webm`: WEBM audio format

  {% /details %}

  {% /section %}

  {% /left-column %}

  {% right-column class="sticky" %}
  **Example**

  **Audio**

  ```json
  {
    "type": "audio",
    "data": "BASE64_ENCODED_AUDIO",
    "mime_type": "audio/wav"
  }
  ```

  {% /right-column %}

  {% /two-column-layout %}

{% /details %}

{% details %}
  {% summary %}
  **[DocumentContent](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:DocumentContent)**

  {% /summary %}

  A document content block.

  {% two-column-layout %}
  {% left-column %}
  {% section class="api-ref-property-list" %}
  **type**: {% mark %}required{% /mark %} `object`

  Value: `document`

  {% hr /%}

  **data**: `string`

  The document content.

  {% hr /%}

  **uri**: `string`

  The URI of the document.

  {% hr /%}

  {% details %}
  {% summary %}
  **resolution**: `MediaResolution`

  The resolution of the media. Applicable when PAGE_IMAGE is selected in content_layers.

  {% /summary %}

  Possible values:

  - `low`: Low resolution.
  - `medium`: Medium resolution.
  - `high`: High resolution.
  - `ultra_high`: Ultra high resolution.

  {% /details %}

  {% hr /%}

  {% details %}
  {% summary %}
  **processing**: `DocumentMediaProcessing` or `string enum`

  How the model processes this document for understanding.

  {% /summary %}

  **Possible Types:** {% class="api-ref-label" %}

  {% details %}
  {% summary %}
  **DocumentMediaProcessing**

  {% /summary %}

  **type**: {% mark %}required{% /mark %} `object`

  Value: `static`

  {% details %}
  {% summary %}
  **page_options**: `PageProcessingOptions`

  Options for paginated documents. Only valid for paginated document MIME types (e.g. PDF, Office documents, and presentations).

  {% /summary %}

  **start_page**: `integer`

  Optional. 1-indexed start page, inclusive.

  **end_page**: `integer`

  Optional. 1-indexed end page, inclusive. Must be >= `start_page` if `start_page` is set.

  {% details %}
  {% summary %}
  **content_layers**: `string enum array`

  Optional. Content layers to extract from a paginated document.

  {% /summary %}

  Possible values:

  - `page_image`: A rendered image of the page.
  - `page_text`: The text of the page.

  {% /details %}

  {% /details %}

  {% details %}
  {% summary %}
  **spreadsheet_options**: `SpreadsheetProcessingOptions`

  Options for spreadsheets. Only valid for spreadsheet MIME types (.xlsx, .xls, .ods).

  {% /summary %}

  **visible_cells**: `string`

  Optional. The range of cells to extract, in A1 notation (e.g. "A1:D10"). If not set, the full occupied area of the sheet is used.

  **sheet_index**: `integer`

  Optional. The 1-indexed index of the sheet to extract, in workbook order. If not set, all sheets are extracted.

  {% details %}
  {% summary %}
  **content_layers**: `string enum array`

  Optional. Content layers to extract from a spreadsheet.

  {% /summary %}

  Possible values:

  - `visual`: A rendered image of the sheet.
  - `data`: Cell values, merges, and formats.
  - `formulas`: Formula expressions and their computed results.

  {% /details %}

  {% /details %}

  {% /details %}

  {% details %}
  {% summary %}
  **string enum**

  {% /summary %}

  Possible values:

  - `static`: All extracted pages placed in context.

  {% /details %}

  {% /details %}

  {% hr /%}

  {% details %}
  {% summary %}
  **mime_type**: `string enum`

  The mime type of the document.

  {% /summary %}

  Possible values:

  - `application/pdf`: PDF document format
  - `text/csv`: CSV document format
  - `application/vnd.openxmlformats-officedocument.presentationml.presentation`: PPTX presentation format
  - `application/vnd.ms-powerpoint`: PPT presentation format
  - `application/vnd.oasis.opendocument.presentation`: ODP presentation format
  - `application/vnd.openxmlformats-officedocument.wordprocessingml.document`: DOCX document format
  - `application/msword`: DOC document format
  - `application/vnd.openxmlformats-officedocument.wordprocessingml.template`: DOTX document template format
  - `application/vnd.oasis.opendocument.text`: ODT document format
  - `application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`: XLSX spreadsheet format
  - `application/vnd.ms-excel`: XLS spreadsheet format
  - `application/vnd.oasis.opendocument.spreadsheet`: ODS spreadsheet format

  {% /details %}

  {% /section %}

  {% /left-column %}

  {% right-column class="sticky" %}
  **Example**

  **Document**

  ```json
  {
    "type": "document",
    "data": "BASE64_ENCODED_DOCUMENT",
    "mime_type": "application/pdf"
  }
  ```

  {% /right-column %}

  {% /two-column-layout %}

{% /details %}

{% details %}
  {% summary %}
  **[ImageContent](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:ImageContent)**

  {% /summary %}

  An image content block.

  {% two-column-layout %}
  {% left-column %}
  {% section class="api-ref-property-list" %}
  **type**: {% mark %}required{% /mark %} `object`

  Value: `image`

  {% hr /%}

  **data**: `string`

  The image content.

  {% hr /%}

  **uri**: `string`

  The URI of the image.

  {% hr /%}

  {% details %}
  {% summary %}
  **resolution**: `MediaResolution`

  The resolution of the media.

  {% /summary %}

  Possible values:

  - `low`: Low resolution.
  - `medium`: Medium resolution.
  - `high`: High resolution.
  - `ultra_high`: Ultra high resolution.

  {% /details %}

  {% hr /%}

  {% details %}
  {% summary %}
  **mime_type**: `string enum`

  The mime type of the image.

  {% /summary %}

  Possible values:

  - `image/png`: PNG image format
  - `image/jpeg`: JPEG image format
  - `image/webp`: WebP image format
  - `image/heic`: HEIC image format
  - `image/heif`: HEIF image format
  - `image/gif`: GIF image format
  - `image/bmp`: BMP image format
  - `image/tiff`: TIFF image format

  {% /details %}

  {% /section %}

  {% /left-column %}

  {% right-column class="sticky" %}
  **Example**

  **Image**

  ```json
  {
    "type": "image",
    "data": "BASE64_ENCODED_IMAGE",
    "mime_type": "image/png"
  }
  ```

  {% /right-column %}

  {% /two-column-layout %}

{% /details %}

{% details %}
  {% summary %}
  **[TextContent](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:TextContent)**

  {% /summary %}

  A text content block.

  {% two-column-layout %}
  {% left-column %}
  {% section class="api-ref-property-list" %}
  **text**: {% mark %}required{% /mark %} `string`

  The text content.

  {% hr /%}

  **type**: {% mark %}required{% /mark %} `object`

  Value: `text`

  {% hr /%}

  {% details %}
  {% summary %}
  **annotations**: `Annotation array`

  Citation information for model-generated content.

  {% /summary %}

  **Possible Types:** {% class="api-ref-label" %}

  {% details %}
  {% summary %}
  **FileCitation**

  {% /summary %}

  A file citation annotation.

  **type**: {% mark %}required{% /mark %} `object`

  Value: `file_citation`

  **document_uri**: `string`

  The URI of the file.

  **file_name**: `string`

  The name of the file.

  **source**: `string`

  Source attributed for a portion of the text.

  **custom_metadata**: `object`

  User provided metadata about the retrieved context.

  **page_number**: `integer`

  Page number of the cited document, if applicable.

  **media_id**: `string`

  Media ID in-case of image citations, if applicable.

  **start_index**: `integer`

  Start of segment of the response that is attributed to this source. Index indicates the start of the segment, measured in bytes.

  **end_index**: `integer`

  End of the attributed segment, exclusive.

  {% /details %}

  {% details %}
  {% summary %}
  **PlaceCitation**

  {% /summary %}

  A place citation annotation.

  **type**: {% mark %}required{% /mark %} `object`

  Value: `place_citation`

  **place_id**: `string`

  The ID of the place, in `places/{place_id}` format.

  **name**: `string`

  Title of the place.

  **url**: `string`

  URI reference of the place.

  {% details %}
  {% summary %}
  **review_snippets**: `ReviewSnippet array`

  Snippets of reviews that are used to generate answers about the features of a given place in Google Maps.

  {% /summary %}

  **title**: `string`

  Title of the review.

  **url**: `string`

  A link that corresponds to the user review on Google Maps.

  **review_id**: `string`

  The ID of the review snippet.

  {% /details %}

  **start_index**: `integer`

  Start of segment of the response that is attributed to this source. Index indicates the start of the segment, measured in bytes.

  **end_index**: `integer`

  End of the attributed segment, exclusive.

  {% /details %}

  {% details %}
  {% summary %}
  **UrlCitation**

  {% /summary %}

  A URL citation annotation.

  **type**: {% mark %}required{% /mark %} `object`

  Value: `url_citation`

  **url**: `string`

  The URL.

  **title**: `string`

  The title of the URL.

  **start_index**: `integer`

  Start of segment of the response that is attributed to this source. Index indicates the start of the segment, measured in bytes.

  **end_index**: `integer`

  End of the attributed segment, exclusive.

  {% /details %}

  {% /details %}

  {% /section %}

  {% /left-column %}

  {% right-column class="sticky" %}
  **Example**

  **Text**

  ```json
  {
    "type": "text",
    "text": "Hello, how are you?"
  }
  ```

  {% /right-column %}

  {% /two-column-layout %}

{% /details %}

{% details %}
  {% summary %}
  **[VideoContent](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:VideoContent)**

  {% /summary %}

  A video content block.

  {% section class="api-ref-property-list" %}
  **type**: {% mark %}required{% /mark %} `object`

  Value: `video`

  {% hr /%}

  **data**: `string`

  The video content.

  {% hr /%}

  **uri**: `string`

  The URI of the video.

  {% hr /%}

  {% details %}
  {% summary %}
  **resolution**: `MediaResolution`

  The resolution of the media.

  {% /summary %}

  Possible values:

  - `low`: Low resolution.
  - `medium`: Medium resolution.
  - `high`: High resolution.
  - `ultra_high`: Ultra high resolution.

  {% /details %}

  {% hr /%}

  {% details %}
  {% summary %}
  **processing**: `MediaProcessing` or `string enum`

  How the model processes this video for understanding.

  {% /summary %}

  **Possible Types:** {% class="api-ref-label" %}

  {% details %}
  {% summary %}
  **MediaProcessing**

  {% /summary %}

  **type**: {% mark %}required{% /mark %} `object`

  Value: `static`

  **start_offset**: `string`

  Optional. Segment start time. Specified as a decimal number of seconds followed by an 's' suffix, e.g., "10.5s". Must be non-negative.

  **end_offset**: `string`

  Optional. Segment end time. Specified as a decimal number of seconds followed by an 's' suffix, e.g., "30s". Must be non-negative and greater than `start_offset` if `start_offset` is set.

  **fps**: `number`

  Optional. Video frame-rate sampling density.

  {% details %}
  {% summary %}
  **content_layers**: `string enum array`

  Optional. Content layers to extract from the video.

  {% /summary %}

  Possible values:

  - `frames`: Frames of the video.
  - `audio`: Audio of the video.
  - `transcript`: Transcript of the audio track.

  {% /details %}

  {% /details %}

  {% details %}
  {% summary %}
  **string enum**

  {% /summary %}

  Possible values:

  - `static`: Fixed-rate frame extraction. All frames placed in context.
  - `agentic`: Model-driven dynamic navigation.

  {% /details %}

  {% /details %}

  {% hr /%}

  **name**: `string`

  A user-defined name for this content block. Can be referenced by the model in the final response.

  {% hr /%}

  {% details %}
  {% summary %}
  **mime_type**: `string enum`

  The mime type of the video.

  {% /summary %}

  Possible values:

  - `video/mp4`: MP4 video format
  - `video/mpeg`: MPEG video format
  - `video/mpg`: MPG video format
  - `video/mov`: MOV video format
  - `video/avi`: AVI video format
  - `video/x-flv`: FLV video format
  - `video/webm`: WebM video format
  - `video/wmv`: WMV video format
  - `video/3gpp`: 3GPP video format
  - `video/jpeg2000`: JPEG 2000 video format

  {% /details %}

  {% /section %}

{% /details %}

### Tool  {% class="hide-from-toc" id="Resource:Tool" %}

A tool that can be used by the model.

**Polymorphic Types:**

{% details %}
  {% summary %}
  **CodeExecution**

  {% /summary %}

  A tool that can be used by the model to execute code.

  {% two-column-layout %}
  {% left-column %}
  {% section class="api-ref-property-list" %}
  **type**: {% mark %}required{% /mark %} `object`

  Value: `code_execution`

  {% /section %}

  {% /left-column %}

  {% right-column class="sticky" %}
  **Example**

  {% tabs %}
  {% tab label="REST" %}
  ```sh
  curl -X POST https://generativelanguage.googleapis.com/v1/interactions \
    -H "x-goog-api-key: $GEMINI_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "gemini-3.8-flash",
      "tools": [{
        "type": "code_execution"
      }],
      "input": "Calculate the first 10 Fibonacci numbers"
    }'
  ```

  {% /tab %}

  {% tab label="Python" %}
  ```python
  from google import genai
  
  client = genai.Client()
  response = client.interactions.create(
      model="gemini-3.8-flash",
      tools=[{"type": "code_execution"}],
      input="Calculate the first 10 Fibonacci numbers",
  )
  print(response.output_text)
  ```

  {% /tab %}

  {% tab label="JavaScript" %}
  ```javascript
  import {GoogleGenAI} from '@google/genai';
  
  const ai = new GoogleGenAI({});
  const interaction = await ai.interactions.create({
    model: 'gemini-3.8-flash',
    tools: [{type: 'code_execution'}],
    input: 'Calculate the first 10 Fibonacci numbers',
  });
  console.log(interaction.output_text);
  ```

  {% /tab %}

  {% tab label="Java" %}
  ```java
  import com.google.genai.Client;
  import com.google.genai.gaos.models.interactions.CodeExecution;
  import com.google.genai.gaos.models.interactions.CreateModelInteraction;
  import com.google.genai.gaos.models.interactions.Interaction;
  import com.google.genai.gaos.models.interactions.InteractionsInput;
  import com.google.genai.gaos.models.operations.CreateInteractionRequestBody;
  import com.google.genai.gaos.models.operations.CreateInteractionResponse;
  import java.util.List;
  
  Client client = new Client();
  CreateModelInteraction params =
      CreateModelInteraction.builder()
          .model("gemini-3.8-flash")
          .tools(List.of(new CodeExecution()))
          .input(InteractionsInput.of("Calculate the first 10 Fibonacci numbers"))
          .build();
  CreateInteractionResponse response =
      client.interactions.create(CreateInteractionRequestBody.of(params));
  Interaction interaction =
      response.interaction().orElseThrow(() -> new RuntimeException("No interaction returned"));
  System.out.println(interaction.outputText().orElse(""));
  ```

  {% /tab %}

  {% tab label="Go" %}
  ```go
  package main
  
  import (
      "context"
      "fmt"
      "log"
      "google.golang.org/genai"
      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)
      }
  
      tool := gaos_interactions.NewTool(gaos_interactions.CodeExecution{})
  
      body := operations.NewCreateInteractionRequestBody(gaos_interactions.CreateModelInteraction{
          Model: gaos_interactions.Model("gemini-3.8-flash"),
          Input: genai.Ptr(gaos_interactions.NewInteractionsInput("Calculate the first 10 Fibonacci numbers")),
          Tools: []gaos_interactions.Tool{tool},
      })
  
      req := operations.CreateInteractionRequest{
          Body: body,
      }
  
      res, err := client.Interactions.Create(ctx, req)
      if err != nil {
          log.Fatal(err)
      }
  
      if res.Interaction != nil && res.Interaction.OutputText != nil {
          fmt.Println(*res.Interaction.OutputText)
      }
  }
  ```

  {% /tab %}

  {% /tabs %}

  {% /right-column %}

  {% /two-column-layout %}

{% /details %}

{% details %}
  {% summary %}
  **ComputerUse**

  {% /summary %}

  A tool that can be used by the model to interact with the computer.

  {% two-column-layout %}
  {% left-column %}
  {% section class="api-ref-property-list" %}
  **type**: {% mark %}required{% /mark %} `object`

  Value: `computer_use`

  {% hr /%}

  {% details %}
  {% summary %}
  **environment**: `string enum`

  The environment being operated.

  {% /summary %}

  Possible values:

  - `browser`: Operates in a web browser.
  - `mobile`: Operates in a mobile environment.
  - `desktop`: Operates in a desktop environment.

  {% /details %}

  {% hr /%}

  **excluded_predefined_functions**: `string array`

  The list of predefined functions that are excluded from the model call.

  {% hr /%}

  **enable_prompt_injection_detection**: `boolean`

  Whether enable the prompt injection detection check on computer-use request.

  {% hr /%}

  {% details %}
  {% summary %}
  **disabled_safety_policies**: `string enum array`

  Optional. Disabled safety policies for computer use.

  {% /summary %}

  Possible values:

  - `financial_transactions`: Safety policy for financial transactions.
  - `sensitive_data_modification`: Safety policy for sensitive data modification.
  - `communication_tool`: Safety policy for communication tools (e.g. Gmail, Chat, Meet).
  - `account_creation`: Safety policy for account creation.
  - `data_modification`: Safety policy for data modification.
  - `user_consent_management`: Safety policy for user consent management.
  - `legal_terms_and_agreements`: Safety policy for legal terms and agreements.

  {% /details %}

  {% /section %}

  {% /left-column %}

  {% right-column class="sticky" %}
  **Example**

  {% tabs %}
  {% tab label="REST" %}
  ```sh
  curl -X POST https://generativelanguage.googleapis.com/v1/interactions \
    -H "x-goog-api-key: $GEMINI_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "gemini-3.8-flash",
      "tools": [{
        "type": "computer_use"
      }],
      "input": "Find a flight to Tokyo"
    }'
  ```

  {% /tab %}

  {% tab label="Python" %}
  ```python
  from google import genai
  
  client = genai.Client()
  response = client.interactions.create(
      model="gemini-3.8-flash",
      tools=[{"type": "computer_use"}],
      input="Find a flight to Tokyo",
  )
  print(response.output_text)
  ```

  {% /tab %}

  {% tab label="JavaScript" %}
  ```javascript
  import {GoogleGenAI} from '@google/genai';
  
  const ai = new GoogleGenAI({});
  const interaction = await ai.interactions.create({
    model: 'gemini-3.8-flash',
    tools: [{type: 'computer_use'}],
    input: 'Find a flight to Tokyo',
  });
  console.log(interaction.output_text);
  ```

  {% /tab %}

  {% tab label="Java" %}
  ```java
  import com.google.genai.Client;
  import com.google.genai.gaos.models.interactions.ComputerUse;
  import com.google.genai.gaos.models.interactions.CreateModelInteraction;
  import com.google.genai.gaos.models.interactions.Interaction;
  import com.google.genai.gaos.models.interactions.InteractionsInput;
  import com.google.genai.gaos.models.operations.CreateInteractionRequestBody;
  import com.google.genai.gaos.models.operations.CreateInteractionResponse;
  import java.util.List;
  
  Client client = new Client();
  CreateModelInteraction params =
      CreateModelInteraction.builder()
          .model("gemini-3.8-flash")
          .tools(List.of(new ComputerUse()))
          .input(InteractionsInput.of("Find a flight to Tokyo"))
          .build();
  CreateInteractionResponse response =
      client.interactions.create(CreateInteractionRequestBody.of(params));
  Interaction interaction =
      response.interaction().orElseThrow(() -> new RuntimeException("No interaction returned"));
  System.out.println(interaction.outputText().orElse(""));
  ```

  {% /tab %}

  {% tab label="Go" %}
  ```go
  package main
  
  import (
      "context"
      "fmt"
      "log"
      "google.golang.org/genai"
      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)
      }
  
      tool := gaos_interactions.NewTool(gaos_interactions.ComputerUse{})
  
      body := operations.NewCreateInteractionRequestBody(gaos_interactions.CreateModelInteraction{
          Model: gaos_interactions.Model("gemini-3.8-flash"),
          Input: genai.Ptr(gaos_interactions.NewInteractionsInput("Find a flight to Tokyo")),
          Tools: []gaos_interactions.Tool{tool},
      })
  
      req := operations.CreateInteractionRequest{
          Body: body,
      }
  
      res, err := client.Interactions.Create(ctx, req)
      if err != nil {
          log.Fatal(err)
      }
  
      if res.Interaction != nil && res.Interaction.OutputText != nil {
          fmt.Println(*res.Interaction.OutputText)
      }
  }
  ```

  {% /tab %}

  {% /tabs %}

  {% /right-column %}

  {% /two-column-layout %}

{% /details %}

{% details %}
  {% summary %}
  **FileSearch**

  {% /summary %}

  A tool that can be used by the model to search files.

  {% two-column-layout %}
  {% left-column %}
  {% section class="api-ref-property-list" %}
  **type**: {% mark %}required{% /mark %} `object`

  Value: `file_search`

  {% hr /%}

  **file_search_store_names**: `string array`

  The file search store names to search.

  {% hr /%}

  **top_k**: `integer`

  The number of semantic retrieval chunks to retrieve.

  {% hr /%}

  **metadata_filter**: `string`

  Metadata filter to apply to the semantic retrieval documents and chunks.

  {% /section %}

  {% /left-column %}

  {% right-column class="sticky" %}
  **Example**

  {% tabs %}
  {% tab label="REST" %}
  ```sh
  curl -X POST https://generativelanguage.googleapis.com/v1/interactions \
    -H "x-goog-api-key: $GEMINI_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "gemini-3.8-flash",
      "tools": [{
        "type": "file_search",
        "file_search_store_names": ["fileSearchStores/m64d1sevsr4y-xfyawui3fxqg"]
      }],
      "input": "Who is the author of the book?"
    }'
  ```

  {% /tab %}

  {% tab label="Python" %}
  ```python
  from google import genai
  
  client = genai.Client()
  
  # Create a file search store so we have a valid one to use.
  store = client.file_search_stores.create()
  
  response = client.interactions.create(
      model="gemini-3.8-flash",
      tools=[
          {"type": "file_search", "file_search_store_names": [store.name]}
      ],
      input="What documents are available?",
  )
  print(response.output_text)
  ```

  {% /tab %}

  {% tab label="JavaScript" %}
  ```javascript
  import {GoogleGenAI} from '@google/genai';
  
  const ai = new GoogleGenAI({});
  
  // Create a file search store so we have a valid one to use.
  const store = await ai.fileSearchStores.create({});
  if (!store.name) {
    throw new Error('Store creation failed: Name is undefined');
  }
  
  const interaction = await ai.interactions.create({
    model: 'gemini-3.8-flash',
    tools: [
      {
        type: 'file_search',
        file_search_store_names: [store.name],
      },
    ],
    input: 'What documents are available?',
  });
  console.log(interaction.output_text);
  ```

  {% /tab %}

  {% tab label="Java" %}
  ```java
  import com.google.genai.Client;
  import com.google.genai.gaos.models.interactions.CreateModelInteraction;
  import com.google.genai.gaos.models.interactions.FileSearch;
  import com.google.genai.gaos.models.interactions.Interaction;
  import com.google.genai.gaos.models.interactions.InteractionsInput;
  import com.google.genai.gaos.models.operations.CreateInteractionRequestBody;
  import com.google.genai.gaos.models.operations.CreateInteractionResponse;
  import com.google.genai.types.CreateFileSearchStoreConfig;
  import com.google.genai.types.FileSearchStore;
  import java.util.List;
  
  Client client = new Client();
  
  // Create a file search store so we have a valid one to use.
  FileSearchStore store =
      client.fileSearchStores.create(CreateFileSearchStoreConfig.builder().build());
  String storeName = store.name().orElseThrow();
  
  FileSearch tool = FileSearch.builder().fileSearchStoreNames(List.of(storeName)).build();
  CreateModelInteraction params =
      CreateModelInteraction.builder()
          .model("gemini-3.8-flash")
          .tools(List.of(tool))
          .input(InteractionsInput.of("What documents are available?"))
          .build();
  CreateInteractionResponse response =
      client.interactions.create(CreateInteractionRequestBody.of(params));
  Interaction interaction =
      response.interaction().orElseThrow(() -> new RuntimeException("No interaction returned"));
  System.out.println(interaction.outputText().orElse(""));
  ```

  {% /tab %}

  {% tab label="Go" %}
  ```go
  package main
  
  import (
      "context"
      "fmt"
      "log"
      "google.golang.org/genai"
      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)
      }
  
  
      tool := gaos_interactions.NewTool(gaos_interactions.FileSearch{
          FileSearchStoreNames: []string{store.Name},
      })
  
      body := operations.NewCreateInteractionRequestBody(gaos_interactions.CreateModelInteraction{
          Model: gaos_interactions.Model("gemini-3.8-flash"),
          Input: genai.Ptr(gaos_interactions.NewInteractionsInput("What documents are available?")),
          Tools: []gaos_interactions.Tool{tool},
      })
  
      req := operations.CreateInteractionRequest{
          Body: body,
      }
  
      res, err := client.Interactions.Create(ctx, req)
      if err != nil {
          log.Fatal(err)
      }
  
      if res.Interaction != nil && res.Interaction.OutputText != nil {
          fmt.Println(*res.Interaction.OutputText)
      }
  }
  ```

  {% /tab %}

  {% /tabs %}

  {% /right-column %}

  {% /two-column-layout %}

{% /details %}

{% details %}
  {% summary %}
  **[Function](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:Function)**

  {% /summary %}

  A tool that can be used by the model.

  {% two-column-layout %}
  {% left-column %}
  {% section class="api-ref-property-list" %}
  **type**: {% mark %}required{% /mark %} `object`

  Value: `function`

  {% hr /%}

  **name**: `string`

  The name of the function.

  {% hr /%}

  **description**: `string`

  A description of the function.

  {% hr /%}

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

  {% /section %}

  {% /left-column %}

  {% right-column class="sticky" %}
  **Example**

  {% tabs %}
  {% tab label="REST" %}
  ```sh
  curl -X POST https://generativelanguage.googleapis.com/v1/interactions \
    -H "x-goog-api-key: $GEMINI_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "gemini-3.8-flash",
      "tools": [{
        "type": "function",
        "name": "get_weather",
        "description": "Get the current weather in a given location",
        "parameters": {
          "type": "object",
          "properties": {
            "location": {
              "type": "string",
              "description": "The city and state, e.g. San Francisco, CA"
            }
          },
          "required": ["location"]
        }
      }],
      "input": "What is the weather like in Boston, MA?"
    }'
  ```

  {% /tab %}

  {% tab label="Python" %}
  ```python
  from google import genai
  
  client = genai.Client()
  response = client.interactions.create(
      model="gemini-3.8-flash",
      tools=[{
          "type": "function",
          "name": "get_weather",
          "description": "Get the current weather in a given location",
          "parameters": {
              "type": "object",
              "properties": {
                  "location": {
                      "type": "string",
                      "description": (
                          "The city and state, e.g. San Francisco, CA"
                      ),
                  }
              },
              "required": ["location"],
          },
      }],
      input="What is the weather like in Boston?",
  )
  print(response.steps[-1])
  ```

  {% /tab %}

  {% tab label="JavaScript" %}
  ```javascript
  import {GoogleGenAI} from '@google/genai';
  
  const ai = new GoogleGenAI({});
  const interaction = await ai.interactions.create({
    model: 'gemini-3.8-flash',
    tools: [
      {
        type: 'function',
        name: 'get_weather',
        description: 'Get the current weather in a given location',
        parameters: {
          type: 'object',
          properties: {
            location: {
              type: 'string',
              description: 'The city and state, e.g. San Francisco, CA',
            },
          },
          required: ['location'],
        },
      },
    ],
    input: 'What is the weather like in Boston?',
  });
  console.log(interaction.steps.at(-1));
  ```

  {% /tab %}

  {% tab label="Java" %}
  ```java
  import com.google.genai.Client;
  import com.google.genai.gaos.models.interactions.CreateModelInteraction;
  import com.google.genai.gaos.models.interactions.Function;
  import com.google.genai.gaos.models.interactions.Interaction;
  import com.google.genai.gaos.models.interactions.InteractionsInput;
  import com.google.genai.gaos.models.interactions.Step;
  import com.google.genai.gaos.models.operations.CreateInteractionRequestBody;
  import com.google.genai.gaos.models.operations.CreateInteractionResponse;
  import java.util.List;
  import java.util.Map;
  
  Client client = new Client();
  Map<String, Object> parameters =
      Map.of(
          "type", "object",
          "properties",
              Map.of(
                  "location",
                  Map.of(
                      "type", "string",
                      "description", "The city and state, e.g. San Francisco, CA")),
          "required", List.of("location"));
  Function functionTool =
      Function.builder()
          .name("get_weather")
          .description("Get the current weather in a given location")
          .parameters(parameters)
          .build();
  CreateModelInteraction params =
      CreateModelInteraction.builder()
          .model("gemini-3.8-flash")
          .tools(List.of(functionTool))
          .input(InteractionsInput.of("What is the weather like in Boston?"))
          .build();
  CreateInteractionResponse response =
      client.interactions.create(CreateInteractionRequestBody.of(params));
  Interaction interaction =
      response.interaction().orElseThrow(() -> new RuntimeException("No interaction returned"));
  List<Step> steps = interaction.steps().orElse(List.of());
  if (!steps.isEmpty()) {
    System.out.println(steps.get(steps.size() - 1));
  }
  ```

  {% /tab %}

  {% tab label="Go" %}
  ```go
  package main
  
  import (
      "context"
      "fmt"
      "log"
      "google.golang.org/genai"
      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)
      }
  
      function := gaos_interactions.Function{
          Name:        genai.Ptr("get_weather"),
          Description: genai.Ptr("Get the current weather in a given location"),
          Parameters: map[string]any{
              "type": "object",
              "properties": map[string]any{
                  "location": map[string]any{
                      "type":        "string",
                      "description": "The city and state, e.g. San Francisco, CA",
                  },
              },
              "required": []string{"location"},
          },
      }
  
      tool := gaos_interactions.NewTool(function)
  
      body := operations.NewCreateInteractionRequestBody(gaos_interactions.CreateModelInteraction{
          Model: gaos_interactions.Model("gemini-3.8-flash"),
          Input: genai.Ptr(gaos_interactions.NewInteractionsInput("What is the weather like in Boston, MA?")),
          Tools: []gaos_interactions.Tool{tool},
      })
  
      req := operations.CreateInteractionRequest{
          Body: body,
      }
  
      res, err := client.Interactions.Create(ctx, req)
      if err != nil {
          log.Fatal(err)
      }
  
      if res.Interaction != nil {
          for _, step := range res.Interaction.Steps {
              if step.FunctionCallStep != nil {
                  fmt.Println("Function Call:", step.FunctionCallStep.Name)
                  fmt.Println("Arguments:", step.FunctionCallStep.Arguments)
              }
          }
      }
  }
  ```

  {% /tab %}

  {% /tabs %}

  {% /right-column %}

  {% /two-column-layout %}

{% /details %}

{% details %}
  {% summary %}
  **GoogleMaps**

  {% /summary %}

  A tool that can be used by the model to call Google Maps.

  {% two-column-layout %}
  {% left-column %}
  {% section class="api-ref-property-list" %}
  **type**: {% mark %}required{% /mark %} `object`

  Value: `google_maps`

  {% hr /%}

  **enable_widget**: `boolean`

  Whether to return a widget context token in the tool call result of the response.

  {% hr /%}

  **latitude**: `number`

  The latitude of the user's location.

  {% hr /%}

  **longitude**: `number`

  The longitude of the user's location.

  {% /section %}

  {% /left-column %}

  {% right-column class="sticky" %}
  **Example**

  {% tabs %}
  {% tab label="REST" %}
  ```sh
  curl -X POST https://generativelanguage.googleapis.com/v1/interactions \
    -H "x-goog-api-key: $GEMINI_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "gemini-3.8-flash",
      "tools": [{
        "type": "google_maps",
        "latitude": 37.7749,
        "longitude": -122.4194
      }],
      "input": "What is the best food near me?"
    }'
  ```

  {% /tab %}

  {% tab label="Python" %}
  ```python
  from google import genai
  
  client = genai.Client()
  response = client.interactions.create(
      model="gemini-3.8-flash",
      tools=[
          {"type": "google_maps", "latitude": 37.7749, "longitude": -122.4194}
      ],
      input="What is the best food near me?",
  )
  print(response.output_text)
  ```

  {% /tab %}

  {% tab label="JavaScript" %}
  ```javascript
  import {GoogleGenAI} from '@google/genai';
  
  const ai = new GoogleGenAI({});
  const interaction = await ai.interactions.create({
    model: 'gemini-3.8-flash',
    tools: [
      {
        type: 'google_maps',
        latitude: 37.7749,
        longitude: -122.4194,
      },
    ],
    input: 'What is the best food near me?',
  });
  console.log(interaction.output_text);
  ```

  {% /tab %}

  {% tab label="Java" %}
  ```java
  import com.google.genai.Client;
  import com.google.genai.gaos.models.interactions.CreateModelInteraction;
  import com.google.genai.gaos.models.interactions.GoogleMaps;
  import com.google.genai.gaos.models.interactions.Interaction;
  import com.google.genai.gaos.models.interactions.InteractionsInput;
  import com.google.genai.gaos.models.operations.CreateInteractionRequestBody;
  import com.google.genai.gaos.models.operations.CreateInteractionResponse;
  import java.util.List;
  
  Client client = new Client();
  GoogleMaps tool = GoogleMaps.builder().latitude(37.7749).longitude(-122.4194).build();
  CreateModelInteraction params =
      CreateModelInteraction.builder()
          .model("gemini-3.8-flash")
          .tools(List.of(tool))
          .input(InteractionsInput.of("What is the best food near me?"))
          .build();
  CreateInteractionResponse response =
      client.interactions.create(CreateInteractionRequestBody.of(params));
  Interaction interaction =
      response.interaction().orElseThrow(() -> new RuntimeException("No interaction returned"));
  System.out.println(interaction.outputText().orElse(""));
  ```

  {% /tab %}

  {% tab label="Go" %}
  ```go
  package main
  
  import (
      "context"
      "fmt"
      "log"
      "google.golang.org/genai"
      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)
      }
  
      tool := gaos_interactions.NewTool(gaos_interactions.GoogleMaps{
          Latitude:  genai.Ptr(37.7749),
          Longitude: genai.Ptr(-122.4194),
      })
  
      body := operations.NewCreateInteractionRequestBody(gaos_interactions.CreateModelInteraction{
          Model: gaos_interactions.Model("gemini-3.8-flash"),
          Input: genai.Ptr(gaos_interactions.NewInteractionsInput("What is the best food near me?")),
          Tools: []gaos_interactions.Tool{tool},
      })
  
      req := operations.CreateInteractionRequest{
          Body: body,
      }
  
      res, err := client.Interactions.Create(ctx, req)
      if err != nil {
          log.Fatal(err)
      }
  
      if res.Interaction != nil && res.Interaction.OutputText != nil {
          fmt.Println(*res.Interaction.OutputText)
      }
  }
  ```

  {% /tab %}

  {% /tabs %}

  {% /right-column %}

  {% /two-column-layout %}

{% /details %}

{% details %}
  {% summary %}
  **GoogleSearch**

  {% /summary %}

  A tool that can be used by the model to search Google.

  {% two-column-layout %}
  {% left-column %}
  {% section class="api-ref-property-list" %}
  **type**: {% mark %}required{% /mark %} `object`

  Value: `google_search`

  {% hr /%}

  {% 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 %}

  {% /section %}

  {% /left-column %}

  {% right-column class="sticky" %}
  **Example**

  {% tabs %}
  {% tab label="REST" %}
  ```sh
  curl -X POST https://generativelanguage.googleapis.com/v1/interactions \
    -H "x-goog-api-key: $GEMINI_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "gemini-3.8-flash",
      "tools": [{
        "type": "google_search"
      }],
      "input": "Who is the current president of France?"
    }'
  ```

  {% /tab %}

  {% tab label="Python" %}
  ```python
  from google import genai
  
  client = genai.Client()
  response = client.interactions.create(
      model="gemini-3.8-flash",
      tools=[{"type": "google_search"}],
      input="Who is the current president of France?",
  )
  print(response.output_text)
  ```

  {% /tab %}

  {% tab label="JavaScript" %}
  ```javascript
  import {GoogleGenAI} from '@google/genai';
  
  const ai = new GoogleGenAI({});
  const interaction = await ai.interactions.create({
    model: 'gemini-3.8-flash',
    tools: [{type: 'google_search'}],
    input: 'Who is the current president of France?',
  });
  console.log(interaction.output_text);
  ```

  {% /tab %}

  {% tab label="Java" %}
  ```java
  import com.google.genai.Client;
  import com.google.genai.gaos.models.interactions.CreateModelInteraction;
  import com.google.genai.gaos.models.interactions.GoogleSearch;
  import com.google.genai.gaos.models.interactions.Interaction;
  import com.google.genai.gaos.models.interactions.InteractionsInput;
  import com.google.genai.gaos.models.operations.CreateInteractionRequestBody;
  import com.google.genai.gaos.models.operations.CreateInteractionResponse;
  import java.util.List;
  
  Client client = new Client();
  CreateModelInteraction params =
      CreateModelInteraction.builder()
          .model("gemini-3.8-flash")
          .tools(List.of(new GoogleSearch()))
          .input(InteractionsInput.of("Who is the current president of France?"))
          .build();
  CreateInteractionResponse response =
      client.interactions.create(CreateInteractionRequestBody.of(params));
  Interaction interaction =
      response.interaction().orElseThrow(() -> new RuntimeException("No interaction returned"));
  System.out.println(interaction.outputText().orElse(""));
  ```

  {% /tab %}

  {% tab label="Go" %}
  ```go
  package main
  
  import (
      "context"
      "fmt"
      "log"
      "google.golang.org/genai"
      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)
      }
  
      tool := gaos_interactions.NewTool(gaos_interactions.GoogleSearch{})
  
      body := operations.NewCreateInteractionRequestBody(gaos_interactions.CreateModelInteraction{
          Model: gaos_interactions.Model("gemini-3.8-flash"),
          Input: genai.Ptr(gaos_interactions.NewInteractionsInput("Who is the current president of France?")),
          Tools: []gaos_interactions.Tool{tool},
      })
  
      req := operations.CreateInteractionRequest{
          Body: body,
      }
  
      res, err := client.Interactions.Create(ctx, req)
      if err != nil {
          log.Fatal(err)
      }
  
      if res.Interaction != nil && res.Interaction.OutputText != nil {
          fmt.Println(*res.Interaction.OutputText)
      }
  }
  ```

  {% /tab %}

  {% /tabs %}

  {% /right-column %}

  {% /two-column-layout %}

{% /details %}

{% details %}
  {% summary %}
  **McpServer**

  {% /summary %}

  A MCPServer is a server that can be called by the model to perform actions.

  {% two-column-layout %}
  {% left-column %}
  {% section class="api-ref-property-list" %}
  **type**: {% mark %}required{% /mark %} `object`

  Value: `mcp_server`

  {% hr /%}

  **name**: `string`

  The name of the MCPServer.

  {% hr /%}

  **url**: `string`

  The full URL for the MCPServer endpoint. Example: "https://api.example.com/mcp"

  {% hr /%}

  **headers**: `object`

  Optional: Fields for authentication headers, timeouts, etc., if needed.

  {% hr /%}

  {% 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 %}

  {% /section %}

  {% /left-column %}

  {% right-column class="sticky" %}
  **Example**

  {% tabs %}
  {% tab label="REST" %}
  ```sh
  curl -X POST https://generativelanguage.googleapis.com/v1/interactions \
    -H "x-goog-api-key: $GEMINI_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "gemini-3.8-flash",
      "tools": [{
        "type": "mcp_server",
        "name": "weather_service",
        "url": "https://gemini-api-demos.uc.r.appspot.com/mcp"
      }],
      "input": "Today is 12-05-2025, what is the temperature today in London?"
    }'
  ```

  {% /tab %}

  {% tab label="Python" %}
  ```python
  import os
  
  from google import genai
  
  client = genai.Client()
  response = client.interactions.create(
      model="gemini-3.8-flash",
      tools=[{
          "type": "mcp_server",
          "name": "weather_service",
          "url": "https://gemini-api-demos.uc.r.appspot.com/mcp",
      }],
      input="Today is 12-05-2025, what is the temperature today in London?",
  )
  print(response.output_text)
  ```

  {% /tab %}

  {% tab label="JavaScript" %}
  ```javascript
  import {GoogleGenAI} from '@google/genai';
  
  const ai = new GoogleGenAI({});
  const interaction = await ai.interactions.create({
    model: 'gemini-3.8-flash',
    tools: [
      {
        type: 'mcp_server',
        name: 'weather_service',
        url: 'https://gemini-api-demos.uc.r.appspot.com/mcp',
      },
    ],
    input: 'Today is 12-05-2025, what is the temperature today in London?',
  });
  console.log(interaction.output_text);
  ```

  {% /tab %}

  {% tab label="Java" %}
  ```java
  import com.google.genai.Client;
  import com.google.genai.gaos.models.interactions.CreateModelInteraction;
  import com.google.genai.gaos.models.interactions.Interaction;
  import com.google.genai.gaos.models.interactions.InteractionsInput;
  import com.google.genai.gaos.models.interactions.MCPServer;
  import com.google.genai.gaos.models.operations.CreateInteractionRequestBody;
  import com.google.genai.gaos.models.operations.CreateInteractionResponse;
  import java.util.List;
  
  Client client = new Client();
  MCPServer mcpTool =
      MCPServer.builder()
          .name("weather_service")
          .url("https://gemini-api-demos.uc.r.appspot.com/mcp")
          .build();
  CreateModelInteraction params =
      CreateModelInteraction.builder()
          .model("gemini-3.8-flash")
          .tools(List.of(mcpTool))
          .input(
              InteractionsInput.of(
                  "Today is 12-05-2025, what is the temperature today in London?"))
          .build();
  CreateInteractionResponse response =
      client.interactions.create(CreateInteractionRequestBody.of(params));
  Interaction interaction =
      response.interaction().orElseThrow(() -> new RuntimeException("No interaction returned"));
  System.out.println(interaction.outputText().orElse(""));
  ```

  {% /tab %}

  {% tab label="Go" %}
  ```go
  package main
  
  import (
      "context"
      "fmt"
      "log"
      "os"
      "google.golang.org/genai"
      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)
      }
  
      mcpServer := gaos_interactions.MCPServer{
          Name: genai.Ptr("weather_service"),
          URL:  genai.Ptr("https://gemini-api-demos.uc.r.appspot.com/mcp"),
      }
      tool := gaos_interactions.NewTool(mcpServer)
  
      body := operations.NewCreateInteractionRequestBody(gaos_interactions.CreateModelInteraction{
          Model: gaos_interactions.Model("gemini-3.8-flash"),
          Input: genai.Ptr(gaos_interactions.NewInteractionsInput("Today is 12-05-2025, what is the temperature today in London?")),
          Tools: []gaos_interactions.Tool{tool},
      })
  
      req := operations.CreateInteractionRequest{
          Body: body,
      }
  
      res, err := client.Interactions.Create(ctx, req)
      if err != nil {
          log.Fatal(err)
      }
  
      if res.Interaction != nil && res.Interaction.OutputText != nil {
          fmt.Println(*res.Interaction.OutputText)
      }
  }
  ```

  {% /tab %}

  {% /tabs %}

  {% /right-column %}

  {% /two-column-layout %}

{% /details %}

{% details %}
  {% summary %}
  **UrlContext**

  {% /summary %}

  A tool that can be used by the model to fetch URL context.

  {% two-column-layout %}
  {% left-column %}
  {% section class="api-ref-property-list" %}
  **type**: {% mark %}required{% /mark %} `object`

  Value: `url_context`

  {% /section %}

  {% /left-column %}

  {% right-column class="sticky" %}
  **Example**

  {% tabs %}
  {% tab label="REST" %}
  ```sh
  curl -X POST https://generativelanguage.googleapis.com/v1/interactions \
    -H "x-goog-api-key: $GEMINI_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "gemini-3.8-flash",
      "tools": [{
        "type": "url_context"
      }],
      "input": "Summarize https://www.example.com"
    }'
  ```

  {% /tab %}

  {% tab label="Python" %}
  ```python
  from google import genai
  
  client = genai.Client()
  response = client.interactions.create(
      model="gemini-3.8-flash",
      tools=[{"type": "url_context"}],
      input="Summarize https://www.example.com",
  )
  print(response.output_text)
  ```

  {% /tab %}

  {% tab label="JavaScript" %}
  ```javascript
  import {GoogleGenAI} from '@google/genai';
  
  const ai = new GoogleGenAI({});
  const interaction = await ai.interactions.create({
    model: 'gemini-3.8-flash',
    tools: [{type: 'url_context'}],
    input: 'Summarize https://www.example.com',
  });
  console.log(interaction.output_text);
  ```

  {% /tab %}

  {% tab label="Java" %}
  ```java
  import com.google.genai.Client;
  import com.google.genai.gaos.models.interactions.CreateModelInteraction;
  import com.google.genai.gaos.models.interactions.Interaction;
  import com.google.genai.gaos.models.interactions.InteractionsInput;
  import com.google.genai.gaos.models.interactions.URLContext;
  import com.google.genai.gaos.models.operations.CreateInteractionRequestBody;
  import com.google.genai.gaos.models.operations.CreateInteractionResponse;
  import java.util.List;
  
  Client client = new Client();
  CreateModelInteraction params =
      CreateModelInteraction.builder()
          .model("gemini-3.8-flash")
          .tools(List.of(new URLContext()))
          .input(InteractionsInput.of("Summarize https://www.example.com"))
          .build();
  CreateInteractionResponse response =
      client.interactions.create(CreateInteractionRequestBody.of(params));
  Interaction interaction =
      response.interaction().orElseThrow(() -> new RuntimeException("No interaction returned"));
  System.out.println(interaction.outputText().orElse(""));
  ```

  {% /tab %}

  {% tab label="Go" %}
  ```go
  package main
  
  import (
      "context"
      "fmt"
      "log"
      "google.golang.org/genai"
      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)
      }
  
      tool := gaos_interactions.NewTool(gaos_interactions.URLContext{})
  
      body := operations.NewCreateInteractionRequestBody(gaos_interactions.CreateModelInteraction{
          Model: gaos_interactions.Model("gemini-3.8-flash"),
          Input: genai.Ptr(gaos_interactions.NewInteractionsInput("Summarize https://www.example.com")),
          Tools: []gaos_interactions.Tool{tool},
      })
  
      req := operations.CreateInteractionRequest{
          Body: body,
      }
  
      res, err := client.Interactions.Create(ctx, req)
      if err != nil {
          log.Fatal(err)
      }
  
      if res.Interaction != nil && res.Interaction.OutputText != nil {
          fmt.Println(*res.Interaction.OutputText)
      }
  }
  ```

  {% /tab %}

  {% /tabs %}

  {% /right-column %}

  {% /two-column-layout %}

{% /details %}

### InteractionSseEvent  {% class="hide-from-toc" id="Resource:InteractionSseEvent" %}

**Polymorphic Types:**

{% details %}
  {% summary %}
  **ErrorEvent**

  {% /summary %}

  {% two-column-layout %}
  {% left-column %}
  {% section class="api-ref-property-list" %}
  **event_type**: {% mark %}required{% /mark %} `object`

  Value: `error`

  {% hr /%}

  {% details %}
  {% summary %}
  **error**: `Error`

  {% /summary %}

  **code**: `string`

  A URI that identifies the error type.

  **message**: `string`

  A human-readable error message.

  {% /details %}

  {% hr /%}

  **event_id**: `string`

  The event_id token to be used to resume the interaction stream, from this event.

  {% /section %}

  {% /left-column %}

  {% right-column class="sticky" %}
  **Example**

  **Error Event**

  ```json
  {
    "error": {
      "code": "not_found",
      "message": "Failed to get completed interaction: Result not found."
    },
    "event_type": "error"
  }
  ```

  {% /right-column %}

  {% /two-column-layout %}

{% /details %}

{% details %}
  {% summary %}
  **InteractionCompletedEvent**

  {% /summary %}

  Signals that the Interaction completed. Sent when the Interaction receives
  Complete/Cancel or naturally terminates. No more input can be sent to the
  Interaction after this.

  {% two-column-layout %}
  {% left-column %}
  {% section class="api-ref-property-list" %}
  {% details %}
  {% summary %}
  **interaction**: {% mark %}required{% /mark %} `InteractionSseEventInteraction`

  Partial completed interaction resource emitted at the end of the stream.

  {% /summary %}

  **id**: {% mark %}required{% /mark %} `string`

  Output only. A unique identifier for the interaction completion.

  {% details %}
  {% summary %}
  **status**: {% mark %}required{% /mark %} `string enum`

  Output only. The status of the interaction.

  {% /summary %}

  Possible values:

  - `in_progress`: The interaction is in progress.
  - `requires_action`: The interaction requires action/input from the user.
  - `completed`: The interaction is completed.
  - `failed`: The interaction failed.
  - `cancelled`: The interaction was cancelled.
  - `incomplete`: The interaction is completed, but contains incomplete results (e.g. hitting max_tokens).
  - `requires_continuation`: The interaction requires at least one more request for it to be completed. The next request should set the continuation_token to the one returned by this request.

  {% /details %}

  **model**: `string`

  The model that will complete your prompt.

  **created**: `string`

  Output only. The time at which the response was created in ISO 8601 format.

  **updated**: `string`

  Output only. The time at which the response was last updated in ISO 8601 format.

  {% details %}
  {% summary %}
  **usage**: `Usage`

  Output only. Statistics on the interaction request's token usage.

  {% /summary %}

  **total_input_tokens**: `integer`

  Number of tokens in the prompt (context).

  **initial_input_tokens**: `integer`

  Number of input tokens used in the first turn of this interaction.

  {% details %}
  {% summary %}
  **input_tokens_by_modality**: `ModalityTokens array`

  A breakdown of input token usage by modality.

  {% /summary %}

  {% details %}
  {% summary %}
  **modality**: `ResponseModality`

  The modality associated with the token count.

  {% /summary %}

  Possible values:

  - `text`: Indicates the model should return text.
  - `image`: Indicates the model should return images.
  - `audio`: Indicates the model should return audio.
  - `video`: Indicates the model should return video.
  - `document`: Indicates the model should return documents.

  {% /details %}

  **tokens**: `integer`

  Number of tokens for the modality.

  {% /details %}

  **total_cached_tokens**: `integer`

  Number of tokens in the cached part of the prompt (the cached content).

  {% details %}
  {% summary %}
  **cached_tokens_by_modality**: `ModalityTokens array`

  A breakdown of cached token usage by modality.

  {% /summary %}

  {% details %}
  {% summary %}
  **modality**: `ResponseModality`

  The modality associated with the token count.

  {% /summary %}

  Possible values:

  - `text`: Indicates the model should return text.
  - `image`: Indicates the model should return images.
  - `audio`: Indicates the model should return audio.
  - `video`: Indicates the model should return video.
  - `document`: Indicates the model should return documents.

  {% /details %}

  **tokens**: `integer`

  Number of tokens for the modality.

  {% /details %}

  **total_output_tokens**: `integer`

  Total number of tokens across all the generated responses.

  {% details %}
  {% summary %}
  **output_tokens_by_modality**: `ModalityTokens array`

  A breakdown of output token usage by modality.

  {% /summary %}

  {% details %}
  {% summary %}
  **modality**: `ResponseModality`

  The modality associated with the token count.

  {% /summary %}

  Possible values:

  - `text`: Indicates the model should return text.
  - `image`: Indicates the model should return images.
  - `audio`: Indicates the model should return audio.
  - `video`: Indicates the model should return video.
  - `document`: Indicates the model should return documents.

  {% /details %}

  **tokens**: `integer`

  Number of tokens for the modality.

  {% /details %}

  **total_tool_use_tokens**: `integer`

  Number of tokens present in tool-use prompt(s).

  {% details %}
  {% summary %}
  **tool_use_tokens_by_modality**: `ModalityTokens array`

  A breakdown of tool-use token usage by modality.

  {% /summary %}

  {% details %}
  {% summary %}
  **modality**: `ResponseModality`

  The modality associated with the token count.

  {% /summary %}

  Possible values:

  - `text`: Indicates the model should return text.
  - `image`: Indicates the model should return images.
  - `audio`: Indicates the model should return audio.
  - `video`: Indicates the model should return video.
  - `document`: Indicates the model should return documents.

  {% /details %}

  **tokens**: `integer`

  Number of tokens for the modality.

  {% /details %}

  **total_thought_tokens**: `integer`

  Number of tokens of thoughts for thinking models.

  **total_tokens**: `integer`

  Total token count for the interaction request (prompt + responses + other internal tokens).

  {% details %}
  {% summary %}
  **grounding_tool_count**: `GroundingToolCount array`

  Grounding tool count.

  {% /summary %}

  {% details %}
  {% summary %}
  **type**: `string enum`

  The grounding tool type associated with the count.

  {% /summary %}

  Possible values:

  - `google_search`: Grounding with Google Web Search and Image Search, & Web Grounding for Enterprise.
  - `google_maps`: Grounding with Google Maps.

  {% /details %}

  **count**: `integer`

  The number of grounding tool counts.

  {% /details %}

  {% /details %}

  {% details %}
  {% summary %}
  **service_tier**: `ServiceTier`

  The service tier for the interaction.

  {% /summary %}

  Possible values:

  - `flex`: Flex service tier.
  - `standard`: Standard service tier.
  - `priority`: Priority service tier.

  {% /details %}

  **steps**: [`Step`](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:Step) `array`

  Output only. The steps that make up the interaction, if included in this event.

  **agent**: `string`

  The agent to interact with.

  **object**: `string`

  Output only. The resource type.

  {% /details %}

  {% hr /%}

  **event_type**: {% mark %}required{% /mark %} `object`

  Value: `interaction.completed`

  {% hr /%}

  **event_id**: `string`

  The event_id token to be used to resume the interaction stream, from this event.

  {% /section %}

  {% /left-column %}

  {% right-column class="sticky" %}
  **Example**

  **Interaction Completed**

  ```json
  {
    "event_id": "evt_123",
    "event_type": "interaction.completed",
    "interaction": {
      "created": "2025-12-04T15:01:45Z",
      "id": "v1_ChdXS0l4YWZXTk9xbk0xZThQczhEcmlROBIXV0tJeGFmV05PcW5NMWU4UHM4RHJpUTg",
      "model": "gemini-3.8-flash",
      "status": "completed",
      "updated": "2025-12-04T15:01:45Z"
    }
  }
  ```

  {% /right-column %}

  {% /two-column-layout %}

{% /details %}

{% details %}
  {% summary %}
  **InteractionCreatedEvent**

  {% /summary %}

  Server response confirming that a new interaction was created.

  {% two-column-layout %}
  {% left-column %}
  {% section class="api-ref-property-list" %}
  {% details %}
  {% summary %}
  **interaction**: {% mark %}required{% /mark %} `InteractionSseEventInteraction`

  Partial interaction resource emitted when the stream is created.

  {% /summary %}

  **id**: {% mark %}required{% /mark %} `string`

  Output only. A unique identifier for the interaction completion.

  {% details %}
  {% summary %}
  **status**: {% mark %}required{% /mark %} `string enum`

  Output only. The status of the interaction.

  {% /summary %}

  Possible values:

  - `in_progress`: The interaction is in progress.
  - `requires_action`: The interaction requires action/input from the user.
  - `completed`: The interaction is completed.
  - `failed`: The interaction failed.
  - `cancelled`: The interaction was cancelled.
  - `incomplete`: The interaction is completed, but contains incomplete results (e.g. hitting max_tokens).
  - `requires_continuation`: The interaction requires at least one more request for it to be completed. The next request should set the continuation_token to the one returned by this request.

  {% /details %}

  **model**: `string`

  The model that will complete your prompt.

  **created**: `string`

  Output only. The time at which the response was created in ISO 8601 format.

  **updated**: `string`

  Output only. The time at which the response was last updated in ISO 8601 format.

  {% details %}
  {% summary %}
  **usage**: `Usage`

  Output only. Statistics on the interaction request's token usage.

  {% /summary %}

  **total_input_tokens**: `integer`

  Number of tokens in the prompt (context).

  **initial_input_tokens**: `integer`

  Number of input tokens used in the first turn of this interaction.

  {% details %}
  {% summary %}
  **input_tokens_by_modality**: `ModalityTokens array`

  A breakdown of input token usage by modality.

  {% /summary %}

  {% details %}
  {% summary %}
  **modality**: `ResponseModality`

  The modality associated with the token count.

  {% /summary %}

  Possible values:

  - `text`: Indicates the model should return text.
  - `image`: Indicates the model should return images.
  - `audio`: Indicates the model should return audio.
  - `video`: Indicates the model should return video.
  - `document`: Indicates the model should return documents.

  {% /details %}

  **tokens**: `integer`

  Number of tokens for the modality.

  {% /details %}

  **total_cached_tokens**: `integer`

  Number of tokens in the cached part of the prompt (the cached content).

  {% details %}
  {% summary %}
  **cached_tokens_by_modality**: `ModalityTokens array`

  A breakdown of cached token usage by modality.

  {% /summary %}

  {% details %}
  {% summary %}
  **modality**: `ResponseModality`

  The modality associated with the token count.

  {% /summary %}

  Possible values:

  - `text`: Indicates the model should return text.
  - `image`: Indicates the model should return images.
  - `audio`: Indicates the model should return audio.
  - `video`: Indicates the model should return video.
  - `document`: Indicates the model should return documents.

  {% /details %}

  **tokens**: `integer`

  Number of tokens for the modality.

  {% /details %}

  **total_output_tokens**: `integer`

  Total number of tokens across all the generated responses.

  {% details %}
  {% summary %}
  **output_tokens_by_modality**: `ModalityTokens array`

  A breakdown of output token usage by modality.

  {% /summary %}

  {% details %}
  {% summary %}
  **modality**: `ResponseModality`

  The modality associated with the token count.

  {% /summary %}

  Possible values:

  - `text`: Indicates the model should return text.
  - `image`: Indicates the model should return images.
  - `audio`: Indicates the model should return audio.
  - `video`: Indicates the model should return video.
  - `document`: Indicates the model should return documents.

  {% /details %}

  **tokens**: `integer`

  Number of tokens for the modality.

  {% /details %}

  **total_tool_use_tokens**: `integer`

  Number of tokens present in tool-use prompt(s).

  {% details %}
  {% summary %}
  **tool_use_tokens_by_modality**: `ModalityTokens array`

  A breakdown of tool-use token usage by modality.

  {% /summary %}

  {% details %}
  {% summary %}
  **modality**: `ResponseModality`

  The modality associated with the token count.

  {% /summary %}

  Possible values:

  - `text`: Indicates the model should return text.
  - `image`: Indicates the model should return images.
  - `audio`: Indicates the model should return audio.
  - `video`: Indicates the model should return video.
  - `document`: Indicates the model should return documents.

  {% /details %}

  **tokens**: `integer`

  Number of tokens for the modality.

  {% /details %}

  **total_thought_tokens**: `integer`

  Number of tokens of thoughts for thinking models.

  **total_tokens**: `integer`

  Total token count for the interaction request (prompt + responses + other internal tokens).

  {% details %}
  {% summary %}
  **grounding_tool_count**: `GroundingToolCount array`

  Grounding tool count.

  {% /summary %}

  {% details %}
  {% summary %}
  **type**: `string enum`

  The grounding tool type associated with the count.

  {% /summary %}

  Possible values:

  - `google_search`: Grounding with Google Web Search and Image Search, & Web Grounding for Enterprise.
  - `google_maps`: Grounding with Google Maps.

  {% /details %}

  **count**: `integer`

  The number of grounding tool counts.

  {% /details %}

  {% /details %}

  {% details %}
  {% summary %}
  **service_tier**: `ServiceTier`

  The service tier for the interaction.

  {% /summary %}

  Possible values:

  - `flex`: Flex service tier.
  - `standard`: Standard service tier.
  - `priority`: Priority service tier.

  {% /details %}

  **steps**: [`Step`](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:Step) `array`

  Output only. The steps that make up the interaction, if included in this event.

  **agent**: `string`

  The agent to interact with.

  **object**: `string`

  Output only. The resource type.

  {% /details %}

  {% hr /%}

  **event_type**: {% mark %}required{% /mark %} `object`

  Value: `interaction.created`

  {% hr /%}

  **event_id**: `string`

  The event_id token to be used to resume the interaction stream, from this event.

  {% /section %}

  {% /left-column %}

  {% right-column class="sticky" %}
  **Example**

  **Interaction Created**

  ```json
  {
    "event_id": "evt_123",
    "event_type": "interaction.created",
    "interaction": {
      "created": "2025-12-04T15:01:45Z",
      "id": "v1_ChdXS0l4YWZXTk9xbk0xZThQczhEcmlROBIXV0tJeGFmV05PcW5NMWU4UHM4RHJpUTg",
      "model": "gemini-3.8-flash",
      "status": "in_progress",
      "updated": "2025-12-04T15:01:45Z"
    }
  }
  ```

  {% /right-column %}

  {% /two-column-layout %}

{% /details %}

{% details %}
  {% summary %}
  **InteractionStatusUpdate**

  {% /summary %}

  {% two-column-layout %}
  {% left-column %}
  {% section class="api-ref-property-list" %}
  **interaction_id**: {% mark %}required{% /mark %} `string`

  {% hr /%}

  {% details %}
  {% summary %}
  **status**: {% mark %}required{% /mark %} `string enum`

  {% /summary %}

  Possible values:

  - `in_progress`: The interaction is in progress.
  - `requires_action`: The interaction requires action/input from the user.
  - `completed`: The interaction is completed.
  - `failed`: The interaction failed.
  - `cancelled`: The interaction was cancelled.
  - `incomplete`: The interaction is completed, but contains incomplete results (e.g. hitting max_tokens).
  - `requires_continuation`: The interaction requires at least one more request for it to be completed. The next request should set the continuation_token to the one returned by this request.

  {% /details %}

  {% hr /%}

  **event_type**: {% mark %}required{% /mark %} `object`

  Value: `interaction.status_update`

  {% hr /%}

  **continuation_token**: `string`

  An optional opaque continuation token used to resume decoding from the latest checkpoint after a disconnected stream.

  {% hr /%}

  {% details %}
  {% summary %}
  **usage**: `Usage`

  Model usage statistics up to this checkpoint.

  {% /summary %}

  **total_input_tokens**: `integer`

  Number of tokens in the prompt (context).

  **initial_input_tokens**: `integer`

  Number of input tokens used in the first turn of this interaction.

  {% details %}
  {% summary %}
  **input_tokens_by_modality**: `ModalityTokens array`

  A breakdown of input token usage by modality.

  {% /summary %}

  {% details %}
  {% summary %}
  **modality**: `ResponseModality`

  The modality associated with the token count.

  {% /summary %}

  Possible values:

  - `text`: Indicates the model should return text.
  - `image`: Indicates the model should return images.
  - `audio`: Indicates the model should return audio.
  - `video`: Indicates the model should return video.
  - `document`: Indicates the model should return documents.

  {% /details %}

  **tokens**: `integer`

  Number of tokens for the modality.

  {% /details %}

  **total_cached_tokens**: `integer`

  Number of tokens in the cached part of the prompt (the cached content).

  {% details %}
  {% summary %}
  **cached_tokens_by_modality**: `ModalityTokens array`

  A breakdown of cached token usage by modality.

  {% /summary %}

  {% details %}
  {% summary %}
  **modality**: `ResponseModality`

  The modality associated with the token count.

  {% /summary %}

  Possible values:

  - `text`: Indicates the model should return text.
  - `image`: Indicates the model should return images.
  - `audio`: Indicates the model should return audio.
  - `video`: Indicates the model should return video.
  - `document`: Indicates the model should return documents.

  {% /details %}

  **tokens**: `integer`

  Number of tokens for the modality.

  {% /details %}

  **total_output_tokens**: `integer`

  Total number of tokens across all the generated responses.

  {% details %}
  {% summary %}
  **output_tokens_by_modality**: `ModalityTokens array`

  A breakdown of output token usage by modality.

  {% /summary %}

  {% details %}
  {% summary %}
  **modality**: `ResponseModality`

  The modality associated with the token count.

  {% /summary %}

  Possible values:

  - `text`: Indicates the model should return text.
  - `image`: Indicates the model should return images.
  - `audio`: Indicates the model should return audio.
  - `video`: Indicates the model should return video.
  - `document`: Indicates the model should return documents.

  {% /details %}

  **tokens**: `integer`

  Number of tokens for the modality.

  {% /details %}

  **total_tool_use_tokens**: `integer`

  Number of tokens present in tool-use prompt(s).

  {% details %}
  {% summary %}
  **tool_use_tokens_by_modality**: `ModalityTokens array`

  A breakdown of tool-use token usage by modality.

  {% /summary %}

  {% details %}
  {% summary %}
  **modality**: `ResponseModality`

  The modality associated with the token count.

  {% /summary %}

  Possible values:

  - `text`: Indicates the model should return text.
  - `image`: Indicates the model should return images.
  - `audio`: Indicates the model should return audio.
  - `video`: Indicates the model should return video.
  - `document`: Indicates the model should return documents.

  {% /details %}

  **tokens**: `integer`

  Number of tokens for the modality.

  {% /details %}

  **total_thought_tokens**: `integer`

  Number of tokens of thoughts for thinking models.

  **total_tokens**: `integer`

  Total token count for the interaction request (prompt + responses + other internal tokens).

  {% details %}
  {% summary %}
  **grounding_tool_count**: `GroundingToolCount array`

  Grounding tool count.

  {% /summary %}

  {% details %}
  {% summary %}
  **type**: `string enum`

  The grounding tool type associated with the count.

  {% /summary %}

  Possible values:

  - `google_search`: Grounding with Google Web Search and Image Search, & Web Grounding for Enterprise.
  - `google_maps`: Grounding with Google Maps.

  {% /details %}

  **count**: `integer`

  The number of grounding tool counts.

  {% /details %}

  {% /details %}

  {% hr /%}

  **event_id**: `string`

  The event_id token to be used to resume the interaction stream, from this event.

  {% /section %}

  {% /left-column %}

  {% right-column class="sticky" %}
  **Example**

  **Interaction Status Update**

  ```json
  {
    "event_type": "interaction.status_update",
    "interaction_id": "v1_ChdTMjQ0YWJ5TUF1TzcxZThQdjRpcnFRcxIXUzI0NGFieU1BdU83MWU4UHY0aXJxUXM",
    "status": "in_progress"
  }
  ```

  {% /right-column %}

  {% /two-column-layout %}

{% /details %}

{% details %}
  {% summary %}
  **StepDelta**

  {% /summary %}

  {% two-column-layout %}
  {% left-column %}
  {% section class="api-ref-property-list" %}
  **index**: {% mark %}required{% /mark %} `integer`

  {% hr /%}

  {% details %}
  {% summary %}
  **delta**: {% mark %}required{% /mark %} `StepDeltaData`

  {% /summary %}

  **Possible Types:** {% class="api-ref-label" %}

  {% details %}
  {% summary %}
  **ArgumentsDelta**

  {% /summary %}

  **type**: {% mark %}required{% /mark %} `object`

  Value: `arguments_delta`

  **arguments**: `string`

  {% /details %}

  {% details %}
  {% summary %}
  **AudioDelta**

  {% /summary %}

  **type**: {% mark %}required{% /mark %} `object`

  Value: `audio`

  {% details %}
  {% summary %}
  **mime_type**: `string enum`

  {% /summary %}

  Possible values:

  - `audio/wav`: WAV audio format
  - `audio/mp3`: MP3 audio format
  - `audio/aiff`: AIFF audio format
  - `audio/aac`: AAC audio format
  - `audio/ogg`: OGG audio format
  - `audio/flac`: FLAC audio format
  - `audio/mpeg`: MPEG audio format
  - `audio/m4a`: M4A audio format
  - `audio/l16`: L16 audio format
  - `audio/opus`: OPUS audio format
  - `audio/alaw`: ALAW audio format
  - `audio/mulaw`: MULAW audio format
  - `audio/webm`: WEBM audio format

  {% /details %}

  **data**: `string`

  **uri**: `string`

  **sample_rate**: `integer`

  The sample rate of the audio.

  **channels**: `integer`

  The number of audio channels.

  {% /details %}

  {% details %}
  {% summary %}
  **CodeExecutionCallDelta**

  {% /summary %}

  {% details %}
  {% summary %}
  **arguments**: {% mark %}required{% /mark %} `CodeExecutionCallArguments`

  {% /summary %}

  {% details %}
  {% summary %}
  **language**: `string enum`

  Programming language of the `code`.

  {% /summary %}

  Possible values:

  - `python`: Python >= 3.10, with numpy and simpy available.
  - `bash`: Bash. Only available for Gemini 3.0 model or above.

  {% /details %}

  **code**: `string`

  The code to be executed.

  {% /details %}

  **type**: {% mark %}required{% /mark %} `object`

  Value: `code_execution_call`

  **signature**: `string`

  A signature hash for backend validation.

  {% /details %}

  {% details %}
  {% summary %}
  **CodeExecutionResultDelta**

  {% /summary %}

  **result**: {% mark %}required{% /mark %} `string`

  **type**: {% mark %}required{% /mark %} `object`

  Value: `code_execution_result`

  **is_error**: `boolean`

  **signature**: `string`

  A signature hash for backend validation.

  {% /details %}

  {% details %}
  {% summary %}
  **DocumentDelta**

  {% /summary %}

  **type**: {% mark %}required{% /mark %} `object`

  Value: `document`

  {% details %}
  {% summary %}
  **mime_type**: `string enum`

  {% /summary %}

  Possible values:

  - `application/pdf`: PDF document format
  - `text/csv`: CSV document format
  - `application/vnd.openxmlformats-officedocument.presentationml.presentation`: PPTX presentation format
  - `application/vnd.ms-powerpoint`: PPT presentation format
  - `application/vnd.oasis.opendocument.presentation`: ODP presentation format
  - `application/vnd.openxmlformats-officedocument.wordprocessingml.document`: DOCX document format
  - `application/msword`: DOC document format
  - `application/vnd.openxmlformats-officedocument.wordprocessingml.template`: DOTX document template format
  - `application/vnd.oasis.opendocument.text`: ODT document format
  - `application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`: XLSX spreadsheet format
  - `application/vnd.ms-excel`: XLS spreadsheet format
  - `application/vnd.oasis.opendocument.spreadsheet`: ODS spreadsheet format

  {% /details %}

  **data**: `string`

  **uri**: `string`

  {% /details %}

  {% details %}
  {% summary %}
  **FileSearchCallDelta**

  {% /summary %}

  **type**: {% mark %}required{% /mark %} `object`

  Value: `file_search_call`

  **signature**: `string`

  A signature hash for backend validation.

  {% /details %}

  {% details %}
  {% summary %}
  **FileSearchResultDelta**

  {% /summary %}

  {% details %}
  {% summary %}
  **result**: {% mark %}required{% /mark %} `FileSearchResult array`

  {% /summary %}

  {% /details %}

  **type**: {% mark %}required{% /mark %} `object`

  Value: `file_search_result`

  **signature**: `string`

  A signature hash for backend validation.

  {% /details %}

  {% details %}
  {% summary %}
  **FunctionResultDelta**

  {% /summary %}

  {% details %}
  {% summary %}
  **result**: {% mark %}required{% /mark %} ([`AudioContent`](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:AudioContent) or [`DocumentContent`](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:DocumentContent) or [`ImageContent`](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:ImageContent) or [`TextContent`](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:TextContent) or [`VideoContent`](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:VideoContent)) `array` or `object` or `string`

  {% /summary %}

  **Possible Types:** {% class="api-ref-label" %}

  {% details %}
  {% summary %}
  **([AudioContent](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:AudioContent) or [DocumentContent](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:DocumentContent) or [ImageContent](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:ImageContent) or [TextContent](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:TextContent) or [VideoContent](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:VideoContent)) array**

  {% /summary %}

  A list where each item is one of: [`AudioContent`](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:AudioContent), [`DocumentContent`](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:DocumentContent), [`ImageContent`](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:ImageContent), [`TextContent`](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:TextContent), [`VideoContent`](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:VideoContent).

  {% /details %}

  {% details %}
  {% summary %}
  **string**

  {% /summary %}

  A direct string value.

  {% /details %}

  {% /details %}

  **type**: {% mark %}required{% /mark %} `object`

  Value: `function_result`

  **name**: `string`

  **is_error**: `boolean`

  {% /details %}

  {% details %}
  {% summary %}
  **GoogleMapsCallDelta**

  {% /summary %}

  **type**: {% mark %}required{% /mark %} `object`

  Value: `google_maps_call`

  {% details %}
  {% summary %}
  **arguments**: `GoogleMapsCallArguments`

  The arguments to pass to the Google Maps tool.

  {% /summary %}

  **queries**: `string array`

  The queries to be executed.

  {% /details %}

  **signature**: `string`

  A signature hash for backend validation.

  {% /details %}

  {% details %}
  {% summary %}
  **GoogleMapsResultDelta**

  {% /summary %}

  **type**: {% mark %}required{% /mark %} `object`

  Value: `google_maps_result`

  {% details %}
  {% summary %}
  **result**: `GoogleMapsResult array`

  The results of the Google Maps.

  {% /summary %}

  {% details %}
  {% summary %}
  **places**: `Places array`

  The places that were found.

  {% /summary %}

  **place_id**: `string`

  The ID of the place, in `places/{place_id}` format.

  **name**: `string`

  Title of the place.

  **url**: `string`

  URI reference of the place.

  {% details %}
  {% summary %}
  **review_snippets**: `ReviewSnippet array`

  Snippets of reviews that are used to generate answers about the features of a given place in Google Maps.

  {% /summary %}

  **title**: `string`

  Title of the review.

  **url**: `string`

  A link that corresponds to the user review on Google Maps.

  **review_id**: `string`

  The ID of the review snippet.

  {% /details %}

  {% /details %}

  **widget_context_token**: `string`

  Resource name of the Google Maps widget context token.

  {% /details %}

  **signature**: `string`

  A signature hash for backend validation.

  {% /details %}

  {% details %}
  {% summary %}
  **GoogleSearchCallDelta**

  {% /summary %}

  {% details %}
  {% summary %}
  **arguments**: {% mark %}required{% /mark %} `GoogleSearchCallArguments`

  {% /summary %}

  **queries**: `string array`

  Web search queries for the following-up web search.

  {% /details %}

  **type**: {% mark %}required{% /mark %} `object`

  Value: `google_search_call`

  **signature**: `string`

  A signature hash for backend validation.

  {% /details %}

  {% details %}
  {% summary %}
  **GoogleSearchResultDelta**

  {% /summary %}

  {% details %}
  {% summary %}
  **result**: {% mark %}required{% /mark %} `GoogleSearchResult array`

  {% /summary %}

  **search_suggestions**: `string`

  Web content snippet that can be embedded in a web page or an app webview.

  {% /details %}

  **type**: {% mark %}required{% /mark %} `object`

  Value: `google_search_result`

  **is_error**: `boolean`

  **signature**: `string`

  A signature hash for backend validation.

  {% /details %}

  {% details %}
  {% summary %}
  **ImageDelta**

  {% /summary %}

  **type**: {% mark %}required{% /mark %} `object`

  Value: `image`

  {% details %}
  {% summary %}
  **mime_type**: `string enum`

  {% /summary %}

  Possible values:

  - `image/png`: PNG image format
  - `image/jpeg`: JPEG image format
  - `image/webp`: WebP image format
  - `image/heic`: HEIC image format
  - `image/heif`: HEIF image format
  - `image/gif`: GIF image format
  - `image/bmp`: BMP image format
  - `image/tiff`: TIFF image format

  {% /details %}

  **data**: `string`

  **uri**: `string`

  {% details %}
  {% summary %}
  **resolution**: `MediaResolution`

  The resolution of the media.

  {% /summary %}

  Possible values:

  - `low`: Low resolution.
  - `medium`: Medium resolution.
  - `high`: High resolution.
  - `ultra_high`: Ultra high resolution.

  {% /details %}

  {% /details %}

  {% details %}
  {% summary %}
  **McpServerToolCallDelta**

  {% /summary %}

  **name**: {% mark %}required{% /mark %} `string`

  **server_name**: {% mark %}required{% /mark %} `string`

  **arguments**: {% mark %}required{% /mark %} `object`

  **type**: {% mark %}required{% /mark %} `object`

  Value: `mcp_server_tool_call`

  {% /details %}

  {% details %}
  {% summary %}
  **McpServerToolResultDelta**

  {% /summary %}

  {% details %}
  {% summary %}
  **result**: {% mark %}required{% /mark %} ([`AudioContent`](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:AudioContent) or [`DocumentContent`](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:DocumentContent) or [`ImageContent`](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:ImageContent) or [`TextContent`](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:TextContent) or [`VideoContent`](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:VideoContent)) `array` or `object` or `string`

  {% /summary %}

  **Possible Types:** {% class="api-ref-label" %}

  {% details %}
  {% summary %}
  **([AudioContent](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:AudioContent) or [DocumentContent](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:DocumentContent) or [ImageContent](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:ImageContent) or [TextContent](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:TextContent) or [VideoContent](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:VideoContent)) array**

  {% /summary %}

  A list where each item is one of: [`AudioContent`](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:AudioContent), [`DocumentContent`](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:DocumentContent), [`ImageContent`](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:ImageContent), [`TextContent`](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:TextContent), [`VideoContent`](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:VideoContent).

  {% /details %}

  {% details %}
  {% summary %}
  **string**

  {% /summary %}

  A direct string value.

  {% /details %}

  {% /details %}

  **type**: {% mark %}required{% /mark %} `object`

  Value: `mcp_server_tool_result`

  **name**: `string`

  **server_name**: `string`

  {% /details %}

  {% details %}
  {% summary %}
  **TextAnnotationDelta**

  {% /summary %}

  **type**: {% mark %}required{% /mark %} `object`

  Value: `text_annotation_delta`

  {% details %}
  {% summary %}
  **annotations**: `Annotation array`

  Citation information for model-generated content.

  {% /summary %}

  **Possible Types:** {% class="api-ref-label" %}

  {% details %}
  {% summary %}
  **FileCitation**

  {% /summary %}

  A file citation annotation.

  **type**: {% mark %}required{% /mark %} `object`

  Value: `file_citation`

  **document_uri**: `string`

  The URI of the file.

  **file_name**: `string`

  The name of the file.

  **source**: `string`

  Source attributed for a portion of the text.

  **custom_metadata**: `object`

  User provided metadata about the retrieved context.

  **page_number**: `integer`

  Page number of the cited document, if applicable.

  **media_id**: `string`

  Media ID in-case of image citations, if applicable.

  **start_index**: `integer`

  Start of segment of the response that is attributed to this source. Index indicates the start of the segment, measured in bytes.

  **end_index**: `integer`

  End of the attributed segment, exclusive.

  {% /details %}

  {% details %}
  {% summary %}
  **PlaceCitation**

  {% /summary %}

  A place citation annotation.

  **type**: {% mark %}required{% /mark %} `object`

  Value: `place_citation`

  **place_id**: `string`

  The ID of the place, in `places/{place_id}` format.

  **name**: `string`

  Title of the place.

  **url**: `string`

  URI reference of the place.

  {% details %}
  {% summary %}
  **review_snippets**: `ReviewSnippet array`

  Snippets of reviews that are used to generate answers about the features of a given place in Google Maps.

  {% /summary %}

  **title**: `string`

  Title of the review.

  **url**: `string`

  A link that corresponds to the user review on Google Maps.

  **review_id**: `string`

  The ID of the review snippet.

  {% /details %}

  **start_index**: `integer`

  Start of segment of the response that is attributed to this source. Index indicates the start of the segment, measured in bytes.

  **end_index**: `integer`

  End of the attributed segment, exclusive.

  {% /details %}

  {% details %}
  {% summary %}
  **UrlCitation**

  {% /summary %}

  A URL citation annotation.

  **type**: {% mark %}required{% /mark %} `object`

  Value: `url_citation`

  **url**: `string`

  The URL.

  **title**: `string`

  The title of the URL.

  **start_index**: `integer`

  Start of segment of the response that is attributed to this source. Index indicates the start of the segment, measured in bytes.

  **end_index**: `integer`

  End of the attributed segment, exclusive.

  {% /details %}

  {% /details %}

  {% /details %}

  {% details %}
  {% summary %}
  **TextDelta**

  {% /summary %}

  **text**: {% mark %}required{% /mark %} `string`

  **type**: {% mark %}required{% /mark %} `object`

  Value: `text`

  {% /details %}

  {% details %}
  {% summary %}
  **ThoughtSignatureDelta**

  {% /summary %}

  **type**: {% mark %}required{% /mark %} `object`

  Value: `thought_signature`

  **signature**: `string`

  Signature to match the backend source to be part of the generation.

  {% /details %}

  {% details %}
  {% summary %}
  **ThoughtSummaryDelta**

  {% /summary %}

  **type**: {% mark %}required{% /mark %} `object`

  Value: `thought_summary`

  **content**: [`Content`](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:Content)

  A new summary item to be added to the thought.

  {% /details %}

  {% details %}
  {% summary %}
  **UrlContextCallDelta**

  {% /summary %}

  {% details %}
  {% summary %}
  **arguments**: {% mark %}required{% /mark %} `UrlContextCallArguments`

  {% /summary %}

  **urls**: `string array`

  The URLs to fetch.

  {% /details %}

  **type**: {% mark %}required{% /mark %} `object`

  Value: `url_context_call`

  **signature**: `string`

  A signature hash for backend validation.

  {% /details %}

  {% details %}
  {% summary %}
  **UrlContextResultDelta**

  {% /summary %}

  {% details %}
  {% summary %}
  **result**: {% mark %}required{% /mark %} `UrlContextResult array`

  {% /summary %}

  **url**: `string`

  The URL that was fetched.

  {% details %}
  {% summary %}
  **status**: `string enum`

  The status of the URL retrieval.

  {% /summary %}

  Possible values:

  - `success`: Url retrieval is successful.
  - `error`: Url retrieval is failed due to error.
  - `paywall`: Url retrieval is failed because the content is behind paywall.
  - `unsafe`: Url retrieval is failed because the content is unsafe.

  {% /details %}

  {% /details %}

  **type**: {% mark %}required{% /mark %} `object`

  Value: `url_context_result`

  **is_error**: `boolean`

  **signature**: `string`

  A signature hash for backend validation.

  {% /details %}

  {% details %}
  {% summary %}
  **VideoDelta**

  {% /summary %}

  **type**: {% mark %}required{% /mark %} `object`

  Value: `video`

  {% details %}
  {% summary %}
  **mime_type**: `string enum`

  {% /summary %}

  Possible values:

  - `video/mp4`: MP4 video format
  - `video/mpeg`: MPEG video format
  - `video/mpg`: MPG video format
  - `video/mov`: MOV video format
  - `video/avi`: AVI video format
  - `video/x-flv`: FLV video format
  - `video/webm`: WebM video format
  - `video/wmv`: WMV video format
  - `video/3gpp`: 3GPP video format
  - `video/jpeg2000`: JPEG 2000 video format

  {% /details %}

  **data**: `string`

  **uri**: `string`

  {% details %}
  {% summary %}
  **resolution**: `MediaResolution`

  The resolution of the media.

  {% /summary %}

  Possible values:

  - `low`: Low resolution.
  - `medium`: Medium resolution.
  - `high`: High resolution.
  - `ultra_high`: Ultra high resolution.

  {% /details %}

  {% /details %}

  {% /details %}

  {% hr /%}

  **event_type**: {% mark %}required{% /mark %} `object`

  Value: `step.delta`

  {% hr /%}

  **event_id**: `string`

  The event_id token to be used to resume the interaction stream, from this event.

  {% hr /%}

  {% details %}
  {% summary %}
  **metadata**: `StepDeltaMetadata`

  {% /summary %}

  {% details %}
  {% summary %}
  **total_usage**: `Usage`

  Statistics on the interaction request's token usage.

  {% /summary %}

  **total_input_tokens**: `integer`

  Number of tokens in the prompt (context).

  **initial_input_tokens**: `integer`

  Number of input tokens used in the first turn of this interaction.

  {% details %}
  {% summary %}
  **input_tokens_by_modality**: `ModalityTokens array`

  A breakdown of input token usage by modality.

  {% /summary %}

  {% details %}
  {% summary %}
  **modality**: `ResponseModality`

  The modality associated with the token count.

  {% /summary %}

  Possible values:

  - `text`: Indicates the model should return text.
  - `image`: Indicates the model should return images.
  - `audio`: Indicates the model should return audio.
  - `video`: Indicates the model should return video.
  - `document`: Indicates the model should return documents.

  {% /details %}

  **tokens**: `integer`

  Number of tokens for the modality.

  {% /details %}

  **total_cached_tokens**: `integer`

  Number of tokens in the cached part of the prompt (the cached content).

  {% details %}
  {% summary %}
  **cached_tokens_by_modality**: `ModalityTokens array`

  A breakdown of cached token usage by modality.

  {% /summary %}

  {% details %}
  {% summary %}
  **modality**: `ResponseModality`

  The modality associated with the token count.

  {% /summary %}

  Possible values:

  - `text`: Indicates the model should return text.
  - `image`: Indicates the model should return images.
  - `audio`: Indicates the model should return audio.
  - `video`: Indicates the model should return video.
  - `document`: Indicates the model should return documents.

  {% /details %}

  **tokens**: `integer`

  Number of tokens for the modality.

  {% /details %}

  **total_output_tokens**: `integer`

  Total number of tokens across all the generated responses.

  {% details %}
  {% summary %}
  **output_tokens_by_modality**: `ModalityTokens array`

  A breakdown of output token usage by modality.

  {% /summary %}

  {% details %}
  {% summary %}
  **modality**: `ResponseModality`

  The modality associated with the token count.

  {% /summary %}

  Possible values:

  - `text`: Indicates the model should return text.
  - `image`: Indicates the model should return images.
  - `audio`: Indicates the model should return audio.
  - `video`: Indicates the model should return video.
  - `document`: Indicates the model should return documents.

  {% /details %}

  **tokens**: `integer`

  Number of tokens for the modality.

  {% /details %}

  **total_tool_use_tokens**: `integer`

  Number of tokens present in tool-use prompt(s).

  {% details %}
  {% summary %}
  **tool_use_tokens_by_modality**: `ModalityTokens array`

  A breakdown of tool-use token usage by modality.

  {% /summary %}

  {% details %}
  {% summary %}
  **modality**: `ResponseModality`

  The modality associated with the token count.

  {% /summary %}

  Possible values:

  - `text`: Indicates the model should return text.
  - `image`: Indicates the model should return images.
  - `audio`: Indicates the model should return audio.
  - `video`: Indicates the model should return video.
  - `document`: Indicates the model should return documents.

  {% /details %}

  **tokens**: `integer`

  Number of tokens for the modality.

  {% /details %}

  **total_thought_tokens**: `integer`

  Number of tokens of thoughts for thinking models.

  **total_tokens**: `integer`

  Total token count for the interaction request (prompt + responses + other internal tokens).

  {% details %}
  {% summary %}
  **grounding_tool_count**: `GroundingToolCount array`

  Grounding tool count.

  {% /summary %}

  {% details %}
  {% summary %}
  **type**: `string enum`

  The grounding tool type associated with the count.

  {% /summary %}

  Possible values:

  - `google_search`: Grounding with Google Web Search and Image Search, & Web Grounding for Enterprise.
  - `google_maps`: Grounding with Google Maps.

  {% /details %}

  **count**: `integer`

  The number of grounding tool counts.

  {% /details %}

  {% /details %}

  {% /details %}

  {% /section %}

  {% /left-column %}

  {% right-column class="sticky" %}
  **Example**

  **Step Delta**

  ```json
  {
    "delta": {
      "type": "text",
      "text": "Hello"
    },
    "event_type": "step.delta",
    "index": 0
  }
  ```

  {% /right-column %}

  {% /two-column-layout %}

{% /details %}

{% details %}
  {% summary %}
  **StepStart**

  {% /summary %}

  {% two-column-layout %}
  {% left-column %}
  {% section class="api-ref-property-list" %}
  **index**: {% mark %}required{% /mark %} `integer`

  {% hr /%}

  **step**: {% mark %}required{% /mark %} [`Step`](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:Step)

  {% hr /%}

  **event_type**: {% mark %}required{% /mark %} `object`

  Value: `step.start`

  {% hr /%}

  **event_id**: `string`

  The event_id token to be used to resume the interaction stream, from this event.

  {% /section %}

  {% /left-column %}

  {% right-column class="sticky" %}
  **Example**

  **Step Start**

  ```json
  {
    "event_type": "step.start",
    "index": 0,
    "step": {
      "type": "model_output"
    }
  }
  ```

  {% /right-column %}

  {% /two-column-layout %}

{% /details %}

{% details %}
  {% summary %}
  **StepStop**

  {% /summary %}

  {% two-column-layout %}
  {% left-column %}
  {% section class="api-ref-property-list" %}
  **index**: {% mark %}required{% /mark %} `integer`

  {% hr /%}

  **event_type**: {% mark %}required{% /mark %} `object`

  Value: `step.stop`

  {% hr /%}

  {% details %}
  {% summary %}
  **usage**: `Usage`

  Cumulative model usage stats from the start of the session.

  {% /summary %}

  **total_input_tokens**: `integer`

  Number of tokens in the prompt (context).

  **initial_input_tokens**: `integer`

  Number of input tokens used in the first turn of this interaction.

  {% details %}
  {% summary %}
  **input_tokens_by_modality**: `ModalityTokens array`

  A breakdown of input token usage by modality.

  {% /summary %}

  {% details %}
  {% summary %}
  **modality**: `ResponseModality`

  The modality associated with the token count.

  {% /summary %}

  Possible values:

  - `text`: Indicates the model should return text.
  - `image`: Indicates the model should return images.
  - `audio`: Indicates the model should return audio.
  - `video`: Indicates the model should return video.
  - `document`: Indicates the model should return documents.

  {% /details %}

  **tokens**: `integer`

  Number of tokens for the modality.

  {% /details %}

  **total_cached_tokens**: `integer`

  Number of tokens in the cached part of the prompt (the cached content).

  {% details %}
  {% summary %}
  **cached_tokens_by_modality**: `ModalityTokens array`

  A breakdown of cached token usage by modality.

  {% /summary %}

  {% details %}
  {% summary %}
  **modality**: `ResponseModality`

  The modality associated with the token count.

  {% /summary %}

  Possible values:

  - `text`: Indicates the model should return text.
  - `image`: Indicates the model should return images.
  - `audio`: Indicates the model should return audio.
  - `video`: Indicates the model should return video.
  - `document`: Indicates the model should return documents.

  {% /details %}

  **tokens**: `integer`

  Number of tokens for the modality.

  {% /details %}

  **total_output_tokens**: `integer`

  Total number of tokens across all the generated responses.

  {% details %}
  {% summary %}
  **output_tokens_by_modality**: `ModalityTokens array`

  A breakdown of output token usage by modality.

  {% /summary %}

  {% details %}
  {% summary %}
  **modality**: `ResponseModality`

  The modality associated with the token count.

  {% /summary %}

  Possible values:

  - `text`: Indicates the model should return text.
  - `image`: Indicates the model should return images.
  - `audio`: Indicates the model should return audio.
  - `video`: Indicates the model should return video.
  - `document`: Indicates the model should return documents.

  {% /details %}

  **tokens**: `integer`

  Number of tokens for the modality.

  {% /details %}

  **total_tool_use_tokens**: `integer`

  Number of tokens present in tool-use prompt(s).

  {% details %}
  {% summary %}
  **tool_use_tokens_by_modality**: `ModalityTokens array`

  A breakdown of tool-use token usage by modality.

  {% /summary %}

  {% details %}
  {% summary %}
  **modality**: `ResponseModality`

  The modality associated with the token count.

  {% /summary %}

  Possible values:

  - `text`: Indicates the model should return text.
  - `image`: Indicates the model should return images.
  - `audio`: Indicates the model should return audio.
  - `video`: Indicates the model should return video.
  - `document`: Indicates the model should return documents.

  {% /details %}

  **tokens**: `integer`

  Number of tokens for the modality.

  {% /details %}

  **total_thought_tokens**: `integer`

  Number of tokens of thoughts for thinking models.

  **total_tokens**: `integer`

  Total token count for the interaction request (prompt + responses + other internal tokens).

  {% details %}
  {% summary %}
  **grounding_tool_count**: `GroundingToolCount array`

  Grounding tool count.

  {% /summary %}

  {% details %}
  {% summary %}
  **type**: `string enum`

  The grounding tool type associated with the count.

  {% /summary %}

  Possible values:

  - `google_search`: Grounding with Google Web Search and Image Search, & Web Grounding for Enterprise.
  - `google_maps`: Grounding with Google Maps.

  {% /details %}

  **count**: `integer`

  The number of grounding tool counts.

  {% /details %}

  {% /details %}

  {% hr /%}

  {% details %}
  {% summary %}
  **step_usage**: `Usage`

  Model usage stats for this specific step.

  {% /summary %}

  **total_input_tokens**: `integer`

  Number of tokens in the prompt (context).

  **initial_input_tokens**: `integer`

  Number of input tokens used in the first turn of this interaction.

  {% details %}
  {% summary %}
  **input_tokens_by_modality**: `ModalityTokens array`

  A breakdown of input token usage by modality.

  {% /summary %}

  {% details %}
  {% summary %}
  **modality**: `ResponseModality`

  The modality associated with the token count.

  {% /summary %}

  Possible values:

  - `text`: Indicates the model should return text.
  - `image`: Indicates the model should return images.
  - `audio`: Indicates the model should return audio.
  - `video`: Indicates the model should return video.
  - `document`: Indicates the model should return documents.

  {% /details %}

  **tokens**: `integer`

  Number of tokens for the modality.

  {% /details %}

  **total_cached_tokens**: `integer`

  Number of tokens in the cached part of the prompt (the cached content).

  {% details %}
  {% summary %}
  **cached_tokens_by_modality**: `ModalityTokens array`

  A breakdown of cached token usage by modality.

  {% /summary %}

  {% details %}
  {% summary %}
  **modality**: `ResponseModality`

  The modality associated with the token count.

  {% /summary %}

  Possible values:

  - `text`: Indicates the model should return text.
  - `image`: Indicates the model should return images.
  - `audio`: Indicates the model should return audio.
  - `video`: Indicates the model should return video.
  - `document`: Indicates the model should return documents.

  {% /details %}

  **tokens**: `integer`

  Number of tokens for the modality.

  {% /details %}

  **total_output_tokens**: `integer`

  Total number of tokens across all the generated responses.

  {% details %}
  {% summary %}
  **output_tokens_by_modality**: `ModalityTokens array`

  A breakdown of output token usage by modality.

  {% /summary %}

  {% details %}
  {% summary %}
  **modality**: `ResponseModality`

  The modality associated with the token count.

  {% /summary %}

  Possible values:

  - `text`: Indicates the model should return text.
  - `image`: Indicates the model should return images.
  - `audio`: Indicates the model should return audio.
  - `video`: Indicates the model should return video.
  - `document`: Indicates the model should return documents.

  {% /details %}

  **tokens**: `integer`

  Number of tokens for the modality.

  {% /details %}

  **total_tool_use_tokens**: `integer`

  Number of tokens present in tool-use prompt(s).

  {% details %}
  {% summary %}
  **tool_use_tokens_by_modality**: `ModalityTokens array`

  A breakdown of tool-use token usage by modality.

  {% /summary %}

  {% details %}
  {% summary %}
  **modality**: `ResponseModality`

  The modality associated with the token count.

  {% /summary %}

  Possible values:

  - `text`: Indicates the model should return text.
  - `image`: Indicates the model should return images.
  - `audio`: Indicates the model should return audio.
  - `video`: Indicates the model should return video.
  - `document`: Indicates the model should return documents.

  {% /details %}

  **tokens**: `integer`

  Number of tokens for the modality.

  {% /details %}

  **total_thought_tokens**: `integer`

  Number of tokens of thoughts for thinking models.

  **total_tokens**: `integer`

  Total token count for the interaction request (prompt + responses + other internal tokens).

  {% details %}
  {% summary %}
  **grounding_tool_count**: `GroundingToolCount array`

  Grounding tool count.

  {% /summary %}

  {% details %}
  {% summary %}
  **type**: `string enum`

  The grounding tool type associated with the count.

  {% /summary %}

  Possible values:

  - `google_search`: Grounding with Google Web Search and Image Search, & Web Grounding for Enterprise.
  - `google_maps`: Grounding with Google Maps.

  {% /details %}

  **count**: `integer`

  The number of grounding tool counts.

  {% /details %}

  {% /details %}

  {% hr /%}

  **event_id**: `string`

  The event_id token to be used to resume the interaction stream, from this event.

  {% /section %}

  {% /left-column %}

  {% right-column class="sticky" %}
  **Example**

  **Step Stop**

  ```json
  {
    "event_type": "step.stop",
    "index": 0
  }
  ```

  {% /right-column %}

  {% /two-column-layout %}

{% /details %}

### ResponseFormat  {% class="hide-from-toc" id="Resource:ResponseFormat" %}

**Polymorphic Types:**

{% details %}
  {% summary %}
  **AudioResponseFormat**

  {% /summary %}

  Configuration for audio output format.

  {% two-column-layout %}
  {% left-column %}
  {% section class="api-ref-property-list" %}
  **type**: {% mark %}required{% /mark %} `object`

  Value: `audio`

  {% hr /%}

  {% details %}
  {% summary %}
  **mime_type**: `string enum`

  The MIME type of the audio output.

  {% /summary %}

  Possible values:

  - `audio/mp3`: MP3 audio format.
  - `audio/ogg_opus`: OGG Opus audio format.
  - `audio/l16`: Raw PCM (L16) audio format.
  - `audio/wav`: WAV audio format.
  - `audio/alaw`: A-law audio format.
  - `audio/mulaw`: Mu-law audio format.

  {% /details %}

  {% hr /%}

  {% details %}
  {% summary %}
  **delivery**: `string enum`

  The delivery mode for the audio output.

  {% /summary %}

  Possible values:

  - `inline`: Audio data is returned inline in the response.
  - `uri`: Audio data is returned as a URI.

  {% /details %}

  {% hr /%}

  **sample_rate**: `integer`

  Sample rate in Hz.

  {% hr /%}

  **bit_rate**: `integer`

  Bit rate in bits per second (bps). Only applicable for compressed formats (MP3, Opus).

  {% /section %}

  {% /left-column %}

  {% right-column class="sticky" %}
  **Example**

  **Audio Output**

  ```json
  {
    "type": "audio",
    "sample_rate": 24000
  }
  ```

  {% /right-column %}

  {% /two-column-layout %}

{% /details %}

{% details %}
  {% summary %}
  **ImageResponseFormat**

  {% /summary %}

  Configuration for image output format.

  {% two-column-layout %}
  {% left-column %}
  {% section class="api-ref-property-list" %}
  **type**: {% mark %}required{% /mark %} `object`

  Value: `image`

  {% hr /%}

  {% details %}
  {% summary %}
  **mime_type**: `string enum`

  The MIME type of the image output.

  {% /summary %}

  Possible values:

  - `image/jpeg`: JPEG image format.

  {% /details %}

  {% hr /%}

  {% details %}
  {% summary %}
  **delivery**: `string enum`

  The delivery mode for the image output.

  {% /summary %}

  Possible values:

  - `inline`: Image data is returned inline in the response.
  - `uri`: Image data is returned as a URI.

  {% /details %}

  {% hr /%}

  {% details %}
  {% summary %}
  **aspect_ratio**: `string enum`

  The aspect ratio for the image output.

  {% /summary %}

  Possible values:

  - `1:1`: 1:1 aspect ratio.
  - `2:3`: 2:3 aspect ratio.
  - `3:2`: 3:2 aspect ratio.
  - `3:4`: 3:4 aspect ratio.
  - `4:3`: 4:3 aspect ratio.
  - `4:5`: 4:5 aspect ratio.
  - `5:4`: 5:4 aspect ratio.
  - `9:16`: 9:16 aspect ratio.
  - `16:9`: 16:9 aspect ratio.
  - `21:9`: 21:9 aspect ratio.
  - `1:8`: 1:8 aspect ratio.
  - `8:1`: 8:1 aspect ratio.
  - `1:4`: 1:4 aspect ratio.
  - `4:1`: 4:1 aspect ratio.

  {% /details %}

  {% hr /%}

  {% details %}
  {% summary %}
  **image_size**: `string enum`

  The size of the image output.

  {% /summary %}

  Possible values:

  - `512`: 512px image size.
  - `1K`: 1K image size.
  - `2K`: 2K image size.
  - `4K`: 4K image size.

  {% /details %}

  {% /section %}

  {% /left-column %}

  {% right-column class="sticky" %}
  **Example**

  **Image Output**

  ```json
  {
    "type": "image",
    "aspect_ratio": "16:9",
    "image_size": "1K",
    "mime_type": "image/jpeg"
  }
  ```

  {% /right-column %}

  {% /two-column-layout %}

{% /details %}

{% details %}
  {% summary %}
  **TextResponseFormat**

  {% /summary %}

  Configuration for text output format.

  {% two-column-layout %}
  {% left-column %}
  {% section class="api-ref-property-list" %}
  **type**: {% mark %}required{% /mark %} `object`

  Value: `text`

  {% hr /%}

  {% details %}
  {% summary %}
  **mime_type**: `string enum`

  The MIME type of the text output.

  {% /summary %}

  Possible values:

  - `application/json`: JSON output format.
  - `text/plain`: Plain text output format.

  {% /details %}

  {% hr /%}

  **schema**: `object`

  The JSON schema that the output should conform to. Only applicable when mime_type is application/json. Supports a subset of JSON Schema. `minLength`, `maxLength`, `minProperties`, `maxProperties`, `uniqueItems`, `contains`, `minContains`, and `maxContains` are ignored and not enforced; validate these in your application. `minItems` and `maxItems` are enforced. Schemas that are too complex to enforce (for example, large `maxItems` on nested arrays) return a 400 INVALID_ARGUMENT error.

  {% /section %}

  {% /left-column %}

  {% right-column class="sticky" %}
  **Example**

  **Text Output (JSON Schema)**

  ```json
  {
    "type": "text",
    "mime_type": "application/json",
    "schema": {
      "type": "object",
      "properties": {
        "ingredients": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "recipe_name": {
          "type": "string"
        }
      },
      "required": [
        "ingredients",
        "recipe_name"
      ]
    }
  }
  ```

  {% /right-column %}

  {% /two-column-layout %}

{% /details %}

{% details %}
  {% summary %}
  **VideoResponseFormat**

  {% /summary %}

  Configuration for video output format.

  {% section class="api-ref-property-list" %}
  **type**: {% mark %}required{% /mark %} `object`

  Value: `video`

  {% hr /%}

  {% details %}
  {% summary %}
  **delivery**: `string enum`

  The delivery mode for the video output.

  {% /summary %}

  Possible values:

  - `inline`: Video data is returned inline in the response.
  - `uri`: Video data is returned as a URI.

  {% /details %}

  {% hr /%}

  {% details %}
  {% summary %}
  **aspect_ratio**: `string enum`

  The aspect ratio for the video output.

  {% /summary %}

  Possible values:

  - `16:9`: 16:9 aspect ratio.
  - `9:16`: 9:16 aspect ratio.

  {% /details %}

  {% hr /%}

  **duration**: `string`

  The duration for the video output.

  {% hr /%}

  {% details %}
  {% summary %}
  **resolution**: `string enum`

  The video output resolution. Defaults to 720p.

  {% /summary %}

  Possible values:

  - `360p`: 360p resolution.
  - `720p`: 720p resolution.
  - `1080p`: 1080p resolution.
  - `4k`: 4K resolution.

  {% /details %}

  {% /section %}

{% /details %}

### Step  {% class="hide-from-toc" id="Resource:Step" %}

A step in the interaction.

**Polymorphic Types:**

{% details %}
  {% summary %}
  **CodeExecutionCallStep**

  {% /summary %}

  Code execution call step.

  {% two-column-layout %}
  {% left-column %}
  {% section class="api-ref-property-list" %}
  {% details %}
  {% summary %}
  **arguments**: {% mark %}required{% /mark %} `CodeExecutionCallStepArguments`

  The arguments to pass to the code execution.

  {% /summary %}

  {% details %}
  {% summary %}
  **language**: `string enum`

  Programming language of the `code`.

  {% /summary %}

  Possible values:

  - `python`: Python >= 3.10, with numpy and simpy available.
  - `bash`: Bash. Only available for Gemini 3.0 model or above.

  {% /details %}

  **code**: `string`

  The code to be executed.

  {% /details %}

  {% hr /%}

  **id**: {% mark %}required{% /mark %} `string`

  A unique ID for this specific tool call.

  {% hr /%}

  **type**: {% mark %}required{% /mark %} `object`

  Value: `code_execution_call`

  {% hr /%}

  **signature**: `string`

  A signature hash for backend validation.

  {% /section %}

  {% /left-column %}

  {% right-column class="sticky" %}
  **Example**

  **CodeExecutionCallStep**

  ```json
  {
    "type": "code_execution_call",
    "arguments": {
      "code": "print(sum(range(1, 11)))"
    },
    "id": "code_call_71021"
  }
  ```

  {% /right-column %}

  {% /two-column-layout %}

{% /details %}

{% details %}
  {% summary %}
  **CodeExecutionResultStep**

  {% /summary %}

  Code execution result step.

  {% two-column-layout %}
  {% left-column %}
  {% section class="api-ref-property-list" %}
  {% details %}
  {% summary %}
  **result**: {% mark %}required{% /mark %} [`Content`](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:Content) `array` or `string`

  The output of the code execution.

  {% /summary %}

  **Possible Types:** {% class="api-ref-label" %}

  {% details %}
  {% summary %}
  **[Content](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:Content) array**

  {% /summary %}

  The contents of the list.

  {% /details %}

  {% details %}
  {% summary %}
  **string**

  {% /summary %}

  A direct string value.

  {% /details %}

  {% /details %}

  {% hr /%}

  **call_id**: {% mark %}required{% /mark %} `string`

  ID to match the ID from the function call block.

  {% hr /%}

  **type**: {% mark %}required{% /mark %} `object`

  Value: `code_execution_result`

  {% hr /%}

  **is_error**: `boolean`

  Whether the code execution resulted in an error.

  {% hr /%}

  **signature**: `string`

  A signature hash for backend validation.

  {% /section %}

  {% /left-column %}

  {% right-column class="sticky" %}
  **Example**

  **CodeExecutionResultStep**

  ```json
  {
    "type": "code_execution_result",
    "call_id": "code_call_71021",
    "result": "55\n"
  }
  ```

  {% /right-column %}

  {% /two-column-layout %}

{% /details %}

{% details %}
  {% summary %}
  **FileSearchCallStep**

  {% /summary %}

  File Search call step.

  {% two-column-layout %}
  {% left-column %}
  {% section class="api-ref-property-list" %}
  **id**: {% mark %}required{% /mark %} `string`

  A unique ID for this specific tool call.

  {% hr /%}

  **type**: {% mark %}required{% /mark %} `object`

  Value: `file_search_call`

  {% hr /%}

  **signature**: `string`

  A signature hash for backend validation.

  {% /section %}

  {% /left-column %}

  {% right-column class="sticky" %}
  **Example**

  **FileSearchCallStep**

  ```json
  {
    "type": "file_search_call",
    "id": "file_call_88192"
  }
  ```

  {% /right-column %}

  {% /two-column-layout %}

{% /details %}

{% details %}
  {% summary %}
  **FileSearchResultStep**

  {% /summary %}

  File Search result step.

  {% two-column-layout %}
  {% left-column %}
  {% section class="api-ref-property-list" %}
  **call_id**: {% mark %}required{% /mark %} `string`

  ID to match the ID from the function call block.

  {% hr /%}

  **type**: {% mark %}required{% /mark %} `object`

  Value: `file_search_result`

  {% hr /%}

  **signature**: `string`

  A signature hash for backend validation.

  {% /section %}

  {% /left-column %}

  {% right-column class="sticky" %}
  **Example**

  **FileSearchResultStep**

  ```json
  {
    "type": "file_search_result",
    "call_id": "file_call_88192"
  }
  ```

  {% /right-column %}

  {% /two-column-layout %}

{% /details %}

{% details %}
  {% summary %}
  **FunctionCallStep**

  {% /summary %}

  A function tool call step.

  {% two-column-layout %}
  {% left-column %}
  {% section class="api-ref-property-list" %}
  **name**: {% mark %}required{% /mark %} `string`

  The name of the tool to call.

  {% hr /%}

  **arguments**: {% mark %}required{% /mark %} `object`

  The arguments to pass to the function.

  {% hr /%}

  **id**: {% mark %}required{% /mark %} `string`

  A unique ID for this specific tool call.

  {% hr /%}

  **type**: {% mark %}required{% /mark %} `object`

  Value: `function_call`

  {% /section %}

  {% /left-column %}

  {% right-column class="sticky" %}
  **Example**

  **FunctionCallStep**

  ```json
  {
    "name": "get_weather",
    "type": "function_call",
    "arguments": {
      "location": "Boston, MA"
    },
    "id": "call_98231"
  }
  ```

  {% /right-column %}

  {% /two-column-layout %}

{% /details %}

{% details %}
  {% summary %}
  **FunctionResultStep**

  {% /summary %}

  Result of a function tool call.

  {% two-column-layout %}
  {% left-column %}
  {% section class="api-ref-property-list" %}
  {% details %}
  {% summary %}
  **result**: {% mark %}required{% /mark %} ([`AudioContent`](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:AudioContent) or [`DocumentContent`](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:DocumentContent) or [`ImageContent`](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:ImageContent) or [`TextContent`](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:TextContent) or [`VideoContent`](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:VideoContent)) `array` or `object` or `string`

  The result of the tool call.

  {% /summary %}

  **Possible Types:** {% class="api-ref-label" %}

  {% details %}
  {% summary %}
  **([AudioContent](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:AudioContent) or [DocumentContent](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:DocumentContent) or [ImageContent](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:ImageContent) or [TextContent](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:TextContent) or [VideoContent](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:VideoContent)) array**

  {% /summary %}

  A list where each item is one of: [`AudioContent`](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:AudioContent), [`DocumentContent`](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:DocumentContent), [`ImageContent`](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:ImageContent), [`TextContent`](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:TextContent), [`VideoContent`](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:VideoContent).

  {% /details %}

  {% details %}
  {% summary %}
  **string**

  {% /summary %}

  A direct string value.

  {% /details %}

  {% /details %}

  {% hr /%}

  **call_id**: {% mark %}required{% /mark %} `string`

  ID to match the ID from the function call block.

  {% hr /%}

  **type**: {% mark %}required{% /mark %} `object`

  Value: `function_result`

  {% hr /%}

  **name**: `string`

  The name of the tool that was called.

  {% hr /%}

  **is_error**: `boolean`

  Whether the tool call resulted in an error.

  {% /section %}

  {% /left-column %}

  {% right-column class="sticky" %}
  **Example**

  **FunctionResultStep**

  ```json
  {
    "name": "get_weather",
    "type": "function_result",
    "call_id": "call_98231",
    "result": [
      {
        "type": "text",
        "text": "{\"weather\":\"sunny\"}"
      }
    ]
  }
  ```

  {% /right-column %}

  {% /two-column-layout %}

{% /details %}

{% details %}
  {% summary %}
  **GoogleMapsCallStep**

  {% /summary %}

  Google Maps call step.

  {% two-column-layout %}
  {% left-column %}
  {% section class="api-ref-property-list" %}
  **id**: {% mark %}required{% /mark %} `string`

  A unique ID for this specific tool call.

  {% hr /%}

  **type**: {% mark %}required{% /mark %} `object`

  Value: `google_maps_call`

  {% hr /%}

  {% details %}
  {% summary %}
  **arguments**: `GoogleMapsCallStepArguments`

  The arguments to pass to the Google Maps tool.

  {% /summary %}

  **queries**: `string array`

  The queries to be executed.

  {% /details %}

  {% hr /%}

  **signature**: `string`

  A signature hash for backend validation.

  {% /section %}

  {% /left-column %}

  {% right-column class="sticky" %}
  **Example**

  **GoogleMapsCallStep**

  ```json
  {
    "type": "google_maps_call",
    "arguments": {
      "latitude": 37.7749,
      "longitude": -122.4194
    },
    "id": "maps_call_39201"
  }
  ```

  {% /right-column %}

  {% /two-column-layout %}

{% /details %}

{% details %}
  {% summary %}
  **GoogleMapsResultStep**

  {% /summary %}

  Google Maps result step.

  {% two-column-layout %}
  {% left-column %}
  {% section class="api-ref-property-list" %}
  {% details %}
  {% summary %}
  **result**: {% mark %}required{% /mark %} `GoogleMapsResultItem array`

  {% /summary %}

  {% details %}
  {% summary %}
  **places**: `GoogleMapsResultPlaces array`

  {% /summary %}

  **place_id**: `string`

  **name**: `string`

  **url**: `string`

  {% details %}
  {% summary %}
  **review_snippets**: `ReviewSnippet array`

  {% /summary %}

  **title**: `string`

  Title of the review.

  **url**: `string`

  A link that corresponds to the user review on Google Maps.

  **review_id**: `string`

  The ID of the review snippet.

  {% /details %}

  {% /details %}

  **widget_context_token**: `string`

  {% /details %}

  {% hr /%}

  **call_id**: {% mark %}required{% /mark %} `string`

  ID to match the ID from the function call block.

  {% hr /%}

  **type**: {% mark %}required{% /mark %} `object`

  Value: `google_maps_result`

  {% hr /%}

  **signature**: `string`

  A signature hash for backend validation.

  {% /section %}

  {% /left-column %}

  {% right-column class="sticky" %}
  **Example**

  **GoogleMapsResultStep**

  ```json
  {
    "type": "google_maps_result",
    "call_id": "maps_call_39201",
    "result": [
      {
        "name": "Golden Gate Park",
        "place_id": "ChIJIQBpAG2ahYAR9R7bNdTLg8M",
        "rating": 4.8
      }
    ]
  }
  ```

  {% /right-column %}

  {% /two-column-layout %}

{% /details %}

{% details %}
  {% summary %}
  **GoogleSearchCallStep**

  {% /summary %}

  Google Search call step.

  {% two-column-layout %}
  {% left-column %}
  {% section class="api-ref-property-list" %}
  {% details %}
  {% summary %}
  **arguments**: {% mark %}required{% /mark %} `GoogleSearchCallStepArguments`

  The arguments to pass to Google Search.

  {% /summary %}

  **queries**: `string array`

  Web search queries for the following-up web search.

  {% /details %}

  {% hr /%}

  **id**: {% mark %}required{% /mark %} `string`

  A unique ID for this specific tool call.

  {% hr /%}

  **type**: {% mark %}required{% /mark %} `object`

  Value: `google_search_call`

  {% hr /%}

  {% details %}
  {% summary %}
  **search_type**: `string enum`

  The type of search grounding enabled.

  {% /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 %}

  {% hr /%}

  **signature**: `string`

  A signature hash for backend validation.

  {% /section %}

  {% /left-column %}

  {% right-column class="sticky" %}
  **Example**

  **GoogleSearchCallStep**

  ```json
  {
    "type": "google_search_call",
    "arguments": {
      "query": "Who won the men's 100m in Paris 2024?"
    },
    "id": "search_call_19201"
  }
  ```

  {% /right-column %}

  {% /two-column-layout %}

{% /details %}

{% details %}
  {% summary %}
  **GoogleSearchResultStep**

  {% /summary %}

  Google Search result step.

  {% two-column-layout %}
  {% left-column %}
  {% section class="api-ref-property-list" %}
  {% details %}
  {% summary %}
  **result**: {% mark %}required{% /mark %} `GoogleSearchResultItem array`

  The results of the Google Search.

  {% /summary %}

  **search_suggestions**: `string`

  Web content snippet that can be embedded in a web page or an app webview.

  {% /details %}

  {% hr /%}

  **call_id**: {% mark %}required{% /mark %} `string`

  ID to match the ID from the function call block.

  {% hr /%}

  **type**: {% mark %}required{% /mark %} `object`

  Value: `google_search_result`

  {% hr /%}

  **is_error**: `boolean`

  Whether the Google Search resulted in an error.

  {% hr /%}

  **signature**: `string`

  A signature hash for backend validation.

  {% /section %}

  {% /left-column %}

  {% right-column class="sticky" %}
  **Example**

  **GoogleSearchResultStep**

  ```json
  {
    "type": "google_search_result",
    "call_id": "search_call_19201",
    "result": [
      {
        "title": "Paris 2024 Olympics: Noah Lyles wins men's 100m gold",
        "url": "https://olympics.com/en/news/paris-2024-noah-lyles-wins-mens-100m-gold",
        "snippet": "American Noah Lyles won the Olympic men's 100m gold medal in a photo finish."
      }
    ]
  }
  ```

  {% /right-column %}

  {% /two-column-layout %}

{% /details %}

{% details %}
  {% summary %}
  **McpServerToolCallStep**

  {% /summary %}

  MCPServer tool call step.

  {% section class="api-ref-property-list" %}
  **name**: {% mark %}required{% /mark %} `string`

  The name of the tool which was called.

  {% hr /%}

  **server_name**: {% mark %}required{% /mark %} `string`

  The name of the used MCP server.

  {% hr /%}

  **arguments**: {% mark %}required{% /mark %} `object`

  The JSON object of arguments for the function.

  {% hr /%}

  **id**: {% mark %}required{% /mark %} `string`

  A unique ID for this specific tool call.

  {% hr /%}

  **type**: {% mark %}required{% /mark %} `object`

  Value: `mcp_server_tool_call`

  {% /section %}

{% /details %}

{% details %}
  {% summary %}
  **McpServerToolResultStep**

  {% /summary %}

  MCPServer tool result step.

  {% section class="api-ref-property-list" %}
  {% details %}
  {% summary %}
  **result**: {% mark %}required{% /mark %} ([`AudioContent`](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:AudioContent) or [`DocumentContent`](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:DocumentContent) or [`ImageContent`](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:ImageContent) or [`TextContent`](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:TextContent) or [`VideoContent`](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:VideoContent)) `array` or `object` or `string`

  The output from the MCP server call. Can be simple text or rich content.

  {% /summary %}

  **Possible Types:** {% class="api-ref-label" %}

  {% details %}
  {% summary %}
  **([AudioContent](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:AudioContent) or [DocumentContent](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:DocumentContent) or [ImageContent](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:ImageContent) or [TextContent](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:TextContent) or [VideoContent](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:VideoContent)) array**

  {% /summary %}

  A list where each item is one of: [`AudioContent`](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:AudioContent), [`DocumentContent`](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:DocumentContent), [`ImageContent`](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:ImageContent), [`TextContent`](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:TextContent), [`VideoContent`](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:VideoContent).

  {% /details %}

  {% details %}
  {% summary %}
  **string**

  {% /summary %}

  A direct string value.

  {% /details %}

  {% /details %}

  {% hr /%}

  **call_id**: {% mark %}required{% /mark %} `string`

  ID to match the ID from the function call block.

  {% hr /%}

  **type**: {% mark %}required{% /mark %} `object`

  Value: `mcp_server_tool_result`

  {% hr /%}

  **name**: `string`

  Name of the tool which is called for this specific tool call.

  {% hr /%}

  **server_name**: `string`

  The name of the used MCP server.

  {% /section %}

{% /details %}

{% details %}
  {% summary %}
  **ModelOutputStep**

  {% /summary %}

  Output generated by the model.

  {% two-column-layout %}
  {% left-column %}
  {% section class="api-ref-property-list" %}
  **type**: {% mark %}required{% /mark %} `object`

  Value: `model_output`

  {% hr /%}

  **content**: [`Content`](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:Content) `array`

  {% /section %}

  {% /left-column %}

  {% right-column class="sticky" %}
  **Example**

  **ModelOutputStep**

  ```json
  {
    "type": "model_output",
    "content": [
      {
        "type": "text",
        "text": "The capital of France is Paris."
      }
    ]
  }
  ```

  {% /right-column %}

  {% /two-column-layout %}

{% /details %}

{% details %}
  {% summary %}
  **ProcessingCallStep**

  {% /summary %}

  A server-initiated processing step for media analysis (e.g. video
  understanding).

  {% section class="api-ref-property-list" %}
  **id**: {% mark %}required{% /mark %} `string`

  A unique ID for this specific tool call.

  {% hr /%}

  **type**: {% mark %}required{% /mark %} `object`

  Value: `processing_call`

  {% /section %}

{% /details %}

{% details %}
  {% summary %}
  **ProcessingResultStep**

  {% /summary %}

  The result of a server-initiated media processing step.

  {% section class="api-ref-property-list" %}
  **call_id**: {% mark %}required{% /mark %} `string`

  ID to match the ID from the function call block.

  {% hr /%}

  **type**: {% mark %}required{% /mark %} `object`

  Value: `processing_result`

  {% /section %}

{% /details %}

{% details %}
  {% summary %}
  **ThoughtStep**

  {% /summary %}

  A thought step.

  {% two-column-layout %}
  {% left-column %}
  {% section class="api-ref-property-list" %}
  **type**: {% mark %}required{% /mark %} `object`

  Value: `thought`

  {% hr /%}

  **signature**: `string`

  A signature hash for backend validation.

  {% hr /%}

  **summary**: [`Content`](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:Content) `array`

  A summary of the thought.

  {% /section %}

  {% /left-column %}

  {% right-column class="sticky" %}
  **Example**

  **ThoughtStep**

  ```json
  {
    "type": "thought",
    "signature": "thought_sig_abcd1234",
    "summary": [
      {
        "type": "text",
        "text": "The model is searching Google for the capital of France."
      }
    ]
  }
  ```

  {% /right-column %}

  {% /two-column-layout %}

{% /details %}

{% details %}
  {% summary %}
  **UrlContextCallStep**

  {% /summary %}

  URL context call step.

  {% two-column-layout %}
  {% left-column %}
  {% section class="api-ref-property-list" %}
  {% details %}
  {% summary %}
  **arguments**: {% mark %}required{% /mark %} `UrlContextCallArguments`

  The arguments to pass to the URL context.

  {% /summary %}

  **urls**: `string array`

  The URLs to fetch.

  {% /details %}

  {% hr /%}

  **id**: {% mark %}required{% /mark %} `string`

  A unique ID for this specific tool call.

  {% hr /%}

  **type**: {% mark %}required{% /mark %} `object`

  Value: `url_context_call`

  {% hr /%}

  **signature**: `string`

  A signature hash for backend validation.

  {% /section %}

  {% /left-column %}

  {% right-column class="sticky" %}
  **Example**

  **UrlContextCallStep**

  ```json
  {
    "type": "url_context_call",
    "arguments": {
      "urls": [
        "https://www.example.com"
      ]
    },
    "id": "url_call_10219"
  }
  ```

  {% /right-column %}

  {% /two-column-layout %}

{% /details %}

{% details %}
  {% summary %}
  **UrlContextResultStep**

  {% /summary %}

  URL context result step.

  {% two-column-layout %}
  {% left-column %}
  {% section class="api-ref-property-list" %}
  {% details %}
  {% summary %}
  **result**: {% mark %}required{% /mark %} `UrlContextResult array`

  The results of the URL context.

  {% /summary %}

  **url**: `string`

  The URL that was fetched.

  {% details %}
  {% summary %}
  **status**: `string enum`

  The status of the URL retrieval.

  {% /summary %}

  Possible values:

  - `success`: Url retrieval is successful.
  - `error`: Url retrieval is failed due to error.
  - `paywall`: Url retrieval is failed because the content is behind paywall.
  - `unsafe`: Url retrieval is failed because the content is unsafe.

  {% /details %}

  {% /details %}

  {% hr /%}

  **call_id**: {% mark %}required{% /mark %} `string`

  ID to match the ID from the function call block.

  {% hr /%}

  **type**: {% mark %}required{% /mark %} `object`

  Value: `url_context_result`

  {% hr /%}

  **is_error**: `boolean`

  Whether the URL context resulted in an error.

  {% hr /%}

  **signature**: `string`

  A signature hash for backend validation.

  {% /section %}

  {% /left-column %}

  {% right-column class="sticky" %}
  **Example**

  **UrlContextResultStep**

  ```json
  {
    "type": "url_context_result",
    "call_id": "url_call_10219",
    "result": [
      {
        "title": "Example Domain",
        "url": "https://www.example.com",
        "snippet": "This domain is for use in illustrative examples in documents."
      }
    ]
  }
  ```

  {% /right-column %}

  {% /two-column-layout %}

{% /details %}

{% details %}
  {% summary %}
  **UserInputStep**

  {% /summary %}

  Input provided by the user.

  {% two-column-layout %}
  {% left-column %}
  {% section class="api-ref-property-list" %}
  **type**: {% mark %}required{% /mark %} `object`

  Value: `user_input`

  {% hr /%}

  **content**: [`Content`](/api-reference/interactions-api/create-interaction?api-version=v1#Resource:Content) `array`

  {% /section %}

  {% /left-column %}

  {% right-column class="sticky" %}
  **Example**

  **UserInputStep**

  ```json
  {
    "type": "user_input",
    "content": [
      {
        "type": "text",
        "text": "What is the capital of France?"
      }
    ]
  }
  ```

  {% /right-column %}

  {% /two-column-layout %}

{% /details %}

### ToolChoiceConfig  {% class="hide-from-toc" id="Resource:ToolChoiceConfig" %}

The tool choice configuration containing allowed tools.

{% two-column-layout %}
  {% left-column %}
  **Properties:**

  {% section class="api-ref-property-list" %}
  {% details %}
  {% summary %}
  **allowed_tools**: `AllowedTools`

  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 %}

  {% /section %}

  {% /left-column %}

  {% right-column class="sticky" %}
  **Example**

  ```json
  {
    "allowed_tools": {
      "mode": "any",
      "tools": [
        "my_tool"
      ]
    }
  }
  ```

  {% /right-column %}

{% /two-column-layout %}

### AudioContent  {% class="hide-from-toc" id="Resource:AudioContent" %}

An audio content block.

{% two-column-layout %}
  {% left-column %}
  **Properties:**

  {% section class="api-ref-property-list" %}
  **type**: {% mark %}required{% /mark %} `object`

  Value: `audio`

  {% hr /%}

  **data**: `string`

  The audio content.

  {% hr /%}

  **uri**: `string`

  The URI of the audio.

  {% hr /%}

  **channels**: `integer`

  The number of audio channels.

  {% hr /%}

  **sample_rate**: `integer`

  The sample rate of the audio.

  {% hr /%}

  {% details %}
  {% summary %}
  **processing**: `AudioMediaProcessing` or `string enum`

  How the model processes this audio for understanding.

  {% /summary %}

  **Possible Types:** {% class="api-ref-label" %}

  {% details %}
  {% summary %}
  **AudioMediaProcessing**

  {% /summary %}

  **type**: {% mark %}required{% /mark %} `object`

  Value: `static`

  **start_offset**: `string`

  Optional. Segment start time, relative to the start of the audio stream. Specified as a decimal number of seconds followed by an 's' suffix, e.g., "10.5s". Must be non-negative.

  **end_offset**: `string`

  Optional. Segment end time, relative to the start of the audio stream. Specified as a decimal number of seconds followed by an 's' suffix, e.g., "30s". Must be positive and greater than `start_offset` if `start_offset` is set.

  {% /details %}

  {% details %}
  {% summary %}
  **string enum**

  {% /summary %}

  Possible values:

  - `static`: All audio placed in context.

  {% /details %}

  {% /details %}

  {% hr /%}

  {% details %}
  {% summary %}
  **mime_type**: `string enum`

  The mime type of the audio.

  {% /summary %}

  Possible values:

  - `audio/wav`: WAV audio format
  - `audio/mp3`: MP3 audio format
  - `audio/aiff`: AIFF audio format
  - `audio/aac`: AAC audio format
  - `audio/ogg`: OGG audio format
  - `audio/flac`: FLAC audio format
  - `audio/mpeg`: MPEG audio format
  - `audio/m4a`: M4A audio format
  - `audio/l16`: L16 audio format
  - `audio/opus`: OPUS audio format
  - `audio/alaw`: ALAW audio format
  - `audio/mulaw`: MULAW audio format
  - `audio/webm`: WEBM audio format

  {% /details %}

  {% /section %}

  {% /left-column %}

  {% right-column class="sticky" %}
  **Example**

  **Audio**

  ```json
  {
    "type": "audio",
    "data": "BASE64_ENCODED_AUDIO",
    "mime_type": "audio/wav"
  }
  ```

  {% /right-column %}

{% /two-column-layout %}

### DocumentContent  {% class="hide-from-toc" id="Resource:DocumentContent" %}

A document content block.

{% two-column-layout %}
  {% left-column %}
  **Properties:**

  {% section class="api-ref-property-list" %}
  **type**: {% mark %}required{% /mark %} `object`

  Value: `document`

  {% hr /%}

  **data**: `string`

  The document content.

  {% hr /%}

  **uri**: `string`

  The URI of the document.

  {% hr /%}

  {% details %}
  {% summary %}
  **resolution**: `MediaResolution`

  The resolution of the media. Applicable when PAGE_IMAGE is selected in content_layers.

  {% /summary %}

  Possible values:

  - `low`: Low resolution.
  - `medium`: Medium resolution.
  - `high`: High resolution.
  - `ultra_high`: Ultra high resolution.

  {% /details %}

  {% hr /%}

  {% details %}
  {% summary %}
  **processing**: `DocumentMediaProcessing` or `string enum`

  How the model processes this document for understanding.

  {% /summary %}

  **Possible Types:** {% class="api-ref-label" %}

  {% details %}
  {% summary %}
  **DocumentMediaProcessing**

  {% /summary %}

  **type**: {% mark %}required{% /mark %} `object`

  Value: `static`

  {% details %}
  {% summary %}
  **page_options**: `PageProcessingOptions`

  Options for paginated documents. Only valid for paginated document MIME types (e.g. PDF, Office documents, and presentations).

  {% /summary %}

  **start_page**: `integer`

  Optional. 1-indexed start page, inclusive.

  **end_page**: `integer`

  Optional. 1-indexed end page, inclusive. Must be >= `start_page` if `start_page` is set.

  {% details %}
  {% summary %}
  **content_layers**: `string enum array`

  Optional. Content layers to extract from a paginated document.

  {% /summary %}

  Possible values:

  - `page_image`: A rendered image of the page.
  - `page_text`: The text of the page.

  {% /details %}

  {% /details %}

  {% details %}
  {% summary %}
  **spreadsheet_options**: `SpreadsheetProcessingOptions`

  Options for spreadsheets. Only valid for spreadsheet MIME types (.xlsx, .xls, .ods).

  {% /summary %}

  **visible_cells**: `string`

  Optional. The range of cells to extract, in A1 notation (e.g. "A1:D10"). If not set, the full occupied area of the sheet is used.

  **sheet_index**: `integer`

  Optional. The 1-indexed index of the sheet to extract, in workbook order. If not set, all sheets are extracted.

  {% details %}
  {% summary %}
  **content_layers**: `string enum array`

  Optional. Content layers to extract from a spreadsheet.

  {% /summary %}

  Possible values:

  - `visual`: A rendered image of the sheet.
  - `data`: Cell values, merges, and formats.
  - `formulas`: Formula expressions and their computed results.

  {% /details %}

  {% /details %}

  {% /details %}

  {% details %}
  {% summary %}
  **string enum**

  {% /summary %}

  Possible values:

  - `static`: All extracted pages placed in context.

  {% /details %}

  {% /details %}

  {% hr /%}

  {% details %}
  {% summary %}
  **mime_type**: `string enum`

  The mime type of the document.

  {% /summary %}

  Possible values:

  - `application/pdf`: PDF document format
  - `text/csv`: CSV document format
  - `application/vnd.openxmlformats-officedocument.presentationml.presentation`: PPTX presentation format
  - `application/vnd.ms-powerpoint`: PPT presentation format
  - `application/vnd.oasis.opendocument.presentation`: ODP presentation format
  - `application/vnd.openxmlformats-officedocument.wordprocessingml.document`: DOCX document format
  - `application/msword`: DOC document format
  - `application/vnd.openxmlformats-officedocument.wordprocessingml.template`: DOTX document template format
  - `application/vnd.oasis.opendocument.text`: ODT document format
  - `application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`: XLSX spreadsheet format
  - `application/vnd.ms-excel`: XLS spreadsheet format
  - `application/vnd.oasis.opendocument.spreadsheet`: ODS spreadsheet format

  {% /details %}

  {% /section %}

  {% /left-column %}

  {% right-column class="sticky" %}
  **Example**

  **Document**

  ```json
  {
    "type": "document",
    "data": "BASE64_ENCODED_DOCUMENT",
    "mime_type": "application/pdf"
  }
  ```

  {% /right-column %}

{% /two-column-layout %}

### Function  {% class="hide-from-toc" id="Resource:Function" %}

A tool that can be used by the model.

{% two-column-layout %}
  {% left-column %}
  **Properties:**

  {% section class="api-ref-property-list" %}
  **type**: {% mark %}required{% /mark %} `object`

  Value: `function`

  {% hr /%}

  **name**: `string`

  The name of the function.

  {% hr /%}

  **description**: `string`

  A description of the function.

  {% hr /%}

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

  {% /section %}

  {% /left-column %}

  {% right-column class="sticky" %}
  **Example**

  {% tabs %}
  {% tab label="REST" %}
  ```sh
  curl -X POST https://generativelanguage.googleapis.com/v1/interactions \
    -H "x-goog-api-key: $GEMINI_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "gemini-3.8-flash",
      "tools": [{
        "type": "function",
        "name": "get_weather",
        "description": "Get the current weather in a given location",
        "parameters": {
          "type": "object",
          "properties": {
            "location": {
              "type": "string",
              "description": "The city and state, e.g. San Francisco, CA"
            }
          },
          "required": ["location"]
        }
      }],
      "input": "What is the weather like in Boston, MA?"
    }'
  ```

  {% /tab %}

  {% tab label="Python" %}
  ```python
  from google import genai
  
  client = genai.Client()
  response = client.interactions.create(
      model="gemini-3.8-flash",
      tools=[{
          "type": "function",
          "name": "get_weather",
          "description": "Get the current weather in a given location",
          "parameters": {
              "type": "object",
              "properties": {
                  "location": {
                      "type": "string",
                      "description": (
                          "The city and state, e.g. San Francisco, CA"
                      ),
                  }
              },
              "required": ["location"],
          },
      }],
      input="What is the weather like in Boston?",
  )
  print(response.steps[-1])
  ```

  {% /tab %}

  {% tab label="JavaScript" %}
  ```javascript
  import {GoogleGenAI} from '@google/genai';
  
  const ai = new GoogleGenAI({});
  const interaction = await ai.interactions.create({
    model: 'gemini-3.8-flash',
    tools: [
      {
        type: 'function',
        name: 'get_weather',
        description: 'Get the current weather in a given location',
        parameters: {
          type: 'object',
          properties: {
            location: {
              type: 'string',
              description: 'The city and state, e.g. San Francisco, CA',
            },
          },
          required: ['location'],
        },
      },
    ],
    input: 'What is the weather like in Boston?',
  });
  console.log(interaction.steps.at(-1));
  ```

  {% /tab %}

  {% tab label="Java" %}
  ```java
  import com.google.genai.Client;
  import com.google.genai.gaos.models.interactions.CreateModelInteraction;
  import com.google.genai.gaos.models.interactions.Function;
  import com.google.genai.gaos.models.interactions.Interaction;
  import com.google.genai.gaos.models.interactions.InteractionsInput;
  import com.google.genai.gaos.models.interactions.Step;
  import com.google.genai.gaos.models.operations.CreateInteractionRequestBody;
  import com.google.genai.gaos.models.operations.CreateInteractionResponse;
  import java.util.List;
  import java.util.Map;
  
  Client client = new Client();
  Map<String, Object> parameters =
      Map.of(
          "type", "object",
          "properties",
              Map.of(
                  "location",
                  Map.of(
                      "type", "string",
                      "description", "The city and state, e.g. San Francisco, CA")),
          "required", List.of("location"));
  Function functionTool =
      Function.builder()
          .name("get_weather")
          .description("Get the current weather in a given location")
          .parameters(parameters)
          .build();
  CreateModelInteraction params =
      CreateModelInteraction.builder()
          .model("gemini-3.8-flash")
          .tools(List.of(functionTool))
          .input(InteractionsInput.of("What is the weather like in Boston?"))
          .build();
  CreateInteractionResponse response =
      client.interactions.create(CreateInteractionRequestBody.of(params));
  Interaction interaction =
      response.interaction().orElseThrow(() -> new RuntimeException("No interaction returned"));
  List<Step> steps = interaction.steps().orElse(List.of());
  if (!steps.isEmpty()) {
    System.out.println(steps.get(steps.size() - 1));
  }
  ```

  {% /tab %}

  {% tab label="Go" %}
  ```go
  package main
  
  import (
      "context"
      "fmt"
      "log"
      "google.golang.org/genai"
      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)
      }
  
      function := gaos_interactions.Function{
          Name:        genai.Ptr("get_weather"),
          Description: genai.Ptr("Get the current weather in a given location"),
          Parameters: map[string]any{
              "type": "object",
              "properties": map[string]any{
                  "location": map[string]any{
                      "type":        "string",
                      "description": "The city and state, e.g. San Francisco, CA",
                  },
              },
              "required": []string{"location"},
          },
      }
  
      tool := gaos_interactions.NewTool(function)
  
      body := operations.NewCreateInteractionRequestBody(gaos_interactions.CreateModelInteraction{
          Model: gaos_interactions.Model("gemini-3.8-flash"),
          Input: genai.Ptr(gaos_interactions.NewInteractionsInput("What is the weather like in Boston, MA?")),
          Tools: []gaos_interactions.Tool{tool},
      })
  
      req := operations.CreateInteractionRequest{
          Body: body,
      }
  
      res, err := client.Interactions.Create(ctx, req)
      if err != nil {
          log.Fatal(err)
      }
  
      if res.Interaction != nil {
          for _, step := range res.Interaction.Steps {
              if step.FunctionCallStep != nil {
                  fmt.Println("Function Call:", step.FunctionCallStep.Name)
                  fmt.Println("Arguments:", step.FunctionCallStep.Arguments)
              }
          }
      }
  }
  ```

  {% /tab %}

  {% /tabs %}

  {% /right-column %}

{% /two-column-layout %}

### ImageContent  {% class="hide-from-toc" id="Resource:ImageContent" %}

An image content block.

{% two-column-layout %}
  {% left-column %}
  **Properties:**

  {% section class="api-ref-property-list" %}
  **type**: {% mark %}required{% /mark %} `object`

  Value: `image`

  {% hr /%}

  **data**: `string`

  The image content.

  {% hr /%}

  **uri**: `string`

  The URI of the image.

  {% hr /%}

  {% details %}
  {% summary %}
  **resolution**: `MediaResolution`

  The resolution of the media.

  {% /summary %}

  Possible values:

  - `low`: Low resolution.
  - `medium`: Medium resolution.
  - `high`: High resolution.
  - `ultra_high`: Ultra high resolution.

  {% /details %}

  {% hr /%}

  {% details %}
  {% summary %}
  **mime_type**: `string enum`

  The mime type of the image.

  {% /summary %}

  Possible values:

  - `image/png`: PNG image format
  - `image/jpeg`: JPEG image format
  - `image/webp`: WebP image format
  - `image/heic`: HEIC image format
  - `image/heif`: HEIF image format
  - `image/gif`: GIF image format
  - `image/bmp`: BMP image format
  - `image/tiff`: TIFF image format

  {% /details %}

  {% /section %}

  {% /left-column %}

  {% right-column class="sticky" %}
  **Example**

  **Image**

  ```json
  {
    "type": "image",
    "data": "BASE64_ENCODED_IMAGE",
    "mime_type": "image/png"
  }
  ```

  {% /right-column %}

{% /two-column-layout %}

### TextContent  {% class="hide-from-toc" id="Resource:TextContent" %}

A text content block.

{% two-column-layout %}
  {% left-column %}
  **Properties:**

  {% section class="api-ref-property-list" %}
  **text**: {% mark %}required{% /mark %} `string`

  The text content.

  {% hr /%}

  **type**: {% mark %}required{% /mark %} `object`

  Value: `text`

  {% hr /%}

  {% details %}
  {% summary %}
  **annotations**: `Annotation array`

  Citation information for model-generated content.

  {% /summary %}

  **Possible Types:** {% class="api-ref-label" %}

  {% details %}
  {% summary %}
  **FileCitation**

  {% /summary %}

  A file citation annotation.

  **type**: {% mark %}required{% /mark %} `object`

  Value: `file_citation`

  **document_uri**: `string`

  The URI of the file.

  **file_name**: `string`

  The name of the file.

  **source**: `string`

  Source attributed for a portion of the text.

  **custom_metadata**: `object`

  User provided metadata about the retrieved context.

  **page_number**: `integer`

  Page number of the cited document, if applicable.

  **media_id**: `string`

  Media ID in-case of image citations, if applicable.

  **start_index**: `integer`

  Start of segment of the response that is attributed to this source. Index indicates the start of the segment, measured in bytes.

  **end_index**: `integer`

  End of the attributed segment, exclusive.

  {% /details %}

  {% details %}
  {% summary %}
  **PlaceCitation**

  {% /summary %}

  A place citation annotation.

  **type**: {% mark %}required{% /mark %} `object`

  Value: `place_citation`

  **place_id**: `string`

  The ID of the place, in `places/{place_id}` format.

  **name**: `string`

  Title of the place.

  **url**: `string`

  URI reference of the place.

  {% details %}
  {% summary %}
  **review_snippets**: `ReviewSnippet array`

  Snippets of reviews that are used to generate answers about the features of a given place in Google Maps.

  {% /summary %}

  **title**: `string`

  Title of the review.

  **url**: `string`

  A link that corresponds to the user review on Google Maps.

  **review_id**: `string`

  The ID of the review snippet.

  {% /details %}

  **start_index**: `integer`

  Start of segment of the response that is attributed to this source. Index indicates the start of the segment, measured in bytes.

  **end_index**: `integer`

  End of the attributed segment, exclusive.

  {% /details %}

  {% details %}
  {% summary %}
  **UrlCitation**

  {% /summary %}

  A URL citation annotation.

  **type**: {% mark %}required{% /mark %} `object`

  Value: `url_citation`

  **url**: `string`

  The URL.

  **title**: `string`

  The title of the URL.

  **start_index**: `integer`

  Start of segment of the response that is attributed to this source. Index indicates the start of the segment, measured in bytes.

  **end_index**: `integer`

  End of the attributed segment, exclusive.

  {% /details %}

  {% /details %}

  {% /section %}

  {% /left-column %}

  {% right-column class="sticky" %}
  **Example**

  **Text**

  ```json
  {
    "type": "text",
    "text": "Hello, how are you?"
  }
  ```

  {% /right-column %}

{% /two-column-layout %}

### VideoContent  {% class="hide-from-toc" id="Resource:VideoContent" %}

A video content block.

**Properties:**

{% section class="api-ref-property-list" %}
  **type**: {% mark %}required{% /mark %} `object`

  Value: `video`

  {% hr /%}

  **data**: `string`

  The video content.

  {% hr /%}

  **uri**: `string`

  The URI of the video.

  {% hr /%}

  {% details %}
  {% summary %}
  **resolution**: `MediaResolution`

  The resolution of the media.

  {% /summary %}

  Possible values:

  - `low`: Low resolution.
  - `medium`: Medium resolution.
  - `high`: High resolution.
  - `ultra_high`: Ultra high resolution.

  {% /details %}

  {% hr /%}

  {% details %}
  {% summary %}
  **processing**: `MediaProcessing` or `string enum`

  How the model processes this video for understanding.

  {% /summary %}

  **Possible Types:** {% class="api-ref-label" %}

  {% details %}
  {% summary %}
  **MediaProcessing**

  {% /summary %}

  **type**: {% mark %}required{% /mark %} `object`

  Value: `static`

  **start_offset**: `string`

  Optional. Segment start time. Specified as a decimal number of seconds followed by an 's' suffix, e.g., "10.5s". Must be non-negative.

  **end_offset**: `string`

  Optional. Segment end time. Specified as a decimal number of seconds followed by an 's' suffix, e.g., "30s". Must be non-negative and greater than `start_offset` if `start_offset` is set.

  **fps**: `number`

  Optional. Video frame-rate sampling density.

  {% details %}
  {% summary %}
  **content_layers**: `string enum array`

  Optional. Content layers to extract from the video.

  {% /summary %}

  Possible values:

  - `frames`: Frames of the video.
  - `audio`: Audio of the video.
  - `transcript`: Transcript of the audio track.

  {% /details %}

  {% /details %}

  {% details %}
  {% summary %}
  **string enum**

  {% /summary %}

  Possible values:

  - `static`: Fixed-rate frame extraction. All frames placed in context.
  - `agentic`: Model-driven dynamic navigation.

  {% /details %}

  {% /details %}

  {% hr /%}

  **name**: `string`

  A user-defined name for this content block. Can be referenced by the model in the final response.

  {% hr /%}

  {% details %}
  {% summary %}
  **mime_type**: `string enum`

  The mime type of the video.

  {% /summary %}

  Possible values:

  - `video/mp4`: MP4 video format
  - `video/mpeg`: MPEG video format
  - `video/mpg`: MPG video format
  - `video/mov`: MOV video format
  - `video/avi`: AVI video format
  - `video/x-flv`: FLV video format
  - `video/webm`: WebM video format
  - `video/wmv`: WMV video format
  - `video/3gpp`: 3GPP video format
  - `video/jpeg2000`: JPEG 2000 video format

  {% /details %}

{% /section %}

