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

# Create Parent Agent

> Create a parent agent for the authenticated tenant.



## OpenAPI

````yaml /api-reference/openapi.json post /api/parent_agents
openapi: 3.1.0
info:
  title: Maadify API
  description: Public and admin API endpoints for Maadify.
  version: 1.0.0
servers:
  - url: https://app.maadify.com
    description: Production
security: []
tags:
  - name: Parent agents
    description: Create, update, and configure parent agents.
  - name: Sub-agents
    description: Create sub-agents and assign them to parent agents.
  - name: Tools
    description: Search tools and manage tool assignments.
  - name: Prompt templates
    description: Search and manage prompt templates.
  - name: Users
    description: Search users available to the authenticated tenant.
  - name: Models
    description: Search available LLM models.
  - name: Files
    description: Check file upload status.
paths:
  /api/parent_agents:
    post:
      tags:
        - Parent agents
      summary: Create Parent Agent
      description: Create a parent agent for the authenticated tenant.
      operationId: create_parent_agent_endpoint_api_parent_agents_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ParentAgentCreateRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ParentAgentMutationResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - BearerAuth: []
components:
  schemas:
    ParentAgentCreateRequest:
      properties:
        parent_agent_type_key:
          anyOf:
            - type: string
              minLength: 1
            - type: 'null'
          title: Parent Agent Type Key
          description: Parent agent type key, provide this or parent_agent_type.
        parent_agent_type:
          anyOf:
            - type: string
              minLength: 1
            - type: 'null'
          title: Parent Agent Type
          description: >-
            Human-readable parent agent type, provide this or
            parent_agent_type_key.
        agent_name:
          type: string
          minLength: 1
          title: Parent Agent Name
          description: >-
            Human-readable parent agent name. The stored action key is created
            from this value by converting spaces to underscores and lowercasing
            it.
        description:
          type: string
          minLength: 1
          title: Description
          description: Clear summary of what the parent agent should accomplish.
        active:
          type: boolean
          title: Active
          description: Turns the parent agent on or off.
          default: true
      type: object
      required:
        - agent_name
        - description
      title: ParentAgentCreateRequest
    ParentAgentMutationResponse:
      properties:
        success:
          type: boolean
          title: Success
          description: Whether the request was successful.
        error_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Error Type
          description: Type of error if the request failed.
        error_message:
          anyOf:
            - type: string
            - type: 'null'
          title: Error Message
          description: Error message or informational message.
        data:
          $ref: '#/components/schemas/ParentAgentMutationData'
          description: Parent agent mutation results.
      type: object
      required:
        - success
        - data
      title: ParentAgentMutationResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ParentAgentMutationData:
      properties:
        items:
          items:
            $ref: '#/components/schemas/ParentAgentListItem'
          type: array
          title: Items
          description: Created or updated parent agent rows.
      type: object
      title: ParentAgentMutationData
    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
    ParentAgentListItem:
      properties:
        id:
          anyOf:
            - type: integer
            - type: 'null'
          title: Id
          description: Parent agent ID.
        parent_agent_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Parent Agent Type
          description: Human-readable parent agent type.
        parent_agent_type_key:
          anyOf:
            - type: string
            - type: 'null'
          title: Parent Agent Type Key
          description: Parent agent type key.
        agent_key:
          anyOf:
            - type: string
            - type: 'null'
          title: Agent Key
          description: Stored parent agent key.
        agent_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Agent Name
          description: >-
            User-facing agent name derived from agent_key with underscores
            converted to spaces.
        full_display_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Full Display Name
          description: Full display name for the parent agent.
        tenant:
          anyOf:
            - type: string
            - type: 'null'
          title: Tenant
          description: Owning tenant ID.
        display_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Display Name
          description: Human-readable parent agent name.
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
          description: Parent agent description.
        configs:
          anyOf:
            - $ref: '#/components/schemas/ParentAgentConfigRequest'
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Configs
          description: Parent agent runtime configuration.
        llm_model:
          anyOf:
            - type: integer
            - type: 'null'
          title: Llm Model
          description: Default LLM model ID.
        llm_model_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Llm Model Name
          description: Default LLM model name.
        active:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Active
          description: Whether the parent agent is active.
        state_function:
          anyOf:
            - items:
                additionalProperties: true
                type: object
              type: array
            - type: 'null'
          title: State Function
          description: State-function routing rules.
        created_at:
          anyOf:
            - type: string
            - type: 'null'
          title: Created At
          description: Creation timestamp.
      type: object
      title: ParentAgentListItem
    ParentAgentConfigRequest:
      properties:
        last_agent_in_group:
          anyOf:
            - type: string
            - type: 'null'
          title: Last Agent In Group
          description: >-
            Default sub-agent for a continued conversation. If empty, standard
            routing rules are used.
        max_rounds:
          anyOf:
            - type: string
            - type: integer
            - type: 'null'
          title: Max Rounds
          description: >-
            Maximum number of agent-to-agent turns that can occur in one
            parent-agent run.
          default: '10'
        temperature:
          anyOf:
            - type: string
            - type: number
            - type: integer
            - type: 'null'
          title: Temperature
          description: >-
            Default creativity level used when a sub-agent does not specify its
            own temperature.
          default: 0
        max_messages:
          anyOf:
            - type: string
            - type: integer
            - type: 'null'
          title: Max Messages
          description: >-
            Maximum number of non-system messages to keep in the parent-agent
            context.
          default: '10'
        continue_with_last_agent:
          anyOf:
            - type: string
            - type: boolean
          title: Continue With Last Agent
          description: >-
            When a conversation resumes, keep the last sub-agent as the routing
            reference instead of restarting rule logic.
          default: false
        memory_expiration:
          anyOf:
            - $ref: '#/components/schemas/MemoryExpirationConfigRequest'
            - type: 'null'
          description: >-
            Default memory expiration settings for thread, agent, and tenant
            scoped memories.
      type: object
      title: ParentAgentConfigRequest
    MemoryExpirationConfigRequest:
      properties:
        thread_ttl_hours:
          type: integer
          minimum: 1
          title: Thread Ttl Hours
          description: Hours to retain thread-scoped memories.
          default: 24
        agent_ttl_days:
          anyOf:
            - type: integer
            - type: 'null'
          title: Agent Ttl Days
          description: Days to retain agent-scoped memories. Null means no expiration.
        tenant_ttl_days:
          anyOf:
            - type: integer
            - type: 'null'
          title: Tenant Ttl Days
          description: Days to retain tenant-scoped memories. Null means no expiration.
        clear_thread_on_conversation_end:
          type: boolean
          title: Clear Thread On Conversation End
          description: Clear thread memories when a conversation ends.
          default: false
      type: object
      title: MemoryExpirationConfigRequest
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer

````