lt.tasks
lt.tasks reads and writes task records tracked by the Long Tail interceptor, and the processes (task groups sharing an origin_id) they form.
create
Section titled “create”const result = await lt.tasks.create({ workflow_id: 'order-pipeline-abc123', workflow_type: 'orderPipeline', lt_type: 'workflow', signal_id: 'sig-abc123', parent_workflow_id: 'order-pipeline-abc123', envelope: '{"data":{"orderId":"order-456"}}',});Create a task record. The caller is recorded as initiated_by.
Parameters
| Field | Type | Required | Description |
|---|---|---|---|
workflow_id |
string |
Yes | Workflow ID |
workflow_type |
string |
Yes | Registered workflow name |
lt_type |
string |
Yes | Interceptor classification |
signal_id |
string |
Yes | Signal ID for resume and replay |
parent_workflow_id |
string |
Yes | Orchestrator workflow ID |
task_queue |
string |
No | Task queue the workflow runs on |
origin_id |
string |
No | Correlation ID shared by sibling workflows |
parent_id |
string |
No | Direct parent workflow ID |
envelope |
string |
No | JSON-serialized input envelope (default {}) |
metadata |
object |
No | Arbitrary metadata |
priority |
number |
No | Priority (default 2) |
trace_id |
string |
No | Trace ID for distributed tracing |
span_id |
string |
No | Span ID for distributed tracing |
Returns: LTApiResult<Task> with status 201.
Auth: Required.
const result = await lt.tasks.list({ status: 'pending', workflow_type: 'reviewContent', limit: 25,});List tasks with optional filters.
Parameters
| Field | Type | Required | Description |
|---|---|---|---|
status |
string |
No | pending or completed |
lt_type |
string |
No | Interceptor classification |
workflow_type |
string |
No | Workflow function name |
workflow_id |
string |
No | Workflow ID |
parent_workflow_id |
string |
No | Parent orchestrator ID |
origin_id |
string |
No | Root process origin ID |
limit |
number |
No | Max results (default 50) |
offset |
number |
No | Pagination offset (default 0) |
Returns: LTApiResult<{ tasks, total }>
Auth: Not required.
const result = await lt.tasks.get({ id: 'task_abc123' });Get one task by ID.
Parameters
| Field | Type | Required | Description |
|---|---|---|---|
id |
string |
Yes | Task UUID |
Returns: LTApiResult<Task>. 404 if not found.
Auth: Not required.
listProcesses
Section titled “listProcesses”const result = await lt.tasks.listProcesses({ workflow_type: 'reviewContent', status: 'pending', limit: 20,});List processes (tasks grouped by origin_id).
Parameters
| Field | Type | Required | Description |
|---|---|---|---|
limit |
number |
No | Max results (default 50) |
offset |
number |
No | Pagination offset |
workflow_type |
string |
No | Filter by workflow type |
status |
string |
No | Filter by status |
search |
string |
No | Full-text search across process fields |
Returns: LTApiResult<{ processes, total }>
Auth: Not required.
getProcess
Section titled “getProcess”const result = await lt.tasks.getProcess({ originId: 'origin_xyz' });const scoped = await lt.tasks.getProcess({ originId: 'origin_xyz' }, { userId: 'user-456' });Get one process with its tasks and escalations. With an auth context as the second argument, only the escalations that caller may read are included.
Parameters
| Field | Type | Required | Description |
|---|---|---|---|
originId |
string |
Yes | Root process origin ID |
Returns: LTApiResult<{ origin_id, tasks, escalations }>
Auth: Optional. Filters escalations to the caller’s readable ones when provided.
getProcessStats
Section titled “getProcessStats”const result = await lt.tasks.getProcessStats({ period: '24h' });Aggregate process statistics.
Parameters
| Field | Type | Required | Description |
|---|---|---|---|
period |
string |
No | Time window: 1h, 24h, 7d, 30d |
Returns: LTApiResult<ProcessStats>
Auth: Not required.
