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

# Create agent

> Creates a new agent (current behavior).

## Notes

* Creates a new agent with the specified configuration
* Auto-generates `agent_id` if not provided (with "agent\_" prefix)


## OpenAPI

````yaml post /api/agents/create
openapi: 3.0.3
info:
  title: Zudu API
  description: >-
    Comprehensive REST API for LiveKit Backend - Call Management, Agent
    Configuration, and Real-time Communication Services
  version: 1.0.0
  contact:
    name: Zudu AI Team
    url: https://zudu.ai
    email: support@zudu.ai
  license:
    name: Proprietary
    url: https://zudu.ai/license
servers:
  - url: https://api.zudu.ai
    description: Production (Customer-facing)
security:
  - apiKey: []
    apiSecret: []
tags:
  - name: Agent Management
    description: Create and manage AI agents
  - name: Call Data Management
    description: Call records and history
  - name: Customer API Keys
    description: Manage API keys
  - name: Post-Call Webhooks
    description: Webhook configuration
  - name: phone-number-controller
    description: Phone numbers
  - name: batch-call-controller
    description: Batch calls
  - name: MCP Server Management
    description: MCP servers
  - name: Knowledge Base Management
    description: Knowledge bases
  - name: Call Analysis
    description: Call analysis
paths:
  /api/agents/create:
    post:
      tags:
        - Agent Management
      summary: Create agent
      description: >-
        Creates a new agent. Only agent_name is required; all other request body
        fields are optional. agent_id is auto-generated if not provided.
        organization_id is set from orgId header. Response uses frontend-safe
        agent data (model/provider hidden from llm_config and stt_config).
      operationId: createAgent
      requestBody:
        content:
          application/json:
            schema:
              allOf:
                - type: object
                  required:
                    - agent_name
                - $ref: '#/components/schemas/AgentData'
            example:
              agent_name: My New Agent
        required: true
      responses:
        '201':
          description: Agent created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                  status:
                    type: string
                  error:
                    type: string
                    nullable: true
                  data:
                    $ref: '#/components/schemas/AgentData'
              example:
                message: Agent created successfully
                status: success
                error: null
                data:
                  agent_id: agent_b75cece1-7e81-4bde-bf8e-992ae93654c0
                  organization_id: org_xyz789
                  created_at: '2025-01-15T12:45:00'
                  updated_at: '2025-01-15T12:45:00'
                  agent_name: Customer Support Agent
                  begin_message: Hello! How can I help you?
                  begin_message_variables:
                    - name
                    - company
                  begin_message_delay_ms: 1000
                  test_variables:
                    name: John
                    company: Acme Corp
                  webhook_url: https://example.com/webhook
                  post_call_webhook_id: webhook_123
                  end_call_after_silence_ms: 60000
                  max_call_duration_ms: 3600000
                  take_turn_after_silence_seconds: 6
                  timezone: America/New_York
                  knowledge_base_ids:
                    - kb_123
                    - kb_456
                  mcp_server_ids:
                    - mcp_123
                  rag_config:
                    chunks_to_retrieve: 10
                    similarity_threshold: 0.7
                  llm_config:
                    system_message: You are a helpful customer support agent.
                    temperature: 0.7
                    max_tokens: 1000
                    tools: []
                    system_message_variables: []
                  stt_config:
                    language: en
                    language_name: English
                    use_realtime: true
                  tts_config:
                    voice_id: 21m00Tcm4TlvDq8ikWAM
                    voice_speed: 1
                    language: en
                    language_name: English
                    pronunciation_dictionary_ids: []
                    provider: elevenlabs
                    model: eleven_multilingual_v2
                    custom_api_url: null
                    custom_api_key: null
                    custom_secret_key: null
                    custom_timeout: null
                    custom_streaming: null
                    custom_sample_rate: null
                  post_call_analysis_data: []
                  post_call_analysis_model: null
                  post_call_evaluation_criteria: []
                  widget_config: {}
                  additional_languages: []
                  access_info: {}
        '400':
          description: Validation error
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                  status:
                    type: string
                  error:
                    type: string
                    nullable: true
                  data:
                    type: string
                    nullable: true
              example:
                message: Validation error
                status: error
                error: Agent name is required
                data: null
        '500':
          description: Failed to create agent
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                  status:
                    type: string
                  error:
                    type: string
                    nullable: true
                  data:
                    type: string
                    nullable: true
              example:
                message: Failed to create agent
                status: error
                error: Database connection failed
                data: null
