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

# Run Task Definition

> Run a saved task now with its agent, text and parameters; the run acts as the agent.

``parameters`` in the body are merged over the saved ones for this run only.



## OpenAPI

````yaml /api-reference/openapi.json post /v1/workspaces/{workspace}/task-definitions/{definition_id}/run
openapi: 3.1.0
info:
  description: >-
    Modular and extensible framework for building AI agents. This API requires
    JWT Bearer token authentication for most endpoints. Include your JWT token
    in the Authorization header. Public endpoints include /, /health, /docs,
    /redoc, and /openapi.json.
  title: AgentArea API
  version: 0.1.0
servers: []
security:
  - bearer: []
paths:
  /v1/workspaces/{workspace}/task-definitions/{definition_id}/run:
    post:
      tags:
        - v1
        - protected
        - task-definitions
      summary: Run Task Definition
      description: >-
        Run a saved task now with its agent, text and parameters; the run acts
        as the agent.


        ``parameters`` in the body are merged over the saved ones for this run
        only.
      operationId: run_task_definition_v1_task_definitions__definition_id__run_post
      parameters:
        - in: path
          name: definition_id
          required: true
          schema:
            format: uuid
            title: Definition Id
            type: string
        - description: Slug of the workspace the request acts in
          in: path
          name: workspace
          required: true
          schema:
            description: Slug of the workspace the request acts in
            maxLength: 120
            pattern: ^[a-z0-9]+(?:-[a-z0-9]+)*$
            title: Workspace
            type: string
      requestBody:
        content:
          application/json:
            schema:
              anyOf:
                - $ref: '#/components/schemas/TaskDefinitionRun'
                - type: 'null'
              title: Payload
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TaskResponse'
          description: Successful Response
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: Validation Error
      security:
        - HTTPBearer: []
components:
  schemas:
    TaskDefinitionRun:
      additionalProperties: false
      description: One run of a saved task.
      properties:
        parameters:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          description: Merged over the saved task's own parameters for this run only.
          title: Parameters
      title: TaskDefinitionRun
      type: object
    TaskResponse:
      properties:
        agent_id:
          format: uuid
          title: Agent Id
          type: string
        created_at:
          format: date-time
          title: Created At
          type: string
        created_by:
          anyOf:
            - type: string
            - type: 'null'
          title: Created By
        description:
          title: Description
          type: string
        end_user_id:
          anyOf:
            - type: string
            - type: 'null'
          title: End User Id
        error:
          anyOf:
            - type: string
            - type: 'null'
          title: Error
        execution_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Execution Id
        failure_reason:
          anyOf:
            - type: string
            - type: 'null'
          title: Failure Reason
        id:
          format: uuid
          title: Id
          type: string
        metadata:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Metadata
        parameters:
          additionalProperties: true
          title: Parameters
          type: object
        provenance:
          $ref: '#/components/schemas/TaskProvenance'
        result:
          anyOf:
            - additionalProperties: true
              type: object
            - type: string
            - type: 'null'
          title: Result
        scheduled_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Scheduled At
        status:
          title: Status
          type: string
        total_cost:
          anyOf:
            - type: number
            - type: 'null'
          title: Total Cost
        total_tokens:
          anyOf:
            - type: integer
            - type: 'null'
          title: Total Tokens
      required:
        - id
        - agent_id
        - description
        - parameters
        - status
        - created_at
      title: TaskResponse
      type: object
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          title: Detail
          type: array
      title: HTTPValidationError
      type: object
    TaskProvenance:
      description: 'Why a task exists: who or what started it, and the event that caused it.'
      properties:
        causation_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Causation Id
        correlation_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Correlation Id
        depth:
          default: 0
          title: Depth
          type: integer
        origin_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Origin Id
        origin_type:
          anyOf:
            - enum:
                - user
                - trigger
                - agent
                - api
                - a2a
              type: string
            - type: 'null'
          title: Origin Type
        parent_task_id:
          anyOf:
            - format: uuid
              type: string
            - type: 'null'
          title: Parent Task Id
        source_identity:
          anyOf:
            - type: string
            - type: 'null'
          title: Source Identity
        task_definition_id:
          anyOf:
            - format: uuid
              type: string
            - type: 'null'
          title: Task Definition Id
      title: TaskProvenance
      type: object
    ValidationError:
      properties:
        ctx:
          title: Context
          type: object
        input:
          title: Input
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          title: Location
          type: array
        msg:
          title: Message
          type: string
        type:
          title: Error Type
          type: string
      required:
        - loc
        - msg
        - type
      title: ValidationError
      type: object
  securitySchemes:
    bearer:
      bearerFormat: JWT
      description: JWT Bearer token for authentication
      scheme: bearer
      type: http
    HTTPBearer:
      scheme: bearer
      type: http

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.