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

# Create Agent

> Creates a new agent with avatar IDs, knowledge bases, and additional settings



## OpenAPI

````yaml POST /ext/agent
openapi: 3.0.3
info:
  title: TruGen Developer Platform API
  version: 1.0.0
  description: OpenAPI specification for MCP endpoint
servers:
  - url: https://api.trugen.ai/v1
security: []
paths:
  /ext/agent:
    post:
      summary: Create an agent
      description: >-
        Creates a new agent with avatar IDs, knowledge bases, and additional
        settings
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                agent_name:
                  type: string
                  description: Display name for the avatar persona.
                  default: Sofia - Friendly Support
                agent_system_prompt:
                  type: string
                  description: Behavioral prompt for the avatar interaction style.
                  default: Speak in a warm, engaging tone and provide clear answers.
                avatars:
                  type: array
                  description: List of avatars associated with this agent.
                  items:
                    type: object
                    properties:
                      config:
                        type: object
                        description: >-
                          Configuration for avatar behavior and runtime
                          settings.
                        properties:
                          llm:
                            type: object
                            description: Large Language Model settings used by the avatar.
                            properties:
                              model:
                                type: string
                                description: Identifier of the LLM model.
                                default: meta-llama/llama-4-maverick-17b-128e-instruct
                              provider:
                                type: string
                                description: Provider used for LLM inference.
                                default: groq
                              url:
                                type: string
                                description: >-
                                  Custom provider URL of the LLM model.
                                  (Required if provider is 'custom')
                                default: sample url
                              token:
                                type: string
                                description: >-
                                  Custom provider API token for the LLM model.
                                  (Required if provider is 'custom')
                                default: sample token
                          stt:
                            type: object
                            description: Speech-to-Text model configuration.
                            properties:
                              model:
                                type: string
                                description: Speech recognition model identifier.
                                default: flux-general-en
                              provider:
                                type: string
                                description: STT provider service name.
                                default: deepgram
                              min_endpointing_delay:
                                type: number
                                description: Minimum endpointing delay in seconds.
                                default: 0.3
                              max_endpointing_delay:
                                type: number
                                description: Maximum endpointing delay in seconds.
                                default: 0.4
                          tts:
                            type: object
                            description: Text-to-Speech generation configuration.
                            properties:
                              model_id:
                                type: string
                                description: Voice synthesis model identifier.
                                default: eleven_turbo_v2_5
                              provider:
                                type: string
                                description: TTS provider service name.
                                default: elevenlabs
                              voice_id:
                                type: string
                                description: Voice ID used to synthesize speech.
                                default: ZUrEGyu8GFMwnHbvLhv2
                          turn_detector:
                            type: boolean
                            description: turn detector
                            default: true
                      avatar_key_id:
                        type: string
                        description: avatar_key_id
                        default: 665a1170
                      idle_timeout:
                        type: object
                        description: idle_timeout configuration.
                        properties:
                          timeout:
                            type: number
                            description: timeout
                            default: 30
                          filler_phrases:
                            type: array
                            description: filler_phrases
                            items:
                              type: string
                              default: >-
                                Hey it's been a while since we last spoke, are
                                we still connected?
                      welcome_message:
                        type: object
                        description: welcome_message configuration.
                        properties:
                          wait_time:
                            type: number
                            description: wait_time
                            default: 2
                          messages:
                            type: array
                            description: messages
                            items:
                              type: string
                              default: Hi, how are you doing today?
                      warning_exit_message:
                        type: object
                        description: warning_exit_message configuration.
                        properties:
                          callout_before:
                            type: number
                            description: callout_before
                            default: 10
                          messages:
                            type: array
                            description: messages
                            items:
                              type: string
                              default: >-
                                We are almost at the end of our call, thank you
                                for your time.
                      exit_message:
                        type: object
                        description: exit_message configuration.
                        properties:
                          max_call_duration:
                            type: number
                            description: max_call_duration
                            default: 300
                          messages:
                            type: array
                            description: messages
                            items:
                              type: string
                              default: >-
                                We are at the end of our call, thank you for
                                your time.
                      exit_heads_up_message:
                        type: object
                        description: exit_heads_up_message configuration.
                        properties:
                          callout_before:
                            type: number
                            description: callout_before
                            default: 10
                          messages:
                            type: array
                            description: messages
                            items:
                              type: string
                              default: >-
                                We are almost at the end of our call, thank you
                                for your time.
                config:
                  type: object
                  description: Agent-level configuration properties.
                  properties:
                    timeout:
                      type: integer
                      description: >-
                        Maximum time to wait for the user to join the call (in
                        seconds).
                      default: 240
                    memory:
                      type: object
                      description: Memory configuration for the agent.
                      properties:
                        isEnabled:
                          type: boolean
                          description: Whether memory is enabled for the agent.
                          default: false
                        instruction:
                          type: string
                          description: Instruction for how the agent should utilize memory.
                          default: >-
                            Sample instruction for the agent to utilize memory
                            effectively in conversations.
                knowledge_base:
                  type: array
                  description: List of knowledge bases attached to this agent.
                  nullable: true
                  items:
                    type: object
                    properties:
                      id:
                        type: string
                        format: uuid
                        description: Knowledge base identifier.
                        default: ac79226e-73e1-41fe-8cde-469ae4e244fa
                      name:
                        type: string
                        description: Name of the knowledge base.
                        default: Product Support Articles
                      description:
                        type: string
                        description: Short summary of the knowledge base content.
                        default: >-
                          Contains FAQs and troubleshooting guides for product
                          lines.
                tool:
                  type: array
                  description: List of tools attached to this agent.
                  nullable: true
                  items:
                    type: object
                    properties:
                      id:
                        type: string
                        format: uuid
                        description: Tool identifier.
                        default: ac79226e-73e1-41fe-8cde-469ae4e244fa
                      name:
                        type: string
                        description: Name of the tool.
                        default: Product Support Articles
                mcp:
                  type: array
                  description: List of MCPs attached to this agent.
                  nullable: true
                  items:
                    type: object
                    properties:
                      id:
                        type: string
                        format: uuid
                        description: MCP identifier.
                        default: ac79226e-73e1-41fe-8cde-469ae4e244fa
                      name:
                        type: string
                        description: Name of the MCP .
                        default: Product Support Articles
                record:
                  type: boolean
                  description: Determines whether voice call recordings should be stored.
                  default: true
                callback_events:
                  type: array
                  description: Webhook events that should trigger callbacks.
                  items:
                    type: string
                    default: utterance_committed
                  example:
                    - participant_left
                    - agent.started_speaking
                    - agent.stopped_speaking
                    - agent.interrupted
                    - user.started_speaking
                    - user.stopped_speaking
                    - utterance_committed
                    - max_call_duration_timeout
                callback_url:
                  type: string
                  description: Webhook endpoint URL to send callback events to.
                  example: https://webhooks.example.com/agent-events
              required:
                - avatars
                - agent_name
                - agent_system_prompt
                - config
            example:
              agent_name: Sample AI Agent
              agent_system_prompt: You're a helpful ai agent. Answer all questions appropriately.
              config:
                timeout: 240
                memory:
                  isEnabled: false
                  instruction: sample memory instruction for the agent
              knowledge_base:
                - id: 4a0365e4-ced5-42f0-8933-b6880a0ce044
                  name: new kb 123
              record: true
              callback_url: ''
              callback_events:
                - participant_left
                - max_call_duration_warning
                - max_call_duration_timeout
                - action_found
              avatars:
                - avatar_key_id: 665a1170
                  config:
                    llm:
                      model: meta-llama/llama-4-maverick-17b-128e-instruct
                      provider: groq
                    stt:
                      model: flux-general-en
                      provider: deepgram
                      min_endpointing_delay: 0.3
                      max_endpointing_delay: 0.4
                    tts:
                      model_id: eleven_turbo_v2_5
                      provider: elevenlabs
                      voice_id: ZUrEGyu8GFMwnHbvLhv2
                  persona_name: Sample AI Agent
                  persona_prompt: >-
                    You're a helpful ai agent. Answer all questions
                    appropriately.
                  conversational_context: Sample Conversational Context
                  idle_timeout:
                    timeout: 30
                    filler_phrases:
                      - >-
                        Hey it's been a while since we last spoke, are we still
                        connected?
                      - >-
                        I notice we haven't talked for a bit, is everything
                        okay?
                  welcome_message:
                    wait_time: 2
                    messages:
                      - Hi, how are you doing today?
                      - Hello, how can I help you?
                  warning_exit_message:
                    callout_before: 10
                    messages:
                      - >-
                        We are almost at the end of our call, thank you for your
                        time.
                      - Thank you for your time. We will see you next time.
                  exit_message:
                    max_call_duration: 300
                    messages:
                      - We are at the end of our call, thank you for your time.
                      - Thank you for your time today.
                  exit_heads_up_message:
                    callout_before: 10
                    messages:
                      - >-
                        We are almost at the end of our call, thank you for your
                        time.
                      - Thank you for your time. We will see you next time.
      responses:
        '200':
          description: Agent created successfully!
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                  message:
                    type: string
              example:
                id: 045302f0-9783-4ff2-846e-3888fb2a7894
                message: Agent created successfully
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
              example:
                error: Invalid request body
        '401':
          description: Unauthorized – missing or invalid API key
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
              example:
                error: 'Unauthorized: not a valid authorization api key'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
              example:
                error: Error creating agent
      security:
        - apiKeyAuth: []
components:
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key

````