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

# Create an agent

> Creates an agent in a project.



## OpenAPI

````yaml https://api-trial.cognigy.ai/swagger/openapi.json post /agents
openapi: 3.0.3
info:
  contact:
    email: support@example.com
    name: API Support
  description: API for managing agents and related resources
  license:
    name: Apache 2.0
    url: http://www.apache.org/licenses/LICENSE-2.0.html
  termsOfService: http://swagger.io/terms/
  title: Agents API
  version: '1.0'
servers:
  - url: https://api-trial.cognigy.ai/v1
security:
  - ApiKey: []
tags:
  - name: Agents
  - name: Brand personas
  - name: Tools
  - name: Built-in tools
  - name: Skills
  - name: Built-in skills
  - name: MCP servers
  - description: >-
      Remote agents that speak the A2A (Agent2Agent) protocol. Available only
      while FEATURE_ENABLE_A2A_TOOLS is on; every route answers 404 otherwise.
    name: A2A agents
  - name: Tool references
paths:
  /agents:
    post:
      tags:
        - Agents
      summary: Create an agent
      description: Creates an agent in a project.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/internal_agents.CreateAgentRequest'
        description: The agent to create.
        required: true
        x-originalParamName: agent
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/internal_agents.CreateAndReadAgentResponse
          description: Returns the created agent.
        '400':
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/github_com_cognigy_ai-agents-v2_internal_middleware.ProblemDetailBadRequest
          description: Invalid request body or validation error.
        '403':
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/github_com_cognigy_ai-agents-v2_internal_middleware.ProblemDetailForbidden
          description: Access denied.
        '409':
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/github_com_cognigy_ai-agents-v2_internal_middleware.ProblemDetailConflict
          description: >-
            An agent with this name already exists in this project, or two of
            the agent's tools would appear to the agent under the same name.
        '500':
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/github_com_cognigy_ai-agents-v2_internal_middleware.ProblemDetailInternalError
          description: Internal server error.
