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

# Create Agent

> Create a new AI agent with complete configuration

## Overview

Create a new AI agent with full configuration including speech-to-text (STT), speech-to-speech (STS), large language model (LLM), text-to-speech (TTS), main prompt, call analysis prompt, tools, and widget settings.

### Prompt Configuration

You can configure the agent's prompt in two ways:

1. **Inline prompt** (`prompt_content`) — Provide the prompt text directly. An internal prompt is auto-created for the agent.
2. **Prompt reference** (`prompt`) — Reference an existing prompt by name and optionally version.

### Call Analysis Configuration

You can optionally configure a dedicated call analysis prompt and schema:

1. **Enable analysis** (`call_analysis_enabled`) — Set this to `true` only when you want call analysis to run.
2. **Analysis prompt reference** (`call_analysis_prompt`) — Reference an existing analysis prompt by name and optionally version.
3. **Inline analysis prompt** (`call_analysis_prompt.custom_prompt`) — Provide prompt content directly to create a new analysis prompt version before linking it to the agent.
4. **Structured output schema** (`call_analysis_schema`) — Define the expected JSON structure for call analysis output.

If you do not want call analysis, omit `call_analysis_enabled`, `call_analysis_prompt`, and `call_analysis_schema`. 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`.

### Provider Restrictions (Public API)

| 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`                                                                                                                                |

## Authentication

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

## Request Body

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

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

<ParamField body="stt" type="object" required>
  Speech-to-Text configuration.

  <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 (e.g., `nova-2`).
    </ParamField>

    <ParamField body="language" type="string" required>
      Language code (e.g., `en`, `hi`).
    </ParamField>

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

<ParamField body="llm" type="object" required>
  Large Language Model configuration.

  <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 (e.g., `gpt-4o`).
    </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" required>
  Text-to-Speech configuration.

  <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 (e.g., `sonic-2`).
    </ParamField>

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

    <ParamField body="voice_id" type="string" required>
      Voice ID from the provider. Use the [List Voices](/api-reference/public/voices-list) endpoint to find available voices.
    </ParamField>

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

<ParamField body="sts" type="object">
  Speech-to-Speech configuration for realtime voice generation.

  <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="agent_description" type="string">
  Agent description (max 500 characters).
</ParamField>

<ParamField body="agent_category" type="string" default="other">
  Agent category (e.g., `Customer Service`, `Sales`, `Healthcare`, etc.).
</ParamField>

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

<ParamField body="agent_mobile_number" type="array">
  Mobile numbers to associate with the agent.
</ParamField>

<ParamField body="prompt_content" type="string">
  Inline prompt content. Auto-creates an internal prompt for the agent.
</ParamField>

<ParamField body="prompt" type="object">
  Reference to an existing prompt (alternative to `prompt_content`).

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

    <ParamField body="prompt_version" type="integer">
      Specific version (omit for latest).
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="call_analysis_prompt" type="object">
  Optional call analysis prompt configuration.

  <Expandable title="properties">
    <ParamField body="prompt_name" type="string" required>
      Name of an existing analysis prompt to reference.
    </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">
  Optional schema describing the structured JSON output expected from call
  analysis.
</ParamField>

<ParamField body="first_message_prompt" type="string">
  Agent's greeting message displayed when a chat session starts.
</ParamField>

<ParamField body="tools" type="object">
  Configure agent tools. Each tool can be `true` (enable), `false` (disable), or an object with configuration.

  Available tools: `end_call`, `transfer_call`, `schedule_call`, `set_language`, `background_audio`, `user_idle`.
</ParamField>

<ParamField body="widget_config" type="object">
  Widget configuration for chat interface customization.
</ParamField>

## Response

Returns the complete agent object with all configurations, `id`, and timestamps.


## OpenAPI

