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

# Create Agent Type

> Create a new agent type.

Returns:
    Created agent type with server-populated fields.

Raises:
    AgentTypeAlreadyExistsError: If name already taken in organization.



## OpenAPI

````yaml https://api.pragmatiks.io/openapi.json post /agents/types/
openapi: 3.1.0
info:
  title: Pragma API
  version: 0.1.0
servers: []
security: []
paths:
  /agents/types/:
    post:
      tags:
        - agent-types
      summary: Create Agent Type
      description: |-
        Create a new agent type.

        Returns:
            Created agent type with server-populated fields.

        Raises:
            AgentTypeAlreadyExistsError: If name already taken in organization.
      operationId: agent-types-create_agent_type
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AgentTypeCreate'
        required: true
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/pragma_api__models__agent_type__AgentType'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    AgentTypeCreate:
      properties:
        name:
          type: string
          title: Name
        display_name:
          type: string
          title: Display Name
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
        icon:
          anyOf:
            - type: string
            - type: 'null'
          title: Icon
        provider:
          type: string
          title: Provider
        model:
          type: string
          title: Model
        temperature:
          anyOf:
            - type: number
            - type: 'null'
          title: Temperature
        context_window:
          anyOf:
            - type: integer
            - type: 'null'
          title: Context Window
        system_instructions:
          anyOf:
            - type: string
            - type: 'null'
          title: System Instructions
        mcp_servers:
          items:
            type: string
          type: array
          title: Mcp Servers
        builtin_tools:
          items:
            type: string
          type: array
          title: Builtin Tools
        default_plan_template:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Default Plan Template
        agent_resource_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Agent Resource Id
        runner_resource_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Runner Resource Id
        conversation_routing:
          anyOf:
            - $ref: '#/components/schemas/ConversationRoutingManifest'
            - type: 'null'
      type: object
      required:
        - name
        - display_name
        - provider
        - model
      title: AgentTypeCreate
      description: |-
        Request body for creating an agent type.

        Attributes:
            name: Machine-readable name unique within organization.
            display_name: Human-readable name shown in UI.
            description: Agent purpose and capabilities.
            icon: Icon identifier or URL.
            provider: LLM provider (e.g., "anthropic", "openai").
            model: Model identifier (e.g., "claude-opus-4", "gpt-4").
            temperature: Sampling temperature for generation.
            context_window: Maximum context window size in tokens.
            system_instructions: System prompt for the agent.
            mcp_servers: MCP server identifiers available to the agent.
            builtin_tools: Built-in tool identifiers available to the agent.
            default_plan_template: Default plan steps for new tasks.
            agent_resource_id: SurrealDB resource ID for the agent type.
            runner_resource_id: SurrealDB resource ID for the runner resource.
            conversation_routing: Routing rules for conversation assignment.
    pragma_api__models__agent_type__AgentType:
      properties:
        created_at:
          type: string
          format: date-time
          title: Created At
        updated_at:
          type: string
          format: date-time
          title: Updated At
        id:
          anyOf:
            - type: string
            - type: 'null'
          title: Id
        name:
          type: string
          title: Name
        display_name:
          type: string
          title: Display Name
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
        icon:
          anyOf:
            - type: string
            - type: 'null'
          title: Icon
        provider:
          type: string
          title: Provider
        model:
          type: string
          title: Model
        temperature:
          anyOf:
            - type: number
            - type: 'null'
          title: Temperature
        context_window:
          anyOf:
            - type: integer
            - type: 'null'
          title: Context Window
        system_instructions:
          anyOf:
            - type: string
            - type: 'null'
          title: System Instructions
        mcp_servers:
          items:
            type: string
          type: array
          title: Mcp Servers
        builtin_tools:
          items:
            type: string
          type: array
          title: Builtin Tools
        default_plan_template:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Default Plan Template
        agent_resource_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Agent Resource Id
        runner_resource_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Runner Resource Id
        created_by:
          anyOf:
            - type: string
            - type: 'null'
          title: Created By
        version:
          type: integer
          title: Version
          default: 1
        conversation_routing:
          anyOf:
            - $ref: '#/components/schemas/ConversationRoutingManifest'
            - type: 'null'
        role:
          anyOf:
            - type: string
            - type: 'null'
          title: Role
      type: object
      required:
        - name
        - display_name
        - provider
        - model
      title: AgentType
      description: |-
        Domain model for agent types with LLM configuration and tooling.

        Agent types live inside the tenant SurrealDB namespace — the
        namespace is the organization boundary, so the record itself
        carries no ``organization_id`` field.

        Identity fields (frozen - immutable after creation):
            name: Machine-readable name unique within the namespace.

        Configuration fields (mutable):
            display_name: Human-readable name shown in UI.
            description: Agent purpose and capabilities.
            icon: Icon identifier or URL.
            provider: LLM provider (e.g., "anthropic", "openai").
            model: Model identifier (e.g., "claude-opus-4", "gpt-4").
            temperature: Sampling temperature for generation.
            context_window: Maximum context window size in tokens.
            system_instructions: System prompt for the agent.
            mcp_servers: MCP server identifiers available to the agent.
            builtin_tools: Built-in tool identifiers available to the agent.
            default_plan_template: Default plan steps for new tasks.
            conversation_routing: Routing rules for conversation assignment.

        Resource fields (linking to pragma resources):
            agent_resource_id: SurrealDB resource ID for the agent type.
            runner_resource_id: SurrealDB resource ID for the runner resource.

        Platform fields (system-managed):
            role: Optional platform role marker. ``"main_router"``
                identifies the single entry-point agent for
                ``POST /agents/chat``. ``None`` for user-created types.

        Audit fields:
            created_by: User ID of the creator.
            version: Schema version for migration support.

        Inherited from PragmaModel:
            created_at: Creation timestamp (frozen).
            updated_at: Last update timestamp (mutable).
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ConversationRoutingManifest:
      properties:
        when:
          type: string
          title: When
        examples:
          items:
            type: string
          type: array
          title: Examples
        avoid:
          anyOf:
            - type: string
            - type: 'null'
          title: Avoid
      type: object
      required:
        - when
      title: ConversationRoutingManifest
      description: |-
        Routing rules for conversation-to-agent assignment.

        Attributes:
            when: Natural language description of when this agent should handle a conversation.
            examples: Example messages that should route to this agent.
            avoid: Natural language description of messages this agent should not handle.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````