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

# Create Agent Endpoint

> Create a new AI agent with custom configuration.

This endpoint creates a new agent that can be customized with specific instructions, demonstrations, and model parameters.

**Request Body:**

- `agent_name`: Name of the agent (will be normalized to URL-friendly format)
- `agent_description`: Description of the agent's purpose
- `model`: Model ID (base model or organization's aligned model)
- `max_tokens`: Maximum tokens for agent responses
- `temperature`: Sampling temperature for response generation (0.0-2.0, default: 0.7)
- `instructions` (optional): System prompt/instructions
- `demonstrations` (optional): List of example interactions for few-shot learning

**Returns:**

- `data`: Agent data object with the following fields:
  - `id`: Unique agent identifier
  - `name`: Normalized agent name (lowercase with underscores)
  - `description`: Agent description
  - `base_model`: Model ID used by the agent
  - `base_model_name`: Human-readable model name
  - `created_date`: ISO 8601 timestamp of creation
  - `status`: Agent status (e.g., "ACTIVE")
  - `creator`: Username/email of the agent creator
  - `endpoint`: Full API endpoint URL for running the agent
  - `usage_count`: Initial count (0)
  - `last_used`: Last usage timestamp (null for new agents)
  - `performance_metrics`: Performance statistics
  - `system_prompt`: Agent instructions
  - `temperature`: Temperature for model responses (0.0-2.0)
  - `conversation_saving_enabled`: Whether conversations are saved

**Errors:**

- `400`: Requested model is not available to the user's organization
- `401`: User is not found or unauthorized

**Example Request:**

```json
POST /api/v3/agents/create
Headers: {"Authorization": "Bearer <api_key>"}

{
  "agent_name": "Customer Support Bot",
  "agent_description": "Handles customer inquiries with empathy",
  "model": "nugen-flash-instruct",
  "max_tokens": 2000,
  "temperature": 0.7,
  "instructions": "You are a helpful customer support agent. Be empathetic and solution-oriented.",
  "demonstrations": [
    {
      "input": "How do I reset my password?",
      "output": "I'd be happy to help you reset your password..."
    }
  ]
}
```

**Example Response:**

```json
{
  "data": {
    "id": "agent-abc123",
    "name": "customer_support_bot",
    "description": "Handles customer inquiries with empathy",
    "base_model": "nugen-flash-instruct",
    "base_model_name": "Nugen Flash Instruct",
    "created_date": "2024-01-15T10:30:00Z",
    "status": "ACTIVE",
    "creator": "user@example.com",
    "endpoint": "https://api.nugen.in/api/v3/agents/run-agents/customer_support_bot/run",
    "usage_count": 0,
    "last_used": null,
    "performance_metrics": {
      "total_requests": 0,
      "average_response_time": 0,
      "success_rate": 0
    },
    "system_prompt": "You are a helpful customer support agent. Be empathetic and solution-oriented.",
    "temperature": 0.7,
    "conversation_saving_enabled": false
  }
}
```



## OpenAPI

````yaml https://api.nugen.in/openapi-public.json post /api/v3/agents/create
openapi: 3.1.0
info:
  title: Nugen Intelligence API
  description: 'Nugen Intelligence : Powering Specialized Intelligence At Scale'
  version: 25.4.20
servers: []
security: []
paths:
  /api/v3/agents/create:
    post:
      tags:
        - Agents
      summary: Create Agent Endpoint
      description: >-
        Create a new AI agent with custom configuration.


        This endpoint creates a new agent that can be customized with specific
        instructions, demonstrations, and model parameters.


        **Request Body:**


        - `agent_name`: Name of the agent (will be normalized to URL-friendly
        format)

        - `agent_description`: Description of the agent's purpose

        - `model`: Model ID (base model or organization's aligned model)

        - `max_tokens`: Maximum tokens for agent responses

        - `temperature`: Sampling temperature for response generation (0.0-2.0,
        default: 0.7)

        - `instructions` (optional): System prompt/instructions

        - `demonstrations` (optional): List of example interactions for few-shot
        learning


        **Returns:**


        - `data`: Agent data object with the following fields:
          - `id`: Unique agent identifier
          - `name`: Normalized agent name (lowercase with underscores)
          - `description`: Agent description
          - `base_model`: Model ID used by the agent
          - `base_model_name`: Human-readable model name
          - `created_date`: ISO 8601 timestamp of creation
          - `status`: Agent status (e.g., "ACTIVE")
          - `creator`: Username/email of the agent creator
          - `endpoint`: Full API endpoint URL for running the agent
          - `usage_count`: Initial count (0)
          - `last_used`: Last usage timestamp (null for new agents)
          - `performance_metrics`: Performance statistics
          - `system_prompt`: Agent instructions
          - `temperature`: Temperature for model responses (0.0-2.0)
          - `conversation_saving_enabled`: Whether conversations are saved

        **Errors:**


        - `400`: Requested model is not available to the user's organization

        - `401`: User is not found or unauthorized


        **Example Request:**


        ```json

        POST /api/v3/agents/create

        Headers: {"Authorization": "Bearer <api_key>"}


        {
          "agent_name": "Customer Support Bot",
          "agent_description": "Handles customer inquiries with empathy",
          "model": "nugen-flash-instruct",
          "max_tokens": 2000,
          "temperature": 0.7,
          "instructions": "You are a helpful customer support agent. Be empathetic and solution-oriented.",
          "demonstrations": [
            {
              "input": "How do I reset my password?",
              "output": "I'd be happy to help you reset your password..."
            }
          ]
        }

        ```


        **Example Response:**


        ```json

        {
          "data": {
            "id": "agent-abc123",
            "name": "customer_support_bot",
            "description": "Handles customer inquiries with empathy",
            "base_model": "nugen-flash-instruct",
            "base_model_name": "Nugen Flash Instruct",
            "created_date": "2024-01-15T10:30:00Z",
            "status": "ACTIVE",
            "creator": "user@example.com",
            "endpoint": "https://api.nugen.in/api/v3/agents/run-agents/customer_support_bot/run",
            "usage_count": 0,
            "last_used": null,
            "performance_metrics": {
              "total_requests": 0,
              "average_response_time": 0,
              "success_rate": 0
            },
            "system_prompt": "You are a helpful customer support agent. Be empathetic and solution-oriented.",
            "temperature": 0.7,
            "conversation_saving_enabled": false
          }
        }

        ```
      operationId: create_agent
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateAgentRequest'
        required: true
      responses:
        '200':
          description: >-
            Returns the details of the newly created agent including its unique
            identifier, configuration, usage statistics, and endpoint URL for
            execution
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentCreateResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    CreateAgentRequest:
      properties:
        agent_name:
          type: string
          title: Agent Name
          description: Name of the agent
          example: Customer Support Agent
        agent_description:
          type: string
          title: Agent Description
          description: Description of the agent
          example: An agent designed to handle customer support queries
        model:
          type: string
          title: Model
          description: Base model identifier
          example: nugen-flash-instruct
        max_tokens:
          anyOf:
            - type: integer
            - type: 'null'
          title: Max Tokens
          description: Maximum number of tokens to generate in the response
          default: 500
          example: 500
        temperature:
          type: number
          maximum: 2
          minimum: 0
          title: Temperature
          description: Temperature for model responses (0.0-2.0)
          default: 0.7
          example: 0.7
        instructions:
          anyOf:
            - type: string
            - type: 'null'
          title: Instructions
          description: >-
            System prompt for the agent (optional, defaults to 'You are a
            helpful AI assistant.')
          example: You are a helpful customer support assistant.
        demonstrations:
          anyOf:
            - items:
                additionalProperties:
                  type: string
                type: object
              type: array
            - type: 'null'
          title: Demonstrations
          description: Training demonstrations
      type: object
      required:
        - agent_name
        - agent_description
        - model
      title: CreateAgentRequest
    AgentCreateResponse:
      properties:
        data:
          $ref: '#/components/schemas/AgentData'
      type: object
      required:
        - data
      title: AgentCreateResponse
      description: Response model for agent creation endpoint.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    AgentData:
      properties:
        id:
          type: string
          title: Id
          description: Unique agent identifier
          example: agent-12345
        name:
          type: string
          title: Name
          description: Agent name
          example: Customer Support Agent
        description:
          type: string
          title: Description
          description: Agent description
          example: An agent designed to handle customer support queries
        base_model:
          type: string
          title: Base Model
          description: Base model identifier
          example: nugen-flash-instruct
        base_model_name:
          type: string
          title: Base Model Name
          description: Base model display name
          example: Nugen Flash Instruct
        created_date:
          type: string
          title: Created Date
          description: Agent creation date
          example: '2024-01-15T10:30:00Z'
        status:
          $ref: '#/components/schemas/AgentStatus'
          description: Agent status
          example: ACTIVE
        creator:
          type: string
          title: Creator
          description: Agent creator username
          example: youremail@domain.com
        endpoint:
          type: string
          title: Endpoint
          description: Agent API endpoint
          example: https://api.nugen.in/api/v3/inference/completions/agent-12345
        usage_count:
          type: integer
          title: Usage Count
          description: Number of times agent has been used
          example: 150
        last_used:
          anyOf:
            - type: string
            - type: 'null'
          title: Last Used
          description: Last usage timestamp
          example: '2024-01-20T14:30:00Z'
        performance_metrics:
          $ref: '#/components/schemas/AgentPerformanceMetrics'
          description: Agent performance metrics
        system_prompt:
          type: string
          title: System Prompt
          description: System prompt for the agent
          example: You are a helpful customer support assistant.
        temperature:
          type: number
          title: Temperature
          description: Temperature for model responses (0.0-2.0)
          example: 0.7
        conversation_saving_enabled:
          type: boolean
          title: Conversation Saving Enabled
          description: Whether conversation saving is enabled for this agent
          default: false
          example: true
      type: object
      required:
        - id
        - name
        - description
        - base_model
        - base_model_name
        - created_date
        - status
        - creator
        - endpoint
        - usage_count
        - performance_metrics
        - system_prompt
        - temperature
      title: AgentInfo
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    AgentStatus:
      type: string
      enum:
        - ACTIVE
        - INACTIVE
      title: AgentStatus
    AgentPerformanceMetrics:
      properties:
        average_uncertainty:
          type: number
          title: Average Uncertainty
          description: Average uncertainty across all agent responses
          example: 0.15
        human_interventions:
          type: integer
          title: Human Interventions
          description: Number of times human intervention was required
          example: 5
        average_response_time:
          type: number
          title: Average Response Time
          description: Average response time in seconds
          example: 1.2
        user_satisfaction_score:
          type: number
          title: User Satisfaction Score
          description: Average user satisfaction score from 0.0 to 1.0
          example: 0.85
      type: object
      required:
        - average_uncertainty
        - human_interventions
        - average_response_time
        - user_satisfaction_score
      title: AgentPerformanceMetrics
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````