````yaml POST /v1/public/agents
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:
    post:
      tags:
        - Agents
      summary: Create Agent
      description: >-
        Create a new AI agent with complete configuration including STT, LLM,
        TTS, prompt, call analysis configuration, tools, and widget settings.
        Supports two modes for prompt: inline prompt_content (auto-creates
        internal prompt) or reference to an existing prompt by name.
      operationId: createAgent
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AgentCreate'
            examples:
              basic:
                summary: Create agent with inline prompt
                value:
                  agent_name: Support Agent
                  agent_type: INBOUND
                  agent_category: Customer Service
                  stt:
                    provider_name: DEEPGRAM
                    model_name: nova-2
                    language: en
                    params: {}
                  llm:
                    provider_name: OPENAI
                    model_name: gpt-4o
                    params:
                      temperature: 0.7
                  tts:
                    provider_name: CARTESIA
                    model_name: sonic-2
                    language: en
                    voice_id: a0e99841-438c-4a64-b679-ae501e7d6091
                    params:
                      speed: 1
                  prompt_content: You are a helpful customer support agent.
                  call_analysis_enabled: true
                  call_analysis_prompt:
                    prompt_name: support_call_analysis
                    custom_prompt: >-
                      Analyze the call outcome, customer sentiment, and
                      follow-up actions.
                  call_analysis_schema:
                    call_outcome:
                      type: str
                    customer_sentiment:
                      type: str
                    follow_up_required:
                      type: bool
                  first_message_prompt: Hello! How can I help you today?
                  tools:
                    end_call: true
                    transfer_call:
                      transfer_phone_number: '+919876543210'
              custom_llm:
                summary: Create agent with CUSTOM_LLM
                value:
                  agent_name: Custom LLM Support Agent
                  agent_type: OUTBOUND
                  agent_category: Customer Service
                  stt:
                    provider_name: DEEPGRAM
                    model_name: nova-2
                    language: en
                    params: {}
                  llm:
                    provider_name: CUSTOM_LLM
                    model_name: custom-model
                    params:
                      base_url: https://llm.example.com/v1
                      api_key: sk-...
                      API_TYPE: RESPONSES
                  tts:
                    provider_name: CARTESIA
                    model_name: sonic-2
                    language: en
                    voice_id: a0e99841-438c-4a64-b679-ae501e7d6091
                    params:
                      speed: 1
                  prompt_content: You are a helpful support agent using a custom LLM backend.
                  first_message_prompt: Hello! How can I help you today?
      responses:
        '201':
          description: Agent created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentResponse'
        '400':
          description: Bad request - Missing or invalid parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized - Invalid API key
          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:
    AgentCreate:
      type: object
      required:
        - agent_name
        - agent_type
        - stt
        - llm
        - tts
      properties:
        agent_name:
          type: string
          minLength: 1
          maxLength: 100
          description: Agent name (1-100 characters)
          example: Customer Support Agent
        agent_description:
          type: string
          maxLength: 500
          description: Agent description (max 500 characters)
        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
          default: other
          description: Agent category
        agent_tips:
          type: array
          items:
            type: string
          description: Usage tips for the agent
        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: >-
            Inline prompt content — auto-creates an internal prompt for the
            agent
        prompt:
          type: object
          description: Reference to an existing prompt (alternative to prompt_content)
          properties:
            prompt_name:
              type: string
              description: Name of existing prompt
            prompt_version:
              type: integer
              description: Specific version (omit for latest)
          required:
            - prompt_name
        first_message_prompt:
          type: string
          description: Agent's greeting message shown when chat starts
        tools:
          $ref: '#/components/schemas/ToolsConfig'
        widget_config:
          type: object
          description: Widget configuration for chat interface customization
          properties:
            widget_interface:
              type: object
              description: Interface settings (enable_chat, mute_button, etc.)
            widget_appearance:
              type: object
              description: Appearance settings (variant, placement, etc.)
            widget_avatar:
              type: object
              description: Avatar settings (type, colors)
            widget_tnc_config:
              type: object
              description: Terms and conditions settings
    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.

````