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

# Execute Reasoning Agent Completion

> Execute a reasoning agent with advanced cognitive capabilities for complex problem-solving tasks. This is a premium-only feature.



## OpenAPI

````yaml https://api.swarms.world/openapi.json post /v1/reasoning-agent/completions
openapi: 3.1.0
info:
  title: Swarms API
  description: >-
    The Swarms API delivers a high-performance, enterprise-grade platform for
    orchestrating advanced multi-agent systems. Built on a Rust-powered agent
    runtime, it enables scalable, robust, and secure agent collaboration,
    supporting complex workflows and dynamic agent communication. The API
    exposes a comprehensive suite of RESTful endpoints for the management,
    execution, and monitoring of agents, swarms, and related resources,
    empowering organizations to automate and optimize mission-critical
    processes. To access the API, obtain your API key from the [Swarms API Keys
    page](https://swarms.world/platform/api-keys). For detailed integration
    guides, best practices, and reference material, consult the [Swarms API
    Documentation](https://docs.swarms.ai).
  version: 1.0.0
servers:
  - url: https://api.swarms.world
    description: Swarms Production API
security: []
paths:
  /v1/reasoning-agent/completions:
    post:
      tags:
        - Reasoning Agents
      summary: Execute Reasoning Agent Completion
      description: >-
        Execute a reasoning agent with advanced cognitive capabilities for
        complex problem-solving tasks. This is a premium-only feature.
      operationId: run_reasoning_agent_completions_v1_reasoning_agent_completions_post
      parameters:
        - name: x-api-key
          in: header
          required: true
          schema:
            type: string
            title: X-Api-Key
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ReasoningAgentSpec'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReasoningAgentCompletionOutput'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    ReasoningAgentSpec:
      properties:
        agent_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Agent Name
          description: The unique name assigned to the reasoning agent.
          default: reasoning-agent
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
          description: >-
            A detailed explanation of the reasoning agent's purpose and
            capabilities.
          default: A reasoning agent that can answer questions and help with tasks.
        model_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Model Name
          description: The name of the AI model that the reasoning agent will utilize.
          default: claude-sonnet-4-20250514
        system_prompt:
          anyOf:
            - type: string
            - type: 'null'
          title: System Prompt
          description: The initial instruction or context provided to the reasoning agent.
        max_loops:
          anyOf:
            - type: integer
            - type: 'null'
          title: Max Loops
          description: >-
            The maximum number of times the reasoning agent is allowed to repeat
            its task.
          default: 1
        swarm_type:
          anyOf:
            - type: string
              enum:
                - reasoning-duo
                - self-consistency
                - ire
                - reasoning-agent
                - consistency-agent
                - ire-agent
                - ReflexionAgent
                - GKPAgent
                - AgentJudge
            - type: 'null'
          title: Swarm Type
          description: >-
            The type of reasoning swarm to use (e.g., reasoning duo,
            self-consistency, IRE).
          default: reasoning_duo
        num_samples:
          anyOf:
            - type: integer
            - type: 'null'
          title: Num Samples
          description: The number of samples to generate for the reasoning agent.
          default: 1
        output_type:
          anyOf:
            - type: string
              enum:
                - list
                - dict
                - dictionary
                - string
                - str
                - final
                - last
                - json
                - all
                - yaml
                - xml
                - dict-all-except-first
                - str-all-except-first
                - basemodel
                - dict-final
                - list-final
            - type: 'null'
          title: Output Type
          description: The type of output format for the reasoning agent.
          default: dict-all-except-first
        num_knowledge_items:
          anyOf:
            - type: integer
            - type: 'null'
          title: Num Knowledge Items
          description: The number of knowledge items to use for the reasoning agent.
        memory_capacity:
          anyOf:
            - type: integer
            - type: 'null'
          title: Memory Capacity
          description: The memory capacity for the reasoning agent.
        task:
          anyOf:
            - type: string
            - type: 'null'
          title: Task
          description: The task to be completed by the reasoning agent.
      type: object
      title: ReasoningAgentSpec
    ReasoningAgentCompletionOutput:
      properties:
        job_id:
          type: string
          title: Job Id
          description: Unique identifier for the reasoning agent run.
        status:
          type: string
          title: Status
          description: Status of the reasoning agent run.
          default: success
        outputs:
          title: Outputs
          description: >-
            The output generated by the reasoning agent. Shape varies by
            reasoning type.
        timestamp:
          type: string
          title: Timestamp
          description: ISO-formatted timestamp of when the run was executed.
        agent_name:
          type: string
          title: Agent Name
          description: Name of the agent.
        agent_type:
          type: string
          title: Agent Type
          description: Type of the agent (swarm type).
        agent_id:
          type: string
          title: Agent Id
          description: Unique identifier for the agent instance.
        usage:
          additionalProperties:
            type: integer
          type: object
          title: Usage
          description: Token usage statistics including input, output, and total tokens.
      type: object
      required:
        - job_id
        - outputs
        - timestamp
        - agent_name
        - agent_type
        - agent_id
        - usage
      title: ReasoningAgentCompletionOutput
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    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

````