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

# Create Agents

> This endpoint used to create the new custom agent to the Pawa AI Platform.



## OpenAPI

````yaml POST /agents/create
openapi: 3.1.0
info:
  title: Pawa AI APIs
  description: >-
    API endpoints in Pawa Platform to perform CRUD operations on different
    features using Pawa AI, a digital assistant built for Africa for various
    tasks.
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.pawa-ai.com/v1
    description: Production Server
security:
  - bearerAuth: []
paths:
  /agents/create:
    post:
      tags:
        - Create Agents
      summary: Create a new custom agent
      description: >-
        This endpoint used to create the new custom agent to the Pawa AI
        Platform.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateAgentRequestDto'
      responses:
        '200':
          description: Agent created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentCreateResponseDto'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                badRequest:
                  value:
                    success: false
                    message: Invalid input provided
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                unauthorized:
                  value:
                    success: false
                    message: Unauthorized access
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                forbidden:
                  value:
                    success: false
                    message: You do not have permission to access this resource
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                notFound:
                  value:
                    success: false
                    message: Resource does not exist
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                tooManyRequests:
                  value:
                    success: false
                    message: Rate limit exceeded. Please try again later.
        '500':
          description: Unexpected error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                serverError:
                  value:
                    success: false
                    message: Internal server error
components:
  schemas:
    CreateAgentRequestDto:
      type: object
      properties:
        name:
          type: string
          description: The name of the agent
          example: TutorAI
        description:
          type: string
          description: The description about the agent
          example: >-
            TutorAI is an AI agent designed to assist students with their
            studies.
        instruction:
          type: string
          description: What should the agent do
          example: >-
            Teaching students on subjects ranging from form 0ne to form 4.
            Follow questions properly and do not answer any other questions
            apart from what you have been tasked to
        intents:
          type: array
          description: The list of intents, how the model should behave?
          example:
            - Be gentle
            - Be detailed
        knowledgeBaseId:
          type: number
          description: The knowledge base ID to be used by the agent
          example: 159
        tools:
          description: >-
            Tools to provide to the model (as a JSON string). Eg. Built-in tools
            includes web_search_tool
          example:
            - type: function
              function:
                name: convert_usd_to_tsh
                description: Converts an amount in USD to Tanzanian Shillings.
                strict: true
                parameters:
                  type: object
                  properties:
                    amount_usd:
                      description: Amount in USD
                      type: number
                  required:
                    - amount_usd
                  additionalProperties: false
            - type: pawa_tool
              pawa_tool: web_search_tool
          type: array
          items:
            $ref: '#/components/schemas/ToolItem'
      required:
        - name
        - description
        - instruction
        - intents
    AgentCreateResponseDto:
      type: object
      properties:
        success:
          type: boolean
          example: true
        message:
          type: string
          example: Agent created successfully
        data:
          $ref: '#/components/schemas/AgentCreateResponseData'
      required:
        - success
        - message
        - data
    ErrorResponse:
      required:
        - success
        - message
      type: object
      properties:
        success:
          type: boolean
          example: false
        message:
          type: string
          example: An error occurred
    ToolItem:
      oneOf:
        - type: object
          title: Custom Tools
          properties:
            type:
              type: string
              default: function
              example: function
              enum:
                - function
            function:
              $ref: '#/components/schemas/FunctionTool'
          required:
            - type
            - function
        - type: object
          title: Built-In Tools
          properties:
            type:
              type: string
              default: pawa_tool
              example: pawa_tool
              enum:
                - pawa_tool
            pawa_tool:
              type: string
          required:
            - type
            - pawa_tool
    AgentCreateResponseData:
      type: object
      properties:
        id:
          type: number
          example: 0
        agentReferenceId:
          type: string
          example: 67cf5354-89f0-8001-b038-b2645377b214
        name:
          type: string
          example: TutorAI
        description:
          type: string
          example: >-
            TutorAI is an AI agent designed to assist students with their
            studies.
        instruction:
          type: string
          example: >-
            Teaching students on subjects ranging from form one to form 4.
            Follow questions properly and do not answer any other questions
            apart from what you have been tasked to
        status:
          type: string
          description: The status of the agent
          example: ACTIVE
        createdAt:
          type: string
          example: '2021-09-01T00:00:00.000Z'
        updatedAt:
          type: string
          example: '2021-09-01T00:00:00.000Z'
      required:
        - id
        - agentReferenceId
        - name
        - description
        - instruction
        - status
        - createdAt
        - updatedAt
    FunctionTool:
      type: object
      properties:
        name:
          type: string
        description:
          type: string
        strict:
          type: boolean
        parameters:
          $ref: '#/components/schemas/FunctionParametersSchema'
      required:
        - name
        - description
        - strict
        - parameters
    FunctionParametersSchema:
      type: object
      properties:
        type:
          type: string
          default: object
          example: object
          enum:
            - object
        properties:
          type: object
          description: Properties for the parameters object
          additionalProperties:
            type: object
            properties:
              description:
                type: string
              type:
                type: string
            required:
              - description
              - type
        required:
          description: Required parameter names
          type: array
          items:
            type: string
        additionalProperties:
          type: boolean
          description: Allow additional properties
          default: false
      required:
        - type
        - properties
        - required
        - additionalProperties
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````