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

# Update Agent

> Update an existing agent — only provided fields are modified

## Overview

Update an existing agent's configuration. Only the fields you provide will be updated — all other settings remain unchanged.

If `prompt_content` is provided, a new version of the agent's internal prompt is automatically created.
If `call_analysis_prompt.custom_prompt` is provided, a new version of the analysis prompt is automatically created before the agent is updated.

Only send `call_analysis_enabled`, `call_analysis_prompt`, and `call_analysis_schema` when you explicitly want to configure call analysis. If `call_analysis_enabled` is `true`, provide `call_analysis_prompt` as well.

### Try It Behavior

In `Try it`, `llm` is shown as a single object.

* For standard providers, fill `llm.params.temperature` only.
* For `CUSTOM_LLM`, fill `llm.params.base_url`, `llm.params.api_key`, and optionally `llm.params.API_TYPE`.

## Authentication

<ParamField header="X-API-Key" type="string" required>
  Your eigi.ai API key. Must be prefixed with `vk_`.
</ParamField>

## Path Parameters

<ParamField path="agent_id" type="string" required>
  The unique agent ID to update.

  Example: `68ea2517dbb84c09bae1ba0a`
</ParamField>

## Request Body

All fields are optional. Only provided fields will be updated.

| Provider | Allowed params                                                                                                                              |
| -------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
| **STT**  | No params allowed (must be empty `{}`)                                                                                                      |
| **STS**  | No public API param restrictions                                                                                                            |
| **LLM**  | Standard providers: only `temperature` (0.0 - 2.0). `CUSTOM_LLM`: requires `base_url` plus `api_key`; optional `API_TYPE` and `temperature` |
| **TTS**  | Only `speed`                                                                                                                                |

<ParamField body="agent_name" type="string">
  Updated agent name (1-100 characters).
</ParamField>

<ParamField body="agent_description" type="string">
  Updated description (max 500 characters).
</ParamField>

<ParamField body="agent_type" type="string">
  `INBOUND` or `OUTBOUND`.
</ParamField>

<ParamField body="agent_category" type="string">
  Updated category.
</ParamField>

<ParamField body="agent_tips" type="array">
  Updated array of usage tip strings for the agent.
</ParamField>

<ParamField body="agent_mobile_number" type="array">
  Updated mobile numbers associated with the agent.
</ParamField>

<ParamField body="stt" type="object">
  Updated STT configuration (no params allowed).

  <Expandable title="properties">
    <ParamField body="provider_name" type="string" required>
      STT provider: `DEEPGRAM`, `OPENAI`, `WHISPER`, or `GROK`.
    </ParamField>

    <ParamField body="model_name" type="string" required>
      Model name for the STT provider.
    </ParamField>

    <ParamField body="language" type="string" required>
      Language code.
    </ParamField>

    <ParamField body="params" type="object">
      Must be empty `{}` for public API requests.
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="llm" type="object">
  Updated LLM configuration. Standard providers only allow `temperature`. `CUSTOM_LLM` requires `base_url` plus `api_key`, and optionally accepts `API_TYPE` and `temperature`.

  <Expandable title="properties">
    <ParamField body="provider_name" type="string" required>
      LLM provider: `OPENAI`, `OPENAI_RESPONSES`, `ANTHROPIC`, `GOOGLE`, `GROK`, `OPENROUTER`, or `CUSTOM_LLM`.
    </ParamField>

    <ParamField body="model_name" type="string" required>
      Model name for the LLM provider.
    </ParamField>

    <ParamField body="params" type="object">
      For standard LLM providers, only `temperature` (0.0-2.0) is allowed. For `CUSTOM_LLM`, provide `base_url`, `api_key`, and optionally `API_TYPE` (`CHAT_COMPLETION` or `RESPONSES`) and `temperature`. If `API_TYPE` is omitted, it defaults to `CHAT_COMPLETION`.
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="tts" type="object">
  Updated TTS configuration (only `speed` param allowed).

  <Expandable title="properties">
    <ParamField body="provider_name" type="string" required>
      TTS provider: `CARTESIA`, `DEEPGRAM`, `ELEVENLABS`, `SARVAM`, `GOOGLE`, `HUME`, or `GROK`.
    </ParamField>

    <ParamField body="model_name" type="string" required>
      Model name for the TTS provider.
    </ParamField>

    <ParamField body="language" type="string" required>
      Language code.
    </ParamField>

    <ParamField body="voice_id" type="string" required>
      Voice ID for the TTS provider.
    </ParamField>

    <ParamField body="params" type="object">
      Only `speed` is allowed.
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="sts" type="object">
  Updated Speech-to-Speech configuration.

  <Expandable title="properties">
    <ParamField body="speech_to_speech_enabled" type="boolean">
      Whether speech-to-speech is enabled.
    </ParamField>

    <ParamField body="provider_name" type="string" required>
      STS provider: `GOOGLE`, `OPENAI`, or `GROK`.
    </ParamField>

    <ParamField body="model_name" type="string" required>
      Model name for the STS provider.
    </ParamField>

    <ParamField body="voice_id" type="string" required>
      Voice ID for the STS provider.
    </ParamField>

    <ParamField body="language" type="string" required>
      Language code.
    </ParamField>

    <ParamField body="params" type="object">
      Additional provider-specific STS parameters.
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="prompt_content" type="string">
  New prompt content — creates a new version of the agent's internal prompt.
