> ## 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.

# Add Sub-Agent Tool

> Assign a tool to a sub-agent linked to a parent agent.



## OpenAPI

````yaml /api-reference/openapi.json post /api/parent_agents/{parent_agent_id}/sub_agents/{sub_agent_id}/tools
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/{parent_agent_id}/sub_agents/{sub_agent_id}/tools:
    post:
      tags:
        - Tools
      summary: Add Sub-Agent Tool
      description: Assign a tool to a sub-agent linked to a parent agent.
      operationId: >-
        add_sub_agent_tool_endpoint_api_parent_agents__parent_agent_id__sub_agents__sub_agent_id__tools_post
      parameters:
        - name: parent_agent_id
          in: path
          required: true
          schema:
            type: integer
            title: Parent Agent Id
        - name: sub_agent_id
          in: path
          required: true
          schema:
            type: integer
            title: Sub Agent Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SubAgentToolCreateRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubAgentToolMutationResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - BearerAuth: []
components:
  schemas:
    SubAgentToolCreateRequest:
      properties:
        agent_tool_id:
          type: integer
          minimum: 1
          title: Agent Tool Id
          description: ID of the agent tool to attach to the sub-agent.
        option:
          anyOf:
            - type: string
              enum:
                - register
                - execute
                - both
            - type: 'null'
          title: Option
          description: >-
            How the sub-agent can use the tool: register it for LLM tool
            calling, execute it directly, or both.
      type: object
      required:
        - agent_tool_id
      title: SubAgentToolCreateRequest
    SubAgentToolMutationResponse:
      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/SubAgentToolMutationData'
          description: Sub-agent tool mutation results.
      type: object
      required:
        - success
        - data
      title: SubAgentToolMutationResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    SubAgentToolMutationData:
      properties:
        items:
          items:
            $ref: '#/components/schemas/SubAgentToolMutationItem'
          type: array
          title: Items
          description: Created or deleted sub-agent tool rows.
      type: object
      title: SubAgentToolMutationData
    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
    SubAgentToolMutationItem:
      properties:
        id:
          anyOf:
            - type: integer
            - type: 'null'
          title: Id
          description: Sub-agent tool link ID.
        sub_agent_id:
          anyOf:
            - type: integer
            - type: 'null'
          title: Sub Agent Id
          description: Sub-agent ID.
        agent_tool_id:
          anyOf:
            - type: integer
            - type: 'null'
          title: Agent Tool Id
          description: Linked agent tool ID.
        option:
          anyOf:
            - type: string
            - type: 'null'
          title: Option
          description: How the sub-agent can use the tool.
        created_at:
          anyOf:
            - type: string
            - type: 'null'
          title: Created At
          description: Creation timestamp.
      additionalProperties: true
      type: object
      title: SubAgentToolMutationItem
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer

````