components:
  schemas:
    AgentData:
      type: object
      properties:
        agent_id:
          type: string
        organization_id:
          type: string
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
        agent_name:
          type: string
        begin_message:
          type: string
        begin_message_variables:
          type: array
          items:
            type: string
        begin_message_delay_ms:
          type: integer
          format: int32
        test_variables:
          type: object
          additionalProperties:
            type: string
        webhook_url:
          type: string
        post_call_webhook_id:
          type: string
        end_call_after_silence_ms:
          type: integer
          format: int32
        max_call_duration_ms:
          type: integer
          format: int32
        take_turn_after_silence_seconds:
          type: number
          format: double
        timezone:
          type: string
        knowledge_base_ids:
          type: array
          items:
            type: string
        mcp_server_ids:
          type: array
          items:
            type: string
        rag_config:
          $ref: '#/components/schemas/RAGConfig'
        llm_config:
          $ref: '#/components/schemas/LLMConfig'
        stt_config:
          $ref: '#/components/schemas/STTConfig'
        tts_config:
          $ref: '#/components/schemas/TTSConfig'
        post_call_analysis_data:
          type: array
          items:
            $ref: '#/components/schemas/PostCallAnalysisData'
        post_call_analysis_model:
          type: string
        post_call_evaluation_criteria:
          type: array
          items:
            $ref: '#/components/schemas/PostCallEvaluationCriteria'
        widget_config:
          $ref: '#/components/schemas/WidgetConfig'
        access_info:
          type: object
          additionalProperties:
            type: object
        fetch_webhook_data:
          type: boolean
        use_rag:
          type: boolean
        integrations:
          type: array
          items:
            type: string
        text_only:
          type: boolean
        additional_languages:
          type: array
          items:
            $ref: '#/components/schemas/AdditionalLanguageConfig'
    RAGConfig:
      type: object
      properties:
        chunks_to_retrieve:
          type: integer
          format: int32
        similarity_threshold:
          type: number
    LLMConfig:
      type: object
      properties:
        model:
          type: string
        provider:
          type: string
        system_message:
          type: string
        temperature:
          type: number
          format: double
        max_tokens:
          type: integer
          format: int32
        tools:
          type: array
          items:
            type: object
        system_message_variables:
          type: array
          items:
            type: string
    STTConfig:
      type: object
      properties:
        provider:
          type: string
        model:
          type: string
        language:
          type: string
        language_name:
          type: string
        use_realtime:
          type: boolean
    TTSConfig:
      type: object
      properties:
        provider:
          type: string
        model:
          type: string
        voice_id:
          type: string
        voice_speed:
          type: number
          format: double
        language:
          type: string
        language_name:
          type: string
        pronunciation_dictionary_ids:
          type: array
          items:
            type: string
        custom_api_url:
          type: string
        custom_api_key:
          type: string
        custom_secret_key:
          type: string
        custom_timeout:
          type: number
          format: double
        custom_streaming:
          type: boolean
        custom_sample_rate:
          type: integer
          format: int32
    PostCallAnalysisData:
      type: object
      properties:
        type:
          type: string
        name:
          type: string
        description:
          type: string
        examples:
          type: array
          items:
            type: string
    PostCallEvaluationCriteria:
      type: object
      properties:
        name:
          type: string
        description:
          type: string
    WidgetConfig:
      type: object
      properties:
        embed_code:
          type: string
        variant:
          type: string
        placement:
          type: string
        expandable:
          type: string
        avatar:
          $ref: '#/components/schemas/Avatar'
        feedback_mode:
          type: string
        bg_color:
          type: string
        text_color:
          type: string
        btn_color:
          type: string
        btn_text_color:
          type: string
        border_color:
          type: string
        focus_color:
          type: string
        border_radius:
          type: integer
          format: int32
        btn_radius:
          type: integer
          format: int32
        action_text:
          type: string
        start_call_text:
          type: string
        end_call_text:
          type: string
        expand_text:
          type: string
        listening_text:
          type: string
        speaking_text:
          type: string
        shareable_page_text:
          type: string
        shareable_page_show_terms:
          type: boolean
        terms_text:
          type: string
        terms_html:
          type: string
        terms_key:
          type: string
        show_avatar_when_collapsed:
          type: boolean
        disable_banner:
          type: boolean
        override_link:
          type: string
        mic_muting_enabled:
          type: boolean
        transcript_enabled:
          type: boolean
        text_input_enabled:
          type: boolean
        language_dropdown:
          type: boolean
        text_contents:
          $ref: '#/components/schemas/TextContents'
        styles:
          $ref: '#/components/schemas/Styles'
        language:
          type: string
        supported_language_overrides:
          type: array
          items:
            type: string
        language_presets:
          type: object
          additionalProperties:
            type: object
        text_only:
          type: boolean
        supports_text_only:
          type: boolean
        first_message:
          type: string
        show_default_powered_by:
          type: boolean
        custom_powered_by_text:
          maxLength: 255
          minLength: 0
          type: string
    AdditionalLanguageConfig:
      type: object
      properties:
        tts:
          $ref: '#/components/schemas/TTSLanguageConfig'
        stt:
          $ref: '#/components/schemas/STTLanguageConfig'
    Avatar:
      type: object
      properties:
        type:
          type: string
        color_1:
          type: string
        color_2:
          type: string
        custom_url:
          type: string
        url:
          type: string
    TextContents:
      type: object
      properties:
        main_label:
          type: string
        start_call:
          type: string
        new_call:
          type: string
        end_call:
          type: string
        mute_microphone:
          type: string
        change_language:
          type: string
        collapse:
          type: string
        expand:
          type: string
        copied:
          type: string
        accept_terms:
          type: string
        dismiss_terms:
          type: string
        listening_status:
          type: string
        speaking_status:
          type: string
        connecting_status:
          type: string
        input_label:
          type: string
        input_placeholder:
          type: string
        user_ended_conversation:
          type: string
        agent_ended_conversation:
          type: string
        conversation_id:
          type: string
        error_occurred:
          type: string
        copy_id:
          type: string
    Styles:
      type: object
      properties:
        base:
          type: string
        base_hover:
          type: string
        base_active:
          type: string
        base_border:
          type: string
        base_subtle:
          type: string
        base_primary:
          type: string
        base_error:
          type: string
        accent:
          type: string
        accent_hover:
          type: string
        accent_active:
          type: string
        accent_border:
          type: string
        accent_subtle:
          type: string
        accent_primary:
          type: string
        overlay_padding:
          type: integer
          format: int32
        button_radius:
          type: integer
          format: int32
        input_radius:
          type: integer
          format: int32
        bubble_radius:
          type: integer
          format: int32
        sheet_radius:
          type: string
        compact_sheet_radius:
          type: string
        dropdown_sheet_radius:
          type: string
    TTSLanguageConfig:
      type: object
      properties:
        provider:
          type: string
        model:
          type: string
        voice_id:
          type: string
        voice_speed:
          type: number
          format: double
        language:
          type: string
        language_name:
          type: string
        custom_api_url:
          type: string
        custom_api_key:
          type: string
        custom_secret_key:
          type: string
        custom_timeout:
          type: number
          format: double
        custom_streaming:
          type: boolean
        custom_sample_rate:
          type: integer
          format: int32
    STTLanguageConfig:
      type: object
      properties:
        provider:
          type: string
        model:
          type: string
        language:
          type: string
        language_name:
          type: string
        use_realtime:
          type: boolean
  securitySchemes:
    apiKey:
      type: apiKey
      description: API Key for MCP server and external service authentication
      name: X-API-KEY
      in: header
    apiSecret:
      type: apiKey
      description: API Secret for MCP server and external service authentication
      name: X-API-SECRET
      in: header

````