</ParamField>

<ParamField body="prompt" type="object">
  Reference an existing prompt by name and optionally version.
</ParamField>

<ParamField body="call_analysis_prompt" type="object">
  Updated call analysis prompt reference or inline analysis prompt content.

  <Expandable title="properties">
    <ParamField body="prompt_name" type="string" required>
      Name of an existing analysis prompt.
    </ParamField>

    <ParamField body="prompt_version" type="integer">
      Specific analysis prompt version to use (omit for latest).
    </ParamField>

    <ParamField body="custom_prompt" type="string">
      Inline analysis prompt content. If provided, a new analysis prompt version is created before linking it to the agent.
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="call_analysis_enabled" type="boolean">
  Toggle call analysis on or off for the agent. Set this to `true` only when you
  want call analysis to run. If `true`, provide `call_analysis_prompt` as well.
</ParamField>

<ParamField body="call_analysis_schema" type="object">
  Updated schema describing the structured JSON output expected from call
  analysis.
</ParamField>

<ParamField body="first_message_prompt" type="string">
  Updated greeting message.
</ParamField>

<ParamField body="tools" type="object">
  Update agent tools. Only specified tools are modified.
</ParamField>

<ParamField body="widget_config" type="object">
  Updated widget configuration.
</ParamField>

## Response

Returns the complete updated agent object with all configurations and timestamps.


## OpenAPI

````yaml PATCH /v1/public/agents/{agent_id}
openapi: 3.0.0
info:
  title: eigi.ai API
  description: REST API for managing AI voice agents and conversations
  version: 1.0.0
  contact:
    email: buddy@eigi.ai
    url: https://eigi.ai
servers:
  - url: https://api.eigi.ai
    description: Production server
security:
  - ApiKeyAuth: []
