Create a task execution record
Create a new task execution record for a specific task within a flow execution.
Overview Task executions represent individual task invocations within a flow execution. Each task in a flow can be executed multiple times (retries, loops), tracked by task_execution_idx. This endpoint is primarily used by system workers to report task execution state.
Resource Hierarchy Organization → Flow → Flow Execution → Task Execution
Lifecycle Task executions progress through states: queued → running → completed/failed
- queued: Task scheduled but not yet started
- running: Task currently executing
- completed: Task finished successfully with output
- failed: Task encountered an error
Use Cases
- Workers reporting task execution start/completion
- Recording task outputs for downstream tasks
- Tracking task execution history and retries
- Debugging failed workflow executions
Idempotency This endpoint is idempotent based on (flow_execution_id, task_name, task_execution_idx). If a task execution with these identifiers exists, it will be updated rather than creating a duplicate.
Performance Notes WebSocket notifications are processed in the background to ensure fast worker responses. The endpoint returns immediately after database write; notifications are async.
Related Endpoints
- GET /task-executions - List task executions with filtering
- PUT /task-executions - Update existing task execution and optionally re-execute flow
- GET /flow-executions/ - View parent flow execution
Authorizations
API key authentication. Include your API key in the X-API-Key header as: X-API-Key YOUR_API_KEY
Example:
JWT Bearer token authentication. Include your access token in the Authorization header as: Bearer YOUR_ACCESS_TOKEN
Example:
Body
Request model for creating or updating a task execution.
This model is used by system workers to report task execution state. Fields are intentionally simplified to reduce worker complexity. The server infers additional fields like organization_id and timestamps.
ID of the parent flow execution containing this task. Used to determine organization_id and maintain execution hierarchy.
"123e4567-e89b-12d3-a456-426614174000"
Current execution status of the task. Valid values: 'queued', 'running', 'completed', 'failed', 'cancelled'. Server validates against ExecutionStatus enum. Status transitions are: queued → running → (completed|failed|cancelled).
"running"
"completed"
"failed"
Zero-based execution index for this task. Increments for each execution of the same task (retries, loops). Combines with flow_execution_id and task_name to form unique identifier.
x >= 00
1
2
Name of the task as defined in the flow definition YAML. Must match a task name in the flow's task list. Case-sensitive identifier used for task lookups.
1 - 200"send_email"
"process_data"
"validate_input"
Error information when task execution fails. Only set when status is 'failed'. Contains error message, type, and stack trace. Structure: {'message': str, 'type': str, 'traceback': str} Used for debugging and error reporting.
Input parameters provided to the task executor. Schema varies by task type. Can be dict, list, or primitive types. NULL if task has no input parameters.
"simple string input"
Output data produced by the task executor upon completion. Only set when status is 'completed'. NULL for queued/running/failed states. Available to downstream tasks via {{task_name.output}} syntax.
Response
Task execution created successfully
API model representing a task execution within a flow.
Task executions track individual task invocations during flow execution. Each task can execute multiple times (retries, loops), identified by task_execution_idx. Contains full execution context including inputs, outputs, errors, and lifecycle metadata.
Resource Hierarchy: Organization → Flow → Flow Execution → Task Execution
ID of the parent flow execution containing this task. Establishes the execution hierarchy and determines organization scope. All tasks in a flow execution share the same flow_execution_id.
"223e4567-e89b-12d3-a456-426614174000"
Unique identifier for this task execution. Auto-generated UUID assigned at creation time. Used for direct resource access via GET /task-executions/{id}.
"123e4567-e89b-12d3-a456-426614174000"
ID of the organization owning this task execution. Inherited from parent flow execution for tenant isolation. Used for Row-Level Security (RLS) filtering and authorization. All task executions are scoped to a single organization.
"323e4567-e89b-12d3-a456-426614174000"
Current execution state of the task. Valid values: 'queued', 'running', 'completed', 'failed', 'deleted', 'stale'.
Status transitions:
- queued → running: Task execution started
- running → completed: Task succeeded with output
- running → failed: Task encountered error
- any → deleted: Task soft-deleted (hidden from list operations)
- completed/failed → stale: Task data is outdated
Queued: Task scheduled but not started Running: Task actively executing Completed: Task finished successfully (output field set) Failed: Task encountered error (error field set) Deleted: Soft-deleted, excluded from queries (preserves audit trail) Stale: Previously completed but data is now outdated
"queued"
"running"
"completed"
"failed"
"deleted"
"stale"
Zero-based execution index tracking task attempts. 0 = first execution, 1 = first retry, 2 = second retry, etc. Increments for each retry or loop iteration of the same task. Combines with flow_execution_id and task_name to form unique composite key.
x >= 00
1
2
Name of the task as defined in the flow definition YAML. Case-sensitive identifier matching flow configuration. Used to reference task in flow logic and dependency graphs.
1 - 200"send_email"
"process_data"
"validate_input"
ISO 8601 timestamp when task execution was created (UTC). Represents when the task was queued or first recorded in the system. NULL for legacy records created before timestamp tracking.
"2025-01-23T10:30:00Z"
Error information when task execution fails. Only populated when status is 'failed'; NULL for other states. Contains error message, exception type, and stack trace for debugging.
Typical structure: { "message": "Human-readable error description", "type": "Exception class name", "traceback": "Full Python stack trace" }
Used for debugging, monitoring, and error reporting workflows.
Input parameters provided to the task executor. Schema varies by task type; can be object, array, or primitive. NULL if task accepts no input parameters. Resolved from flow definition and upstream task outputs.
"simple string input"
Identifier of the actor who last modified this task execution. Tracks manual interventions vs automated updates for auditing. Defaults to 'system' for worker-initiated changes.
Values:
- 'system': System-automated changes (workers, background jobs)
- User ID: UUID string of the user who made the change (e.g., '123e4567-e89b-12d3-a456-426614174000')
- Integration type: For service accounts/integrations (e.g., 'integration', 'service-account')
"system"
"123e4567-e89b-12d3-a456-426614174000"
"integration"
Output data produced by the task executor upon successful completion. Only populated when status is 'completed'; NULL for other states. Available to downstream tasks via {{task_name.output}} syntax. Structure defined by task executor implementation. Used for task chaining and flow data propagation.
ISO 8601 timestamp of last update to this task execution (UTC). Changes whenever status, output, or error fields are modified. Used for change tracking and optimistic locking. NULL for records never updated since creation.
"2025-01-23T10:35:00Z"