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

# Create Agent

> Endpoint to create a new agent.
- No Mage triggers are created during agent creation
- Triggers are lazily created when first scheduling a run via /schedule_run
- This allows for flexible scheduling (cron expressions, @hourly, @daily, etc.)



## OpenAPI

````yaml /api-reference/openapi.json post /api/agents
openapi: 3.1.0
info:
  title: apowerb API
  description: REST API of the apowerb agentic framework (open-source edition).
  version: 0.1.2
  license:
    name: MIT
    url: https://github.com/apowerb/apowerb/blob/main/LICENSE
servers:
  - url: https://api.example.com
    description: Your apowerb instance
  - url: http://localhost:8000
    description: Local stack
security: []
paths:
  /api/agents:
    post:
      tags:
        - agents
      summary: Create Agent
      description: >-
        Endpoint to create a new agent.

        - No Mage triggers are created during agent creation

        - Triggers are lazily created when first scheduling a run via
        /schedule_run

        - This allows for flexible scheduling (cron expressions, @hourly,
        @daily, etc.)
      operationId: create_agent_api_agents_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AgentCreateSchema'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    AgentCreateSchema:
      properties:
        agent_name:
          type: string
          title: Agent Name
        agent_model:
          type: string
          title: Agent Model
        agent_model_params:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Agent Model Params
        agent_description:
          type: string
          title: Agent Description
        agent_instruction:
          type: string
          title: Agent Instruction
        agent_tools:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Agent Tools
          default: []
        input_schema:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Input Schema
        output_schema:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Output Schema
        output_key:
          anyOf:
            - type: string
            - type: 'null'
          title: Output Key
        output_schema_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Output Schema Name
        skip_when_upstream:
          anyOf:
            - type: string
            - type: 'null'
          title: Skip When Upstream
        sub_agents:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Sub Agents
        agent_type:
          type: string
          title: Agent Type
        project_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Project Id
          default: thaink2
        code_executor:
          anyOf:
            - type: string
            - type: 'null'
          title: Code Executor
        tags:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Tags
        guardrails_config:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Guardrails Config
        memory_enabled:
          type: boolean
          title: Memory Enabled
          default: false
        artifacts_enabled:
          type: boolean
          title: Artifacts Enabled
          default: false
        superagent_template_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Superagent Template Id
        loop_max_iterations:
          anyOf:
            - type: integer
            - type: 'null'
          title: Loop Max Iterations
        loop_exit_instruction:
          anyOf:
            - type: string
            - type: 'null'
          title: Loop Exit Instruction
        mcp_servers:
          anyOf:
            - items:
                $ref: '#/components/schemas/McpServerConfig'
              type: array
            - type: 'null'
          title: Mcp Servers
        agent_skills:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Agent Skills
        hub_origin_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Hub Origin Id
        propagate_api_key:
          type: boolean
          title: Propagate Api Key
          default: false
      type: object
      required:
        - agent_name
        - agent_model
        - agent_description
        - agent_instruction
        - agent_type
      title: AgentCreateSchema
      description: |-
        Schema for creating a new agent.
        Attributes:
            name: str - The name of the agent.
            model: str - The model used by the agent.
            description: str - A brief description of the agent.
            instruction: str - Instructions for the agent's behavior.
            tools: list[str] - A list of tool paths used by the agent.
            input_schema: dict | None - The input schema for the agent (optional).
            output_schema: dict | None - The output schema for the agent (optional).
            organization_id: str - The ID of the organization the agent belongs to.
            project_id: str - The ID of the project the agent is associated with.
            owner_id: str - The ID of the owner of the agent.
            tags: list[str] | None - A list of tags associated with the agent (optional).
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    McpServerConfig:
      properties:
        name:
          type: string
          title: Name
          default: ''
        transport:
          type: string
          title: Transport
          default: http
        url:
          type: string
          title: Url
          default: ''
        headers:
          additionalProperties:
            type: string
          type: object
          title: Headers
          default: {}
        params:
          additionalProperties:
            type: string
          type: object
          title: Params
          default: {}
        command:
          type: string
          title: Command
          default: ''
        args:
          items:
            type: string
          type: array
          title: Args
          default: []
        env:
          additionalProperties:
            type: string
          type: object
          title: Env
          default: {}
        mcp_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Mcp Type
        toolset:
          anyOf:
            - type: string
            - type: 'null'
          title: Toolset
        db_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Db Type
        db_database:
          anyOf:
            - type: string
            - type: 'null'
          title: Db Database
      type: object
      title: McpServerConfig
      description: >-
        Configuration for a single MCP server attached to an agent.


        Supports two transports:

        - 'http': Streamable HTTP (url + headers + params injected as query
        string)

        - 'stdio': Local process (command + args + env vars)


        The optional ``mcp_type`` field carries semantic info propagated from

        the saved MCP config:

        - "toolbox-db": MCP Toolbox for Databases (uses ToolboxToolset, not the
          generic McpToolset). ``toolset`` selects a named toolset from the
          toolbox (empty = all tools).
        - "" / unset: standard MCP HTTP/SSE/Stdio server.
    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
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````

## Related topics

- [Create Agent Trigger](/api-reference/scheduler/create-agent-trigger.md)
- [Quickstart](/quickstart.md)
- [Create Session](/api-reference/adk/create-session.md)
- [Create Subscription](/api-reference/webhooks/create-subscription.md)
- [Create a chart](/api-reference/charts/create-a-chart.md)