components:
  schemas:
    internal_agents.CreateAgentRequest:
      properties:
        agentType:
          description: >-
            The modality that the agent is authored for: `text` or `voice`. The
            default

            is `voice`. The configuration UI uses it to decide which sections to
            show.

            The runtime doesn't use it and takes the modality from the channel
            of each

            turn.
          enum:
            - text
            - voice
          example: voice
          type: string
        description:
          description: The description of the agent. Optional. The maximum is 1000 bytes.
          type: string
        guardrails:
          allOf:
            - $ref: '#/components/schemas/internal_agents.GuardrailsRequest'
          description: >-
            The safety instructions and data privacy settings of the agent.
            Every safety

            toggle is on by default. If you omit `safetySettings`, or the whole
            block,

            all four toggles are on. If you send `safetySettings` and omit a
            toggle,

            that toggle is on. Only an explicit `false` turns a toggle off.
        hooks:
          allOf:
            - $ref: '#/components/schemas/internal_agents.HooksRequest'
          description: >-
            The hooks that the platform runs for the agent. Optional. You can
            set at

            most one pre-turn hook.
        image:
          description: >-
            The avatar of the agent, either as a URL or as a base64 data URI.
            Optional.
          type: string
        imageOptimizedFormat:
          description: >-
            `true` if the avatar is stored in the Cognigy optimized image
            format;

            `false` otherwise.
          type: boolean
        instructions:
          description: >-
            The instructions that tell the agent how to behave. They can contain

            CognigyScript. The maximum is 5000 characters, not counting
            CognigyScript,

            and 256 KiB stored.
          type: string
        knowledge:
          allOf:
            - $ref: '#/components/schemas/internal_agents.KnowledgeRequest'
          description: The knowledge settings of the agent.
        largeLanguageModelReferenceId:
          description: >-
            The reference identifier for the large language model (LLM) that the
            agent

            uses, in UUID format. The model can't be a voice-to-voice (realtime)
            model.

            To set a realtime model, use `voiceLargeLanguageModelReferenceId`.
          type: string
        llmConfig:
          allOf:
            - $ref: '#/components/schemas/internal_agents.LLMConfigRequest'
          description: >-
            The overrides for the LLM parameters of the agent. A parameter that
            you

            don't set falls back to the default of the LLM Gateway config set.
        localeReferenceId:
          description: >-
            The reference identifier for the locale of the agent, in UUID
            format.
          type: string
        name:
          description: >-
            The name of the agent. It can contain CognigyScript. The maximum is
            200

            bytes, not counting CognigyScript, and 64 KiB stored. The API trims

            whitespace around the name. The name can't contain the characters \
            / : * ?

            " < > | or ¥ outside CognigyScript. The name must be unique in the
            project,

            ignoring case.
          type: string
        personaReferenceId:
          description: >-
            The reference identifier for the brand persona of the agent, in UUID
            format.

            Optional.
          type: string
        projectId:
          description: The unique identifier for the project that the agent belongs to.
          type: string
        realtimeVoice:
          description: >-
            The gpt-live-1 voice that the agent uses for voice sessions. The
            allowed

            values are `alloy`, `ash`, `ballad`, `beacon`, `bossa`, `cedar`,
            `cinder`,

            `coral`, `delta`, `echo`, `gleam`, `marin`, `meridian`, `quartz`,
            `ripple`,

            `sage`, `shimmer`, `stone`, `tempo`, `verse`, `vesper`, and
            `willow`. The

            default is `marin`.
          type: string
        role:
          description: >-
            The short role of the agent, for example "Customer support
            specialist". The

            role opens the default system prompt. Optional. It can contain

            CognigyScript. Whitespace around the role is trimmed. The maximum is
            100

            characters, not counting CognigyScript, and 64 KiB stored.
          type: string
        skillReferenceIds:
          description: >-
            The reference identifiers for the skills of the agent, in UUID
            format.
          items:
            type: string
          type: array
        toolReferenceIds:
          description: >-
            The reference identifiers for the tools that you attach directly to
            the

            agent, in UUID format. The list can't contain duplicates.
          items:
            type: string
          type: array
        voiceDelegationTurns:
          description: >-
            Deprecated and ignored: the voice delegate treats everything said
            since

            the previous hand-off as the current request. Still accepted from
            `1` to

            `5` and stored. The default is `2`.
          type: integer
        voiceLargeLanguageModelReferenceId:
          description: >-
            The reference identifier for the realtime voice-to-voice (V2V) large

            language model (LLM) that the agent uses for voice sessions, in UUID
            format.

            The model must be a voice-to-voice model. Text turns never use it.
          type: string
      required:
        - localeReferenceId
        - name
        - projectId
      type: object
    internal_agents.CreateAndReadAgentResponse:
      properties:
        agentType:
          description: >-
            The modality that the agent was authored for: `text` or `voice`. The

            configuration UI uses it to decide which sections to show. The
            runtime

            doesn't use it and takes the modality from the channel of each turn.
            An

            agent that was stored without a type returns `text`.
          enum:
            - text
            - voice
          example: voice
          type: string
        createdAt:
          description: The time when the agent was created, as a Unix timestamp in seconds.
          type: integer
        createdBy:
          description: The unique identifier for the user who created the agent.
          example: 507f1f77bcf86cd799439011
          type: string
        description:
          description: The description of the agent.
          type: string
        disabledToolReferenceIds:
          description: >-
            The reference identifiers for the tools that are available to the
            agent but

            switched off, in UUID format. The runtime doesn't offer these tools
            to the

            large language model (LLM), and the tools keep their settings.
          items:
            type: string
          type: array
        guardrails:
          allOf:
            - $ref: '#/components/schemas/internal_agents.GuardrailsResponse'
          description: The safety instructions and data privacy settings of the agent.
        hooks:
          allOf:
            - $ref: '#/components/schemas/internal_agents.HooksResponse'
          description: The hooks that the platform runs for the agent.
        id:
          description: The unique identifier for the agent.
          example: 507f1f77bcf86cd799439011
          type: string
        image:
          description: The avatar of the agent, either as a URL or as a base64 data URI.
          type: string
        imageOptimizedFormat:
          description: >-
            `true` if the avatar is stored in the Cognigy optimized image
            format;

            `false` otherwise.
          type: boolean
        instructions:
          description: The instructions that tell the agent how to behave.
          type: string
        knowledge:
          allOf:
            - $ref: '#/components/schemas/internal_agents.KnowledgeResponse'
          description: The knowledge settings of the agent.
        largeLanguageModelReferenceId:
          description: >-
            The reference identifier for the large language model (LLM) that the
            agent

            uses, in UUID format.
          type: string
        lastChangedAt:
          description: >-
            The time when the agent was last changed, as a Unix timestamp in
            seconds.
          type: integer
        lastChangedBy:
          description: The unique identifier for the user who last changed the agent.
          example: 507f1f77bcf86cd799439011
          type: string
        llmConfig:
          allOf:
            - $ref: '#/components/schemas/internal_agents.LLMConfigResponse'
          description: >-
            The overrides for the LLM parameters of the agent. A parameter that
            you

            don't set falls back to the default of the LLM Gateway config set.
        localeReferenceId:
          description: >-
            The reference identifier for the locale of the agent, in UUID
            format.
          type: string
        name:
          description: The name of the agent.
          type: string
        organisationId:
          description: >-
            The unique identifier for the organization that the agent belongs
            to.
          example: 507f1f77bcf86cd799439011
          type: string
        personaReferenceId:
          description: >-
            The reference identifier for the brand persona of the agent, in UUID
            format.

            The value is empty if the agent has no brand persona.
          type: string
        projectId:
          description: The unique identifier for the project that the agent belongs to.
          example: 507f1f77bcf86cd799439011
          type: string
        realtimeVoice:
          description: >-
            The gpt-live-1 voice that the agent uses for voice sessions. If the
            field is

            absent, the default voice `marin` applies.
          type: string
        referenceId:
          description: >-
            The reference identifier for the agent, in UUID format. The API
            generates it

            when the agent is created.
          type: string
        role:
          description: >-
            The short role of the agent, for example "Customer support
            specialist". The

            role opens the default system prompt.
          type: string
        skillReferenceIds:
          description: >-
            The reference identifiers for the skills of the agent, in UUID
            format.
          items:
            type: string
          type: array
        toolReferenceIds:
          description: >-
            The reference identifiers for the tools that you attach directly to
            the

            agent, in UUID format.
          items:
            type: string
          type: array
        voiceDelegationTurns:
          description: >-
            Deprecated and ignored: the voice delegate treats everything said
            since

            the previous hand-off as the current request. The stored value, from
            `1`

            to `5`, is still returned. If the field is absent, the default `2`
            applies.
          type: integer
        voiceLargeLanguageModelReferenceId:
          description: >-
            The reference identifier for the realtime voice-to-voice (V2V) large

            language model (LLM) that the agent uses for voice sessions, in UUID
            format.

            Text turns never use it.
          type: string
        voicePromptTemplate:
          description: >-
            The realtime voice prompt template of the agent. If the agent has no

            template of its own, the field is absent and the product default
            applies.
          type: string
      type: object
    github_com_cognigy_ai-agents-v2_internal_middleware.ProblemDetailBadRequest:
      properties:
        code:
          description: |-
            Code is a stable machine-readable reason, present on some 400s only
            (for example "reserved_tool_name").
          example: reserved_tool_name
          type: string
        detail:
          example: request body validation failed
          type: string
        errors:
          items:
            $ref: >-
              #/components/schemas/github_com_cognigy_ai-agents-v2_internal_middleware.FieldError
          type: array
        instance:
          example: /v1/{resource}
          type: string
        status:
          example: 400
          type: integer
        title:
          example: Bad Request
          type: string
        traceId:
          example: api--a4d2f126-bec4-4544-a049-7c0cf08524ed
          type: string
        type:
          example: about:blank
          type: string
      type: object
    github_com_cognigy_ai-agents-v2_internal_middleware.ProblemDetailForbidden:
      properties:
        detail:
          example: 'access denied: insufficient permissions'
          type: string
        instance:
          example: /v1/{resource}/{id}
          type: string
        status:
          example: 403
          type: integer
        title:
          example: Forbidden
          type: string
        traceId:
          example: api--a4d2f126-bec4-4544-a049-7c0cf08524ed
          type: string
        type:
          example: about:blank
          type: string
      type: object
    github_com_cognigy_ai-agents-v2_internal_middleware.ProblemDetailConflict:
      properties:
        detail:
          example: a resource with this identifier already exists
          type: string
        instance:
          example: /v1/{resource}
          type: string
        status:
          example: 409
          type: integer
        title:
          example: Conflict
          type: string
        traceId:
          example: api--a4d2f126-bec4-4544-a049-7c0cf08524ed
          type: string
        type:
          example: about:blank
          type: string
      type: object
    github_com_cognigy_ai-agents-v2_internal_middleware.ProblemDetailInternalError:
      properties:
        detail:
          example: internal server error
          type: string
        instance:
          example: /v1/{resource}
          type: string
        status:
          example: 500
          type: integer
        title:
          example: Internal Server Error
          type: string
        traceId:
          example: api--a4d2f126-bec4-4544-a049-7c0cf08524ed
          type: string
        type:
          example: about:blank
          type: string
      type: object
    internal_agents.GuardrailsRequest:
      properties:
        dataPrivacy:
          allOf:
            - $ref: '#/components/schemas/internal_agents.DataPrivacyRequest'
          description: >-
            The settings that control which part of the Contact Profile the
            agent reads

            into its system prompt. The agent can only read the profile, and it
            can't

            write to it.
        safetySettings:
          allOf:
            - $ref: '#/components/schemas/internal_agents.SafetySettingsRequest'
          description: |-
            The safety instructions of the agent. Each toggle adds one safety
            instruction to the system prompt of the agent.
      type: object
    internal_agents.HooksRequest:
      properties:
        preTurn:
          description: >-
            The hooks that run before the agent answers each message. You can
            set at

            most one.
          items:
            $ref: '#/components/schemas/internal_agents.PreTurnHook'
          type: array
      type: object
    internal_agents.KnowledgeRequest:
      properties:
        cognigyParameters:
          allOf:
            - $ref: '#/components/schemas/internal_agents.CognigyRAGParametersDTO'
          description: >-
            The parameters of the Cognigy knowledge search. They are allowed
            only if

            `ragType` is `cognigy`. A parameter that you don't set uses the
            default of

            the knowledge search tool.
        context:
          description: >-
            A description of what the knowledge contains. The agent uses it to
            decide

            whether to search its knowledge and to interpret the results.
          type: string
        onSearchFailure:
          description: >-
            What the agent does when a knowledge search fails at runtime. The
            allowed

            values are `answerAnyway` (the agent answers with the context that
            it has)

            and `declineWithError` (the agent tells the user that it can't
            answer,

            instead of answering without grounding). The default is
            `answerAnyway`. The

            setting applies to every `ragMode`.
          type: string
        ragMode:
          description: >-
            When the agent searches its knowledge. The allowed values are
            `never` (no

            search), `always` (in a text session, the search runs before the
            first LLM

            call of each turn and the result is added to the turn context; in a
            realtime

            voice session, the agent searches on demand, as in `agent`) and
            `agent` (the

            LLM decides whether to call the knowledge search tool). If you omit
            the

            field, the agent doesn't search its knowledge.
          type: string
        ragType:
          description: >-
            The backend that powers the knowledge search. The only allowed value
            is

            `cognigy`. The field is required when `ragMode` is `always` or
            `agent`.
          type: string
      type: object
    internal_agents.LLMConfigRequest:
      properties:
        maxOutputTokens:
          description: >-
            The maximum number of tokens that the model generates in a response.
            The

            value must be greater than 0.
          type: integer
        reasoningEffort:
          description: >-
            The reasoning effort of the model, which controls its internal
            thinking

            budget. The allowed values are `none`, `minimal`, `low`, `medium`,
            `high`

            and `xhigh`. Reasoning tokens are billed as completion tokens.
          type: string
        temperature:
          description: The sampling temperature of the model, from 0 to 2.
          type: number
      type: object
    internal_agents.GuardrailsResponse:
      properties:
        dataPrivacy:
          allOf:
            - $ref: '#/components/schemas/internal_agents.DataPrivacyResponse'
          description: >-
            The settings that control which part of the Contact Profile the
            agent reads

            into its system prompt. The agent can only read the profile, and it
            can't

            write to it.
        safetySettings:
          allOf:
            - $ref: '#/components/schemas/internal_agents.SafetySettingsResponse'
          description: |-
            The safety instructions of the agent. Each toggle adds one safety
            instruction to the system prompt of the agent.
      type: object
    internal_agents.HooksResponse:
      properties:
        preTurn:
          description: The hooks that run before the agent answers each message.
          items:
            $ref: '#/components/schemas/internal_agents.PreTurnHook'
          type: array
      type: object
    internal_agents.KnowledgeResponse:
      properties:
        cognigyParameters:
          allOf:
            - $ref: '#/components/schemas/internal_agents.CognigyRAGParametersDTO'
          description: >-
            The parameters of the Cognigy knowledge search. They are allowed
            only if

            `ragType` is `cognigy`. A parameter that you don't set uses the
            default of

            the knowledge search tool.
        context:
          description: >-
            A description of what the knowledge contains. The agent uses it to
            decide

            whether to search its knowledge and to interpret the results.
          type: string
        onSearchFailure:
          description: >-
            What the agent does when a knowledge search fails at runtime. The
            allowed

            values are `answerAnyway` (the agent answers with the context that
            it has)

            and `declineWithError` (the agent tells the user that it can't
            answer,

            instead of answering without grounding). The default is
            `answerAnyway`. The

            setting applies to every `ragMode`.
          type: string
        ragMode:
          description: >-
            When the agent searches its knowledge. The allowed values are
            `never` (no

            search), `always` (in a text session, the search runs before the
            first LLM

            call of each turn and the result is added to the turn context; in a
            realtime

            voice session, the agent searches on demand, as in `agent`) and
            `agent` (the

            LLM decides whether to call the knowledge search tool).
          type: string
        ragType:
          description: >-
            The backend that powers the knowledge search. The only allowed value
            is

            `cognigy`. The field is required when `ragMode` is `always` or
            `agent`.
          type: string
      type: object
    internal_agents.LLMConfigResponse:
      properties:
        maxOutputTokens:
          description: >-
            The maximum number of tokens that the model generates in a response.
            The

            value must be greater than 0.
          type: integer
        reasoningEffort:
          description: >-
            The reasoning effort of the model, which controls its internal
            thinking

            budget. The allowed values are `none`, `minimal`, `low`, `medium`,
            `high`

            and `xhigh`. Reasoning tokens are billed as completion tokens.
          type: string
        temperature:
          description: The sampling temperature of the model, from 0 to 2.
          type: number
      type: object
    github_com_cognigy_ai-agents-v2_internal_middleware.FieldError:
      properties:
        field:
          type: string
        message:
          type: string
      type: object
    internal_agents.DataPrivacyRequest:
      properties:
        contactProfilesOption:
          description: >-
            The part of the Contact Profile that the agent reads into its system
            prompt.

            The allowed values are `none`, `completeProfile`,
            `profileMemoriesOnly` and

            `selectedProfileFields`. The field is required when `dataPrivacy` is

            present.
          example: completeProfile
          type: string
        selectedProfileFields:
          description: >-
            The names of the Contact Profile fields that the agent reads into
            its system

            prompt. The agent reads them only if `contactProfilesOption` is

            `selectedProfileFields`. The API doesn't check the names against the
            Profile

            Schema, so a name that doesn't resolve adds nothing to the prompt.
          items:
            type: string
          type: array
      type: object
    internal_agents.SafetySettingsRequest:
      properties:
        avoidCopyrightInfringements:
          description: >-
            If set to `true`, the system prompt of the agent contains the safety

            instruction to avoid copyright infringements. The default is `true`
            on

            create. In an update, an omitted toggle is stored as `false`,
            because the

            object that you send replaces the stored `safetySettings`.
          type: boolean
        avoidHarmfulContent:
          description: >-
            If set to `true`, the system prompt of the agent contains the safety

            instruction to avoid harmful content. The default is `true` on
            create. In an

            update, an omitted toggle is stored as `false`, because the object
            that you

            send replaces the stored `safetySettings`.
          type: boolean
        avoidUngroundedContent:
          description: >-
            If set to `true`, the system prompt of the agent contains the safety

            instruction to avoid ungrounded content. The default is `true` on
            create. In

            an update, an omitted toggle is stored as `false`, because the
            object that

            you send replaces the stored `safetySettings`.
          type: boolean
        preventJailbreakAndManipulation:
          description: >-
            If set to `true`, the system prompt of the agent contains the safety

            instruction to prevent jailbreak and manipulation. The default is
            `true` on

            create. In an update, an omitted toggle is stored as `false`,
            because the

            object that you send replaces the stored `safetySettings`.
          type: boolean
      type: object
    internal_agents.PreTurnHook:
      properties:
        handler:
          allOf:
            - $ref: '#/components/schemas/internal_agents.HookHandler'
          description: The handler that the hook runs.
      type: object
    internal_agents.CognigyRAGParametersDTO:
      properties:
        language:
          description: >-
            The language tag of the search, for example `en-US`. The default is
            `en-US`.
          type: string
        stores:
          description: >-
            The unique identifiers for the knowledge stores to search. If the
            list is

            empty, the search covers all knowledge stores.
          items:
            type: string
          type: array
        topK:
          description: >-
            The maximum number of results that the knowledge search returns. The
            value

            must be greater than 0. The default is 5.
          type: integer
      type: object
    internal_agents.DataPrivacyResponse:
      properties:
        contactProfilesOption:
          description: >-
            The part of the Contact Profile that the agent reads into its system
            prompt.

            The possible values are `none`, `completeProfile`,
            `profileMemoriesOnly` and

            `selectedProfileFields`.
          example: completeProfile
          type: string
        selectedProfileFields:
          description: >-
            The names of the Contact Profile fields that the agent reads into
            its system

            prompt. The agent reads them only if `contactProfilesOption` is

            `selectedProfileFields`. The API returns the list as stored, even if

            `contactProfilesOption` has another value.
          items:
            type: string
          type: array
      type: object
    internal_agents.SafetySettingsResponse:
      properties:
        avoidCopyrightInfringements:
          description: >-
            `true` if the system prompt of the agent contains the safety
            instruction to

            avoid copyright infringements; `false` otherwise.
          type: boolean
        avoidHarmfulContent:
          description: >-
            `true` if the system prompt of the agent contains the safety
            instruction to

            avoid harmful content; `false` otherwise.
          type: boolean
        avoidUngroundedContent:
          description: >-
            `true` if the system prompt of the agent contains the safety
            instruction to

            avoid ungrounded content; `false` otherwise.
          type: boolean
        preventJailbreakAndManipulation:
          description: >-
            `true` if the system prompt of the agent contains the safety
            instruction to

            prevent jailbreak and manipulation; `false` otherwise.
          type: boolean
      type: object
    internal_agents.HookHandler:
      properties:
        flowReferenceId:
          description: >-
            The reference identifier for the flow that the hook runs, in UUID
            format.

            The field is required for the `conversationFlow` kind. The API
            doesn't check

            that the flow exists.
          type: string
        kind:
          description: The kind of handler. The only allowed value is `conversationFlow`.
          type: string
      type: object
  securitySchemes:
    ApiKey:
      description: '[Production] API key for production authentication'
      in: header
      name: X-API-Key
      type: apiKey

````