> ## Documentation Index
> Fetch the complete documentation index at: https://developers.datagrid.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Converse

> Converse with an AI Agent



## OpenAPI

````yaml post /converse
openapi: 3.0.3
info:
  version: 0.1.1
  title: Datagrid API
  description: Datagrid API
servers:
  - url: https://api.datagrid.com/v1
security:
  - BearerAuth: []
paths:
  /converse:
    post:
      tags:
        - Converse
      summary: Converse
      description: Converse with an AI Agent
      operationId: Converse
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ConverseRequestBody'
      responses:
        '201':
          description: Converse response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConverseResponse'
        '402':
          description: >-
            Credit limit exceeded. The organization does not have enough credits
            to perform this operation. Check your billing status and add credits
            to your account.
        '404':
          description: >-
            Not found. A referenced resource (agent, conversation, knowledge, or
            page) does not exist, or the authenticated user does not have
            permission to access it.
        '413':
          description: >-
            Payload too large. The input prompt exceeds the maximum allowed
            size. Reduce the length of your prompt and try again.
        '429':
          description: >-
            Rate limit exceeded. The request has been throttled because the rate
            limit for this endpoint has been reached. Check the `Retry-After`
            response header and retry after the specified number of seconds.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RateLimitError'
      x-codeSamples:
        - lang: JavaScript
          source: >-
            import Datagrid from 'datagrid-ai';


            const client = new Datagrid({
              apiKey: process.env['DATAGRID_API_KEY'], // This is the default and can be omitted
            });


            const converseResponse = await client.converse({ prompt: 'string'
            });


            console.log(converseResponse);
        - lang: Python
          source: |-
            import os
            from datagrid_ai import Datagrid

            client = Datagrid(
                api_key=os.environ.get("DATAGRID_API_KEY"),  # This is the default and can be omitted
            )
            converse_response = client.converse(
                prompt="string",
            )
            print(converse_response)
