Execution
Understanding task execution, runs, and workflow states
When you execute a task, Linkt creates a run that tracks the workflow from start to finish. This page explains how execution works, run states, output formats, and best practices for monitoring workflows.
Task to Run Relationship
Tasks and runs have a one-to-many relationship:
- A Task is a reusable workflow template that defines what to do and how to do it
- A Run is a single execution instance of a task
- Each time you execute a task, a new run is created
- Multiple runs can exist for the same task
Executing a Task
To execute a task, call the execute endpoint:
Response:
Use the returned run_id to monitor execution progress.
Run States
Runs progress through a state machine from creation to completion (or failure):
| Status | Description | Terminal? |
|---|---|---|
SCHEDULED | Run created, queued for execution | No |
PENDING | Run preparing, resources being allocated | No |
RUNNING | Workflow actively executing | No |
COMPLETED | Workflow finished successfully | Yes |
FAILED | Workflow encountered an error | Yes |
CANCELED | Run was manually canceled | Yes |
CRASHED | Run crashed unexpectedly | Yes |
PAUSED | Run is paused (rare) | No |
State Flow
Most runs follow the happy path: SCHEDULED → PENDING → RUNNING → COMPLETED.
Terminal States
Terminal states (COMPLETED, FAILED, CANCELED, CRASHED) are final—the run will not change status again. Use these to determine when to stop polling.
Run Structure
A complete run object contains:
Fields
| Field | Type | Description |
|---|---|---|
id | string | Unique run identifier |
task_id | string | Parent task ID |
icp_id | string | ICP used for this execution (optional) |
task_type | string | Workflow type: search, signal, profile, ingest |
flow_run_id | string | Internal workflow engine ID |
status | string | Current run state |
input | object | Parameters passed at execution time |
output | object | Structured output (see below) |
error | string | Error message if failed (null otherwise) |
created_at | datetime | When the run was created |
updated_at | datetime | When the run was last updated |
Structured Output
When a run completes, the output field contains structured results with credit usage and resource tracking:
Credit Usage
The credits object tracks consumption:
| Field | Type | Description |
|---|---|---|
total_credits | number | Total credits consumed by this run |
breakdown | object | Credits by action type (e.g., search_company, enrich_person) |
Common action types in breakdown:
search_company— Company discovery searchessearch_person— Person discovery searchesenrich_company— Company data enrichmentenrich_person— Person data enrichment
Resource Tracking
The resources object tracks what was created or modified:
| Field | Type | Description |
|---|---|---|
entities_created | array | IDs of newly created entities |
entities_updated | array | IDs of entities that were updated |
signals_created | array | IDs of newly created signals |
Use these IDs to retrieve the actual data from the entities or signals endpoints.
Run Time
The run_time field contains the total execution duration in seconds.
Polling for Status
To monitor a run, poll the run endpoint until it reaches a terminal state:
Polling Interval
A 10-second interval balances responsiveness with API efficiency. More frequent polling doesn't speed up execution and increases API usage. Since workflows can run for 15-20+ minutes, polling less frequently is recommended.
JavaScript Example
Canceling a Run
To cancel a running workflow:
Response: 204 No Content
Cancellation
Cancellation is only effective for non-terminal runs. Once a run reaches COMPLETED, FAILED, or CRASHED, it cannot be canceled.
Run Queue
For long-running workflows, you can monitor the processing queue to see entities being worked on:
Query Parameters:
| Parameter | Default | Description |
|---|---|---|
offset | 0 | Starting position in queue |
limit | 20 | Maximum entities to return (1-100) |
state | — | Filter by state: queued, processing, completed, discarded |
include_history | false | Include entities from all states |
Entity Queue States:
| State | Description |
|---|---|
queued | Waiting to be processed |
processing | Currently being worked on |
completed | Successfully processed and saved |
discarded | Skipped (not qualified) |
Error Handling
When a run fails, follow these steps:
1. Check Error Details
The run response includes error information:
2. Common Failure Reasons
| Error Type | Cause | Resolution |
|---|---|---|
| Rate limit | Too many requests to external providers | Wait and retry |
| Invalid configuration | ICP or task misconfigured | Review settings |
| Sheet capacity | Sheet at entity limit | Increase limit or use new sheet |
| Timeout | Workflow took too long | Reduce batch size |
| Provider error | External API unavailable | Retry later |
3. Retry Strategy
For transient errors, implement exponential backoff:
Expected Durations
Different workflow types have different typical durations:
| Task Type | Typical Duration | Notes |
|---|---|---|
| Search | 15-20+ minutes | Can take longer depending on ICP complexity and desired entity count |
| CSV ingest | ~1 minute per row | ~15 rows takes ~15 minutes |
| Signal monitoring | Varies | Depends on monitoring_frequency configured in task |
Allow Sufficient Time
Search and ingest workflows involve AI-powered research that takes time to complete thoroughly. Set your polling timeout to at least 30 minutes for search tasks and scale accordingly for larger ingest batches.
Listing Runs
Query runs with filtering:
Query Parameters:
| Parameter | Description |
|---|---|
task_id | Filter by task |
icp_id | Filter by ICP |
status | Filter by status |
task_type | Filter by type: search, signal, profile, ingest |
created_after | ISO 8601 datetime |
created_before | ISO 8601 datetime |
page | Page number (default: 1) |
page_size | Results per page (default: 20, max: 100) |
sort_by | Sort field |
order | -1 (descending) or 1 (ascending) |
Next Steps
- Tasks — Configure workflow templates
- Runs — Run data structure reference
- Quickstart — See execution in practice
- API Reference — Complete run endpoint documentation