paths:
  /v1/public/agents/{agent_id}:
    patch:
      tags:
        - Agents
      summary: Update Agent
      description: >-
        Update an existing agent. Only provided fields will be updated. If
        prompt_content is provided, creates a new version of the agent's
        internal prompt. If call_analysis_prompt.custom_prompt is provided, a
        new version of the analysis prompt is created before the agent is
        updated.
      operationId: updateAgent
      parameters:
        - name: agent_id
          in: path
          required: true
          description: The unique agent ID
          schema:
            type: string
          example: 68ea2517dbb84c09bae1ba0a
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AgentUpdate'
            examples:
              update_name:
                summary: Update agent name and prompt
                value:
                  agent_name: Updated Support Agent
                  prompt_content: You are an updated customer support agent.
                  call_analysis_enabled: true
                  call_analysis_prompt:
                    prompt_name: support_call_analysis
                    custom_prompt: Return the summary, customer intent, and next best action.
                  call_analysis_schema:
                    summary:
                      type: str
                    customer_intent:
                      type: Optional[str]
                    next_best_action:
                      type: str
              custom_llm:
                summary: Switch agent to CUSTOM_LLM
                value:
                  llm:
                    provider_name: CUSTOM_LLM
                    model_name: custom-model
                    params:
                      base_url: https://llm.example.com/v1
                      api_key: sk-...
                      API_TYPE: CHAT_COMPLETION
      responses:
        '200':
          description: Agent updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentResponse'
        '401':
          description: Unauthorized - Invalid API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Forbidden - Access denied
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    AgentUpdate:
      type: object
      description: All fields are optional — only provided fields will be updated.
      properties:
        agent_name:
          type: string
          minLength: 1
          maxLength: 100
          description: Agent name
        agent_description:
          type: string
          maxLength: 500
          description: Agent description
        agent_type:
          type: string
          enum:
            - INBOUND
            - OUTBOUND
          description: Agent type
        agent_category:
          type: string
          enum:
            - Customer Service
            - Sales
            - Scheduling
            - Research
            - Healthcare
            - Customer Success
            - Education
            - Finance
            - HR
            - Legal
            - Productivity
            - Creative
            - IT/DevOps
            - E-commerce
            - Entertainment
            - Travel
            - Wellness
            - Anime
            - Cartoon
            - Gaming
            - Lifestyle
            - other
          description: Agent category
        agent_tips:
          type: array
          items:
            type: string
          description: Usage tips
        agent_mobile_number:
          type: array
          items:
            type: string
          description: Mobile numbers associated with the agent
        stt:
          $ref: '#/components/schemas/STTConfig'
        llm:
          $ref: '#/components/schemas/LLMConfig'
        tts:
          $ref: '#/components/schemas/TTSConfig'
        call_analysis_prompt:
          type: object
          description: >-
            Optional call analysis prompt reference. Provide custom_prompt to
            create a new analysis prompt version before linking it to the agent.
          properties:
            prompt_name:
              type: string
              description: Name of existing analysis prompt
            prompt_version:
              type: integer
              description: Specific version (omit for latest)
            custom_prompt:
              type: string
              description: Inline analysis prompt content
          required:
            - prompt_name
        call_analysis_enabled:
          type: boolean
          description: >-
            Toggle call analysis on or off for the agent. Set to true only when
            you want call analysis to run; when true, provide
            call_analysis_prompt as well.
        call_analysis_schema:
          type: object
          description: >-
            Optional schema for structured call analysis output, keyed by field
            name.
          additionalProperties:
            type: object
            properties:
              type:
                type: string
                enum:
                  - str
                  - int
                  - float
                  - bool
                  - list
                  - dict
                  - Optional[str]
                  - Optional[int]
                  - Optional[float]
                  - Optional[bool]
                  - Optional[list]
                  - Optional[dict]
                description: Expected type for this call analysis field.
            required:
              - type
            additionalProperties: false
          example:
            summary:
              type: str
            customer_intent:
              type: Optional[str]
            follow_up_required:
              type: bool
        prompt_content:
          type: string
          description: >-
            New prompt content — creates a new version of the agent's internal
            prompt
        prompt:
          type: object
          description: Reference to an existing prompt
          properties:
            prompt_name:
              type: string
            prompt_version:
              type: integer
          required:
            - prompt_name
        first_message_prompt:
          type: string
          description: Agent's greeting message
        tools:
          $ref: '#/components/schemas/ToolsConfig'
        widget_config:
          type: object
          description: Widget configuration
          properties:
            widget_interface:
              type: object
            widget_appearance:
              type: object
            widget_avatar:
              type: object
            widget_tnc_config:
              type: object
    AgentResponse:
      type: object
      properties:
        id:
          type: string
          description: Agent ID
        agent_name:
          type: string
          description: Agent name
        agent_description:
          type: string
          description: Agent description
        agent_type:
          type: string
          enum:
            - INBOUND
            - OUTBOUND
          description: Agent type
        agent_category:
          type: string
          description: Agent category
        agent_tips:
          type: array
          items:
            type: string
          description: Usage tips
        agent_mobile_number:
          type: array
          items:
            type: string
          description: Associated mobile numbers
        stt:
          type: object
          description: STT configuration
        llm:
          type: object
          description: LLM configuration
        tts:
          type: object
          description: TTS configuration
        sts:
          type: object
          description: STS configuration (if set)
        call_analysis_enabled:
          type: boolean
          description: Whether call analysis is enabled for the agent
        prompt:
          type: object
          description: Prompt reference
          properties:
            prompt_name:
              type: string
            prompt_version:
              type: integer
            prompt_content:
              type: string
        first_message_prompt:
          type: string
          description: Agent's greeting message
        dynamic_variables:
          type: array
          items:
            type: string
          description: Dynamic variables in the prompt
        tools:
          type: object
          description: Configured tools
        widget_config:
          type: object
          description: Widget configuration
        MediaFiles:
          type: array
          items:
            type: object
            properties:
              fileType:
                type: string
              mediaUrl:
                type: string
          description: Media files associated with the agent
        created_at:
          type: string
          format: date-time
          description: Creation timestamp
        updated_at:
          type: string
          format: date-time
          description: Last update timestamp
    Error:
      type: object
      properties:
        detail:
          type: string
          description: Error message
    STTConfig:
      type: object
      required:
        - provider_name
        - model_name
        - language
      properties:
        provider_name:
          type: string
          enum:
            - DEEPGRAM
            - WHISPER
          description: STT provider name
        model_name:
          type: string
          description: Model name for the STT provider
          example: nova-2
        language:
          type: string
          description: Language code (e.g., en, hi, es, fr)
          example: en
        params:
          type: object
          description: Must be empty for public API - no additional STT params allowed
          example: {}
    LLMConfig:
      type: object
      required:
        - provider_name
        - model_name
      description: >-
        LLM configuration. Use provider_name to choose a standard provider or
        CUSTOM_LLM. For standard providers, only params.temperature applies. For
        CUSTOM_LLM, use params.base_url, params.api_key, and optional
        params.API_TYPE.
      properties:
        provider_name:
          type: string
          enum:
            - OPENAI
            - OPENAI_RESPONSES
            - ANTHROPIC
            - GOOGLE
            - GROK
            - OPENROUTER
            - CUSTOM_LLM
          description: LLM provider name
        model_name:
          type: string
          description: Model name for the selected LLM provider
          example: gpt-4o
        params:
          type: object
          description: >-
            For standard providers, only temperature is used. For CUSTOM_LLM,
            provide base_url and api_key, and optionally API_TYPE.
          properties:
            temperature:
              type: number
              minimum: 0
              maximum: 2
              description: Standard providers only. Controls randomness (0.0-2.0).
            base_url:
              type: string
              description: CUSTOM_LLM only. Base URL for the custom LLM endpoint.
              example: https://llm.example.com/v1
            api_key:
              type: string
              description: CUSTOM_LLM only. API key for the custom LLM provider.
              example: sk-...
            API_TYPE:
              type: string
              enum:
                - CHAT_COMPLETION
                - RESPONSES
              description: >-
                CUSTOM_LLM only. Optional; defaults to CHAT_COMPLETION when
                omitted.
          example:
            temperature: 0.7
    TTSConfig:
      type: object
      required:
        - provider_name
        - model_name
        - language
        - voice_id
      properties:
        provider_name:
          type: string
          enum:
            - CARTESIA
            - ELEVENLABS
            - SARVAM
            - GOOGLE
            - HUME
          description: TTS provider name
        model_name:
          type: string
          description: Model name for the TTS provider
          example: sonic-2
        language:
          type: string
          description: Language code (e.g., en, hi)
          example: en
        voice_id:
          type: string
          description: Voice ID from the TTS provider
          example: a0e99841-438c-4a64-b679-ae501e7d6091
        params:
          type: object
          description: Only 'speed' param is allowed for public API
          properties:
            speed:
              type: number
              description: Speech speed multiplier
          example:
            speed: 1
    ToolsConfig:
      type: object
      description: >-
        Configure agent tools. Each tool can be true (enable), false (disable),
        or an object with configuration.
      properties:
        end_call:
          description: End call tool - enabled by default. Use true/false to toggle.
          oneOf:
            - type: boolean
            - type: object
        transfer_call:
          description: >-
            Transfer call tool. When using config object, requires
            transfer_phone_number.
          oneOf:
            - type: boolean
            - type: object
              properties:
                transfer_phone_number:
                  type: string
                  description: Phone number to transfer to
              required:
                - transfer_phone_number
        schedule_call:
          description: Schedule call tool. Optional allow_immediate config.
          oneOf:
            - type: boolean
            - type: object
              properties:
                allow_immediate:
                  type: boolean
                  default: false
        set_language:
          description: Set language tool. Optional language_string config.
          oneOf:
            - type: boolean
            - type: object
              properties:
                language_string:
                  type: string
                  default: en-US
        background_audio:
          description: Background audio tool with audio file and volume config.
          oneOf:
            - type: boolean
            - type: object
              properties:
                audio_files:
                  type: array
                  items:
                    type: string
                    enum:
                      - env1.wav
                      - honk1.wav
                      - market1.wav
                      - office1.mp3
                      - office2.mp3
                      - office3.mp3
                      - office4.wav
                      - office5.wav
                      - temple1.wav
                      - temple2.wav
                background_noise_reduce:
                  type: boolean
                  default: true
                default_volume:
                  type: number
                  minimum: 0.1
                  maximum: 1
                  default: 0.2
        user_idle:
          description: User idle detection with timeout and retry config.
          oneOf:
            - type: boolean
            - type: object
              properties:
                idle_timeout_seconds:
                  type: number
                  minimum: 3
                  maximum: 30
                  default: 10
                max_retry_count:
                  type: integer
                  minimum: 1
                  maximum: 10
                  default: 3
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: >-
        API key for authentication. Get your API key from the eigi.ai Dashboard
        under Settings â†’ API Keys.

````