components:
  schemas:
    ConverseRequestBody:
      type: object
      required:
        - prompt
      properties:
        prompt:
          oneOf:
            - type: string
              title: Text prompt
              description: A text prompt to send to the agent.
            - type: array
              title: Input item list
              description: |
                A list of one or many input items to the agent, containing
                different content types.
              items:
                $ref: '#/components/schemas/InputItem'
        config:
          description: >-
            Override the agent config for this converse call. This is applied as
            a partial override.
          nullable: true
          allOf:
            - $ref: '#/components/schemas/InputAgentConfig'
            - type: object
              properties:
                agent_tools:
                  $ref: '#/components/schemas/AgentTools'
                  description: Deprecated, use tools instead
                  deprecated: true
                disabled_agent_tools:
                  $ref: '#/components/schemas/AgentTools'
                  description: >-
                    Deprecated, use disabled_tools instead. If not provided - no
                    tools are disabled.
                  deprecated: true
                  nullable: true
                mcp_servers:
                  type: array
                  description: >
                    **BETA**: This feature is in beta and the schema may change.


                    Array of MCP (Model Context Protocol) server configurations
                    to enable for this converse call.

                    Each MCP server provides additional tools that the agent can
                    use during the conversation.


                    Datagrid handles the full MCP lifecycle automatically:
                    `initialize`,

                    `notifications/initialized`, then `tools/list` /
                    `tools/call` with

                    `MCP-Session-Id` and `MCP-Protocol-Version` headers.
                  nullable: true
                  items:
                    $ref: '#/components/schemas/InputMcpServer'
        agent_id:
          type: string
          description: >-
            The ID of the agent that should be used for the converse. When
            omitted and a `conversation_id` is provided, the conversation's
            existing agent assignments are preserved. When omitted without a
            `conversation_id`, a new conversation is created with the default
            agent.
          nullable: true
        agent_routing:
          description: >-
            Controls how the API selects which agent to use when routing is
            needed. This field is mutually exclusive with `agent_id`. When both
            `agent_id` and `agent_routing` are omitted and a `conversation_id`
            is provided, the conversation's existing agent assignments are
            preserved.
          nullable: true
          allOf:
            - $ref: '#/components/schemas/AgentRouting'
        conversation_id:
          type: string
          description: >-
            The ID of the present conversation to use. If it's not provided - a
            new conversation will be created.
          nullable: true
        stream:
          type: boolean
          description: >-
            Determines the response type of the converse. Response is the
            Server-Sent Events if stream is set to true.
          default: false
          nullable: true
        generate_citations:
          type: boolean
          description: >-
            Determines whether the response should include citations. When
            enabled, the agent will generate citations for factual statements.
          default: false
          nullable: true
        generate_title:
          type: boolean
          description: >-
            Determines whether generated_title metadata should be included.
            Defaults to false. generated_title is emitted only when this flag is
            explicitly true.
          default: false
          nullable: true
        include_steps:
          type: boolean
          description: >-
            When set to false, tool call and reasoning step events are omitted
            from SSE streams. Non-streaming responses always include the
            tool_calls and reasoning fields (as null when empty).
          default: true
          nullable: true
        chat_mode:
          type: string
          description: >-
            Controls how the agent processes the request for this turn. Matches
            the chat mode selector in the Datagrid web app: **Execute**
            (`full_agent`), **Extended** (`light_agent`), **Ask**
            (`llm_router`). When set to `auto`, the router jointly predicts the
            best agent and concrete mode (`full_agent` / `light_agent` /
            `llm_router`) per message. When set to a concrete mode, that mode is
            used directly. When omitted, the mode is determined by the
            `agent_model` in `config`.
          nullable: true
          enum:
            - auto
            - full_agent
            - light_agent
            - llm_router
        secret_ids:
          type: array
          description: >-
            Array of secret ID's to be included in the context. The secret value
            will be appended to the prompt but not stored in conversation
            history.
          items:
            type: string
          nullable: true
        text:
          type: object
          description: >
            Contains the format property used to specify the structured output
            schema (`text.format`).

            Structured output is supported for all `agent_model` values and
            `chat_mode` settings when `text.format` is provided (same JSON
            Schema mechanism everywhere). **Ask** in the web app maps to
            `chat_mode` `magpie-2.5-flash`;.
          nullable: true
          properties:
            format:
              type: object
              description: >
                The converse response will be a JSON string object, that adheres
                to the provided JSON schema.


                ```javascript

                const exampleJsonSchema = {
                  $id: "movie_info",
                  title: "movie_info",
                  type: "object",
                  properties: {
                    name: {
                      type: "string",
                      description: "The name of the movie",
                    },
                    director: {
                      type: "string",
                      description: "The director of the movie",
                    },
                    release_year: {
                      type: "number",
                      description: "The year the movie was released",
                    },
                  },
                  required: ["name", "director", "release_year"],
                  additionalProperties: false,
                };


                const response = await datagrid.converse({
                  prompt: "What movie won best picture at the 2001 oscars?",
                  text: { format: exampleJsonSchema },
                });


                // Example response: "{ "name": "Gladiator", "director": "Ridley
                Scott", "release_year": 2000 }"

                const parsedResponse = JSON.parse(response.content[0].text);

                ```
        user:
          description: >-
            Override user information for this converse call. This allows you to
            override the first_name, last_name, and email that will be used in
            the conversation context.
          nullable: true
          allOf:
            - $ref: '#/components/schemas/UserOverride'
        current_view_content:
          type: string
          description: >-
            A datagrid file URI pointing to content the user is currently
            viewing on screen (e.g., a web page, document, or dashboard rendered
            as markdown). The agent uses this context to resolve ambiguous
            queries like 'what is this about?' or 'review this'. The content is
            automatically summarized and made available to the agent.
          nullable: true
        reference_date:
          type: string
          format: date
          pattern: ^[0-9]{4}-[0-9]{2}-[0-9]{2}$
          description: >-
            Optional deterministic reference date override in YYYY-MM-DD format.
            Must be a real calendar date (for example, rejects impossible dates
            like 2026-02-31). When set, the agent treats this date as today for
            relative date resolution and date context rendering.
          nullable: true
    ConverseResponse:
      allOf:
        - $ref: '#/components/schemas/ConversationMessage'
        - type: object
          properties:
            chat_mode:
              type: string
              description: >-
                The chat mode used for this response (web app: Execute =
                full_agent, Extended = light_agent, Ask = llm_router). For Auto
                mode conversations, this is the mode selected by the router for
                this turn.
              nullable: true
              enum:
                - full_agent
                - light_agent
                - llm_router
            generated_title:
              type: string
              description: >-
                Auto-generated conversation title for this turn. Null when title
                generation does not run or fails.
              nullable: true
            tool_calls:
              type: array
              description: Array of tool calls that were executed during this response.
              nullable: true
              items:
                allOf:
                  - $ref: '#/components/schemas/ConverseToolCallDelta'
                  - type: object
                    properties:
                      executed_in_parallel:
                        type: boolean
                        description: >-
                          Whether this tool call was executed in parallel with
                          other tool calls.
            reasoning:
              type: array
              description: >-
                Array of reasoning steps that occurred during this response.
                Only includes steps with status completed or failed.
              nullable: true
              items:
                $ref: '#/components/schemas/ConverseReasoningDelta'
    RateLimitError:
      type: object
      description: >-
        Returned when the rate limit is exceeded. Rate limits are enforced per
        teamspace, endpoint path, and HTTP method over a 60-second sliding
        window. Each endpoint may have its own limit — check the
        X-RateLimit-Limit response header for the effective value.
      required:
        - error
        - message
        - retryable
        - status_code
      properties:
        status_code:
          type: integer
          description: The HTTP status code (429).
        statusCode:
          type: integer
          deprecated: true
          description: Deprecated. Use status_code instead.
        error:
          type: string
          enum:
            - rate_limit_exceeded
          description: The error code identifying this as a rate limit error.
        message:
          type: string
          description: A human-readable error message.
        mitigation:
          type: string
          description: Suggested action to resolve the error.
        retryable:
          type: boolean
          description: Whether the request can be retried after a delay.
        details:
          type: object
          properties:
            reason:
              type: string
              description: A detailed explanation of why the rate limit was exceeded.
    InputItem:
      type: object
      title: Input message
      description: >
        A message input to the model with a role indicating instruction
        following `agent` role are presumed to have been generated by the model
        in previous interactions.
      properties:
        type:
          type: string
          description: |
            The type of the message input. Always `message`.
          enum:
            - message
          x-stainless-const: true
        role:
          type: string
          description: |
            The role of the message input. Always `user`.
          enum:
            - user
        content:
          description: |
            Text, file or secret input to the agent.
          oneOf:
            - type: string
              title: Text input
              description: |
                A text input to the agent.
            - $ref: '#/components/schemas/InputMessageContentList'
      required:
        - role
        - content
    InputAgentConfig:
      allOf:
        - $ref: '#/components/schemas/AgentInputConfigCommon'
        - type: object
          properties:
            mcp_servers:
              type: array
              items:
                $ref: '#/components/schemas/AgentMcpServerConfig'
              description: Registered MCP servers to enable for this agent.
              nullable: true
    AgentTools:
      description: >
        Array of the agent tools to enable. If not provided, or null is provided
        - default tools of the agent are used. If empty list provided - none of
        the tools are used. When connection_id is set for a tool, it will use
        that specific connection instead of the default one.


        **Structured outputs (Converse):** All `agent_model` values support JSON
        Schema constrained responses via **`text.format`** on the Converse
        request.


        **Tool availability by agent model** (aligned with in-app **Execute** /
        **Extended** / direct LLM; see Converse `chat_mode` for **Ask** vs
        `agent_model`):

        - **Execute** (`magpie-2.0`, `magpie-2.5`, `magpie-1.1`): All tools
        below are available.

        - **Extended** (`magpie-1.1-flash`): Only `semantic_search` is
        supported. Requests specifying other tools will be rejected with a 400
        error.

        - **Direct LLM** (`llm-only`): No tools are executed. Requests
        specifying tools will be rejected with a 400 error.


        Knowledge management tools:

        - data_analysis: Answer statistical or analytical questions like "Show
        my quarterly revenue growth"

        - semantic_search: Search knowledge through natural language queries.

        - agent_memory: Agents can remember experiences, conversations and user
        preferences.

        - schema_info: Helps the Agent understand column names and dataset
        purpose. Avoid disabling

        - table_info: Allow the AI Agent to get information about datasets and
        schemas

        - create_dataset: Agents respond with data tables

        - charts: Agents render charts inline in the conversation (bar, line,
        area, combo, pie, funnel, gauge, treemap, scorecard).


        Actions:

        - calendar: Allow the Agent to access and make changes to your Google
        Calendar

        - schedule_recurring_message_tool: Eliminate busywork such as: "Send a
        summary of today's meetings at 5pm on workdays"


        Data processing tools:

        - data_classification: Agents handle queries like "Label these emails as
        high, medium, or low priority"

        - data_extraction: Helps the agent understand data from other tools.
        Avoid disabling

        - image_detection: Extract information from images using AI

        - pdf_extraction: Extraction of information from PDFs using AI


        Enhanced response tools:

        - connect_data: Agents provide buttons to import data in response to
        queries like "Connect Hubspot"

        - download_data: Agents handle queries like "download the table as CSV"


        Web tools:

        - web_search: Agents search the internet, and provide links to their
        sources

        - fetch_url: Fetch URL content

        - company_prospect_researcher: Agents provide information about
        companies

        - people_prospect_researcher: Agents provide information about people
      type: array
      nullable: true
      items:
        oneOf:
          - $ref: '#/components/schemas/ToolName'
          - $ref: '#/components/schemas/Tool'
    InputMcpServer:
      type: object
      description: >
        Configuration for an MCP (Model Context Protocol) server passed directly
        in the request.

        MCP servers provide additional tools that extend the agent's
        capabilities.

        Servers must implement the MCP streamable HTTP transport, including
        `initialize`,

        `notifications/initialized`, `tools/list`, and `tools/call`.
      required:
        - type
        - server_label
        - server_url
      properties:
        type:
          type: string
          enum:
            - inline_mcp
          description: >-
            The type of MCP server configuration. Use 'inline_mcp' for server
            configs passed directly in the request.
          x-stainless-const: true
        server_label:
          type: string
          description: >-
            A unique label to identify this MCP server. Used for tool
            namespacing.
          maxLength: 64
        server_url:
          type: string
          format: uri
          description: The HTTPS URL of the MCP streamable HTTP endpoint.
        server_description:
          type: string
          description: Optional description of what this MCP server provides.
          nullable: true
          maxLength: 500
        authorization:
          type: string
          description: >-
            Value sent in the `Authorization` header when calling the MCP server
            (e.g., 'Bearer <token>').
          nullable: true
    AgentRouting:
      type: object
      description: Determines how the API routes the converse request to an agent.
      discriminator:
        propertyName: mode
      oneOf:
        - type: object
          title: Auto routing
          description: >-
            The API automatically selects the best agent from the entire
            Teamspace.
          required:
            - mode
          properties:
            mode:
              type: string
              enum:
                - auto
              description: The API selects the best agent from the entire Teamspace.
        - type: object
          title: Manual routing
          description: The API selects the best agent from the specific list you provide.
          required:
            - mode
            - targets
          properties:
            mode:
              type: string
              enum:
                - manual
              description: >-
                The API selects the best agent from the specific list you
                provide.
            targets:
              type: array
              minItems: 1
              description: >-
                Limit the selection pool to these specific agents. Each item may
                be an agent ID string or an inline agent config object.
              items:
                oneOf:
                  - type: string
                    description: Agent ID string
                  - $ref: '#/components/schemas/AgentConfigWithId'
    UserOverride:
      type: object
      description: >-
        User information override for converse calls. All fields are optional -
        only provided fields will override the default user information.
      properties:
        first_name:
          type: string
          description: Override the user's first name for this converse call.
          nullable: true
        last_name:
          type: string
          description: Override the user's last name for this converse call.
          nullable: true
        email:
          type: string
          description: Override the user's email for this converse call.
          nullable: true
    ConversationMessage:
      type: object
      description: >-
        The `conversation.message` object represents a message in a
        conversation.
      required:
        - object
        - id
        - agent_id
        - role
        - content
        - created_at
        - conversation_id
        - credits
        - citations
      properties:
        object:
          type: string
          enum:
            - conversation.message
          description: The object type, which is always `conversation.message`.
        id:
          type: string
          description: The message identifier.
        agent_id:
          type: string
          description: The ID of the agent that sent or responded to the message.
        role:
          type: string
          enum:
            - user
            - agent
          description: The role of the message sender - either 'user' or 'agent'.
        content:
          type: array
          description: Contents of the message.
          items:
            oneOf:
              - $ref: '#/components/schemas/MessageContentText'
              - $ref: '#/components/schemas/MessageContentVoice'
              - $ref: '#/components/schemas/MessageContentFile'
            discriminator:
              propertyName: type
              mapping:
                text:
                  $ref: '#/components/schemas/MessageContentText'
                voice:
                  $ref: '#/components/schemas/MessageContentVoice'
                input_file:
                  $ref: '#/components/schemas/MessageContentFile'
        created_at:
          type: string
          format: date-time
          description: The ISO string for when the message was created.
        conversation_id:
          type: string
          description: The ID of the conversation the message belongs to.
        credits:
          nullable: true
          description: >-
            Credit consumption for this converse turn. `null` for user-role
            messages and when retrieving messages from conversation history.
          allOf:
            - $ref: '#/components/schemas/OperationCredits'
        citations:
          $ref: '#/components/schemas/Citations'
          nullable: true
    ConverseToolCallDelta:
      type: object
      description: >
        Event emitted when tools are called during the agent's reasoning
        process.
      required:
        - type
        - id
        - status
        - tool
      properties:
        type:
          type: string
          enum:
            - tool_call
        id:
          type: string
          description: The ID of the tool call.
        status:
          type: string
          enum:
            - in_progress
            - completed
            - failed
        tool:
          $ref: '#/components/schemas/ToolDef'
        output:
          type: string
          description: The output of the tool call.
    ConverseReasoningDelta:
      type: object
      required:
        - id
        - status
        - type
      properties:
        id:
          type: string
          description: The ID of the reasoning step.
        status:
          type: string
          enum:
            - in_progress
            - completed
            - failed
          description: The current status of the reasoning step.
        type:
          type: string
          enum:
            - reasoning
          description: The type of the delta, which is always reasoning.
        task:
          type: string
          description: The task description for this reasoning step.
          nullable: true
        output:
          type: string
          description: >-
            The output of the reasoning step. Only present when status is
            completed or failed.
          nullable: true
        execution_time_ms:
          type: number
          description: The execution time of the reasoning step in milliseconds.
          nullable: true
        executed_in_parallel:
          type: boolean
          description: >-
            Whether this reasoning step was executed in parallel with other
            steps.
          nullable: true
    InputMessageContentList:
      type: array
      title: Input item content list
      description: >
        A list of one or many input items to the model, containing different
        content types.
      items:
        $ref: '#/components/schemas/InputContent'
    AgentInputConfigCommon:
      allOf:
        - $ref: '#/components/schemas/AgentConfigShared'
        - type: object
          properties:
            tools:
              $ref: '#/components/schemas/AgentTools'
              nullable: true
            disabled_tools:
              $ref: '#/components/schemas/AgentTools'
              description: >-
                Array of the agent tools to disable. Disabling is performed
                after the 'agent_tools' rules are applied. For example,
                agent_tools: null and disabled_tools: [data_analysis] will
                enable everything but the data_analysis tool. If nothing or []
                is provided, nothing is disabled and therefore only the
                agent_tools setting is relevant.
              nullable: true
            llm_model:
              $ref: '#/components/schemas/LlmModel'
              nullable: true
            temperature:
              type: number
              description: >-
                Sampling temperature for model output. Lower values are more
                deterministic; higher values are more diverse.
              minimum: 0
              maximum: 1
              nullable: true
            agent_model:
              $ref: '#/components/schemas/AgentModel'
              nullable: true
    AgentMcpServerConfig:
      type: object
      required:
        - server_id
      properties:
        server_id:
          type: string
        credential_id:
          type: string
          nullable: true
    ToolName:
      type: string
      description: The unique identifier for a tool.
    Tool:
      type: object
      required:
        - name
      properties:
        name:
          $ref: '#/components/schemas/ToolName'
        connection_id:
          type: string
          description: The ID of the connection to use for the tool.
          nullable: true
    AgentConfigWithId:
      allOf:
        - type: object
          properties:
            agent_id:
              type: string
              description: The ID of the agent to use for routing.
        - $ref: '#/components/schemas/InputAgentConfig'
    MessageContentText:
      type: object
      description: Text content for a message.
      required:
        - type
        - text
      properties:
        type:
          type: string
          enum:
            - text
          x-stainless-const: true
        text:
          type: string
          description: The text content of the message.
    MessageContentVoice:
      type: object
      description: Voice content for a message.
      required:
        - type
        - audio_clips
        - transcript
        - duration_ms
      properties:
        type:
          type: string
          enum:
            - voice
          x-stainless-const: true
        audio_clips:
          type: array
          description: Array of audio clips with timestamps for synchronized playback.
          items:
            $ref: '#/components/schemas/VoiceAudioClip'
        transcript:
          type: string
          description: User transcript of the voice message.
        agent_transcript:
          type: string
          description: Agent transcript of the voice message (for agent role messages).
          nullable: true
        duration_ms:
          type: number
          description: Total duration of the voice message in milliseconds.
          nullable: true
        timeline_events:
          type: array
          description: >-
            Per-turn transcript, citation, and tool-call status events in
            chronological order. Each entry includes a timestamp offset from the
            start of the voice session. Present only for voice sessions that
            recorded timeline data.
          items:
            $ref: '#/components/schemas/VoiceTimelineEvent'
    MessageContentFile:
      type: object
      description: >-
        File attachment content for a message. Represents a file that was
        uploaded as part of the user's message.
      required:
        - type
        - file_id
      properties:
        type:
          type: string
          enum:
            - input_file
          x-stainless-const: true
        file_id:
          type: string
          description: >-
            The ID of the attached file. Use this ID with the files API to
            download the file content.
    OperationCredits:
      type: object
      required:
        - consumed
      properties:
        consumed:
          type: number
          description: The number of credits consumed by the operation.
    Citations:
      type: array
      description: >-
        Array of citations that provide sources for factual statements in the
        response. Each citation includes the referenced text and its sources.
      items:
        type: object
        required:
          - citation
          - sources
        properties:
          citation:
            type: string
            description: The text snippet from the response that is being cited.
          sources:
            type: array
            description: Array of sources that support this citation.
            items:
              $ref: '#/components/schemas/CitationSource'
    ToolDef:
      type: object
      description: The `Tool` object represents a tool that can be used by agents.
      required:
        - object
        - name
        - label
        - description
      properties:
        object:
          type: string
          enum:
            - tool
          description: The object type, which is always `tool`.
        name:
          type: string
          description: The unique identifier name used to reference the tool.
        label:
          type: string
          description: The display name of the tool.
        description:
          type: string
          description: A detailed description of what the tool does.
    InputContent:
      oneOf:
        - $ref: '#/components/schemas/InputText'
        - $ref: '#/components/schemas/InputFile'
        - $ref: '#/components/schemas/InputSecret'
        - $ref: '#/components/schemas/InputKnowledge'
        - $ref: '#/components/schemas/InputPage'
    AgentConfigShared:
      type: object
      properties:
        knowledge_ids:
          type: array
          nullable: true
          deprecated: true
          description: >-
            Deprecated, use corpus instead. Array of Knowledge IDs the agent
            should use during the converse. When omitted, all knowledge is used.
          items:
            type: string
        corpus:
          type: array
          nullable: true
          description: >-
            Array of corpus items the agent should use during the converse. When
            omitted, all knowledge is used.
          items:
            oneOf:
              - $ref: '#/components/schemas/CorpusKnowledgeItem'
              - $ref: '#/components/schemas/CorpusPageItem'
        system_prompt:
          type: string
          description: Directs your AI Agent's operational behavior.
          nullable: true
        custom_prompt:
          type: string
          description: >-
            Use custom prompt to instruct the style and formatting of the
            agent's response
          nullable: true
        planning_prompt:
          type: string
          description: >-
            Define the planning strategy your AI Agent should use when breaking
            down tasks and solving problems
          nullable: true
    LlmModel:
      anyOf:
        - $ref: '#/components/schemas/LlmModelEnum'
        - type: string
      default: gemini-2.5-flash
      description: >-
        The LLM used to generate responses. Deprecated Gemini 2.0 Flash ids are
        accepted for backward compatibility and automatically run as
        gemini-3.1-flash-lite.
    AgentModel:
      anyOf:
        - $ref: '#/components/schemas/AgentModelEnum'
        - type: string
      type: string
      enum:
        - magpie-1.1
        - magpie-1.1-flash
        - magpie-2.0
        - magpie-2.5
        - magpie-2.5-flash
        - llm-only
      default: magpie-2.0
      description: >
        The agent model determines the processing mode for Converse requests.
        The Datagrid web app exposes **Ask**, **Extended**, and **Execute** as
        Converse **`chat_mode`** (`llm_router`, `light_agent`, `full_agent`).
        The values below set **`config.agent_model`** (model tier and tool
        limits)—use both fields when mirroring in-app behavior.


        **Execute** (full tool use, planning, and multi-step reasoning; aligns
        with **Execute** in the web app / `full_agent`):

        - `magpie-2.0` — Default. Full agent model with proactive planning and
        reasoning.

        - `magpie-2.5` — Beta. Latest full-agent model — faster, more adaptable,
        and built to handle a broader range of real-world tasks.

        - `magpie-1.1` — Previous-generation full agent model.


        **Extended** (search-focused; aligns with **Extended** in the web app /
        `light_agent`; not **Ask**):

        - `magpie-1.1-flash` — Fast model optimized for RAG use cases. Only
        supports the `semantic_search` tool. A 400 error will be returned if
        other tools are specified.


        **Direct LLM** (no tool execution; **`agent_model` only**—**Ask** in the
        web app is `chat_mode: llm_router`, not `magpie-1.1-flash`):

        - `llm-only` — Runs a direct LLM conversation with no planning or tool
        calls. A 400 error will be returned if tools are specified.


        Can also accept any custom string value for future model versions.
      nullable: true
    VoiceAudioClip:
      type: object
      description: A single audio clip from a voice message.
      required:
        - id
        - audio_uri
        - start_time_ms
        - duration_ms
        - participant
      properties:
        id:
          type: string
          description: >-
            Unique identifier for the audio clip file. Use this ID with the
            files API to download the audio content.
        audio_uri:
          type: string
          description: Datagrid file URI for the audio file (WAV format).
        start_time_ms:
          type: number
          description: >-
            Start time of this clip relative to the beginning of the voice
            message, in milliseconds.
        duration_ms:
          type: number
          description: Duration of this audio clip in milliseconds.
        participant:
          type: object
          description: Participant who spoke in this clip.
          required:
            - type
            - id
          properties:
            type:
              type: string
              enum:
                - user
                - agent
            id:
              type: string
    VoiceTimelineEvent:
      type: object
      description: >-
        A single event from a voice session timeline, representing a transcript
        turn, citation, or tool-call status update.
      required:
        - type
        - timestamp_ms
      properties:
        type:
          type: string
          enum:
            - transcript
            - citation
            - tool_call_status
          description: The type of timeline event.
        timestamp_ms:
          type: number
          description: >-
            Timestamp offset from the start of the voice session, in
            milliseconds.
        role:
          type: string
          enum:
            - user
            - agent
          description: The role of the participant for this event.
        text:
          type: string
          description: >-
            Plain text transcript for this turn. Present when type is
            'transcript'.
        citations:
          $ref: '#/components/schemas/Citations'
          description: Citations for this event. Present when type is 'citation'.
        tool_name:
          type: string
          description: >-
            Name of the tool whose status changed. Present when type is
            'tool_call_status'.
        status:
          type: string
          enum:
            - started
            - completed
            - failed
          description: >-
            Tool-call status for this event. Present when type is
            'tool_call_status'.
    CitationSource:
      type: object
      required:
        - type
        - source_name
        - confirmations
      properties:
        type:
          type: string
          enum:
            - image
            - pdf_page
            - record
            - web_search
            - sql_query_result
            - action
        source_id:
          type: string
          description: Id of the source.
        source_name:
          type: string
          description: Name of the source.
        source_uri:
          type: string
          description: URI of the source.
        confirmations:
          type: array
          description: An array of text snippets from the source that confirm the citation.
          items:
            type: string
    InputText:
      type: object
      title: Text input
      description: |
        A text input to the model.
      properties:
        type:
          type: string
          description: |
            The type of the input item. Always `input_text`.
          enum:
            - input_text
          x-stainless-const: true
        text:
          type: string
          description: |
            The text input to the model.
      required:
        - type
        - text
    InputFile:
      type: object
      title: File input
      description: |
        A file input to the model.
      properties:
        type:
          type: string
          description: |
            The type of the input item. Always `input_file`.
          enum:
            - input_file
          x-stainless-const: true
        file_id:
          type: string
          description: |
            The ID of the file to be sent to the model.
      required:
        - type
        - file_id
    InputSecret:
      type: object
      title: Secret input
      description: |
        A secret input to the model.
      properties:
        type:
          type: string
          description: |
            The type of the input item. Always `input_secret`.
          enum:
            - input_secret
          x-stainless-const: true
        secret_id:
          type: string
          description: |
            The ID of the secret to be sent to the model.
      required:
        - type
        - secret_id
    InputKnowledge:
      type: object
      title: Knowledge input
      description: >
        A knowledge reference input to the model. This references knowledge by
        ID. The knowledge will be made accessible to the agent, and will be
        included in the prompt provided to the agent. The position of this
        reference relative to other text of the input impact the agent's
        interpretation.
      properties:
        type:
          type: string
          description: |
            The type of the input item. Always `input_knowledge`.
          enum:
            - input_knowledge
          x-stainless-const: true
        knowledge_id:
          type: string
          description: |
            The ID of the knowledge to be referenced.
      required:
        - type
        - knowledge_id
    InputPage:
      type: object
      title: Page input
      description: >
        A page reference input to the model. This references a page by ID. The
        page, and all knowledge under it, will be made accessible to the agent,
        and a reference to the page will be included in the prompt provided to
        the agent. The position of this reference relative to other text of the
        input will impact the agent's interpretation.
      properties:
        type:
          type: string
          description: |
            The type of the input item. Always `input_page`.
          enum:
            - input_page
          x-stainless-const: true
        page_id:
          type: string
          description: |
            The ID of the page to be referenced.
      required:
        - type
        - page_id
    CorpusKnowledgeItem:
      type: object
      required:
        - type
        - knowledge_id
      properties:
        type:
          type: string
          enum:
            - knowledge
          description: The type of the corpus item. Always 'knowledge' for knowledge items.
          x-stainless-const: true
        knowledge_id:
          type: string
          description: The ID of the knowledge to include in the corpus.
    CorpusPageItem:
      type: object
      required:
        - type
        - page_id
      properties:
        type:
          type: string
          enum:
            - page
          description: The type of the corpus item. Always 'page' for page items.
          x-stainless-const: true
        page_id:
          type: string
          description: The ID of the page to include in the corpus.
    LlmModelEnum:
      type: string
      description: >-
        The LLM used to generate responses. Deprecated Gemini 2.0 Flash ids are
        accepted for backward compatibility and automatically run as
        gemini-3.1-flash-lite.
      enum:
        - gemini-3.5-flash
        - gemini-3.1-flash-lite
        - gemini-3-pro-preview
        - gemini-3.1-pro-preview
        - gemini-3-flash-preview
        - gemini-2.5-pro
        - gemini-2.5-pro-preview-05-06
        - gemini-2.5-flash
        - gemini-2.5-flash-preview-04-17
        - gemini-2.5-flash-native-audio-preview-12-2025
        - gemini-2.5-flash-lite
        - gpt-5
        - gpt-5.1
        - gemini-2.0-flash-001
        - gemini-2.0-flash
        - gemini-1.5-pro-001
        - gemini-1.5-pro-002
        - gemini-1.5-flash-002
        - gemini-1.5-flash-001
        - chatgpt-4o-latest
        - gpt-4o
        - gpt-4
        - gpt-4-turbo
        - gpt-4o-mini
        - claude-haiku-4-5@20251001
        - claude-sonnet-4-6@default
        - claude-opus-4-6@default
        - claude-opus-4-7
        - claude-opus-4-8
        - anthropic.claude-haiku-4-5-20251001-v1:0
        - anthropic.claude-sonnet-4-6
        - anthropic.claude-opus-4-6-v1
        - anthropic.claude-opus-4-7
        - anthropic.claude-opus-4-8
    AgentModelEnum:
      type: string
      enum:
        - magpie-1.1
        - magpie-1.1-flash
        - magpie-2.0
        - magpie-2.5
        - magpie-2.5-flash
        - llm-only
      description: Predefined agent model versions
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer

````