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

# Create a new agent



## OpenAPI

````yaml post /api/agent-server/agents
openapi: 3.0.3
info:
  title: HasteKit Gateway API
  description: API specification for the HasteKit Gateway
  version: 1.0.0
servers:
  - url: http://localhost:6060
    description: Local development server
  - url: https://app.hastekit.ai
    description: Production server
security: []
tags:
  - name: Health
    description: Health check endpoints
  - name: Projects
    description: Project management endpoints
  - name: Agents
    description: Agent configuration endpoints
  - name: Models
    description: Model configuration endpoints
  - name: Prompts
    description: Prompt management endpoints
  - name: Providers
    description: Provider and API key management endpoints
  - name: VirtualKeys
    description: Virtual key management endpoints
  - name: MCPServers
    description: MCP server management endpoints
  - name: Schemas
    description: Schema management endpoints
  - name: Conversations
    description: Conversation, thread, and message management endpoints
  - name: Gateway
    description: LLM Gateway endpoints
  - name: Converse
    description: Agent conversation endpoints
  - name: Traces
    description: Tracing and observability endpoints
paths:
  /api/agent-server/agents:
    post:
      tags:
        - Agents
      summary: Create a new agent
      operationId: createAgent
      parameters:
        - name: project_id
          in: query
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateAgentRequest'
      responses:
        '200':
          description: Agent created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  schemas:
    CreateAgentRequest:
      type: object
      required:
        - name
        - model_id
        - prompt_id
      properties:
        name:
          type: string
        model_id:
          type: string
          format: uuid
        prompt_id:
          type: string
          format: uuid
        prompt_label:
          type: string
          enum:
            - production
            - latest
        schema_id:
          type: string
          format: uuid
          nullable: true
        enable_history:
          type: boolean
        summarizer_type:
          type: string
          enum:
            - llm
            - sliding_window
            - none
        llm_summarizer_token_threshold:
          type: integer
        llm_summarizer_keep_recent_count:
          type: integer
        llm_summarizer_prompt_id:
          type: string
          format: uuid
        llm_summarizer_prompt_label:
          type: string
          enum:
            - production
            - latest
        llm_summarizer_model_id:
          type: string
          format: uuid
        sliding_window_keep_count:
          type: integer
        mcp_servers:
          type: array
          items:
            $ref: '#/components/schemas/AgentMCPServerReq'
    AgentResponse:
      allOf:
        - $ref: '#/components/schemas/StandardResponse'
        - type: object
          properties:
            data:
              $ref: '#/components/schemas/Agent'
    AgentMCPServerReq:
      type: object
      required:
        - mcp_server_id
      properties:
        mcp_server_id:
          type: string
          format: uuid
        tool_filters:
          type: array
          items:
            type: string
    StandardResponse:
      type: object
      properties:
        error:
          type: boolean
        message:
          type: string
        data:
          type: object
        status:
          type: integer
        errorDetails:
          type: object
    Agent:
      type: object
      properties:
        id:
          type: string
          format: uuid
        project_id:
          type: string
          format: uuid
        name:
          type: string
        model_id:
          type: string
          format: uuid
        prompt_id:
          type: string
          format: uuid
        prompt_label:
          type: string
          nullable: true
        schema_id:
          type: string
          format: uuid
          nullable: true
        enable_history:
          type: boolean
        summarizer_type:
          type: string
          nullable: true
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
  responses:
    BadRequest:
      description: Bad request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/StandardResponse'
          example:
            error: true
            message: Invalid request
            status: 400
    InternalServerError:
      description: Internal server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/StandardResponse'
          example:
            error: true
            message: Internal server error
            status: 500

````