Skip to main content

Tasks

A Task is a version-pinned, immutable reference to a concept, condition, and action, created from natural language intent. Task logic cannot be mutated after creation — changes require the calibration flow and explicit rebinding.

Key Constraint

Tasks cannot be created without a valid action binding. If no action can be resolved, task creation fails with action_binding_failed.


Create a Task

POST /tasks

Submits a natural language intent through the full LLM + guardrails pipeline. The system classifies intent, resolves primitives, selects a strategy via the guardrails priority order, fills parameters, generates a concept and condition, binds an action, validates, compiles, and persists a version-pinned Task.

Parameter Determinism

Parameter values are not inferred heuristically. They are derived deterministically from guardrails-defined priors and application instructions via the severity vocabulary and parameter bias rules. The same intent + same guardrails always produces the same strategy and parameters.

dry_run

Pass dry_run: true to preview the generated concept, condition, action binding, and validation result without persisting. Use in development to verify intent resolution before committing.

Request Body

ParameterTypeRequiredDescription
intentstringRequiredNatural language monitoring intent. Example: "Alert me when AAPL price rises significantly".
entity_scopestringRequiredEntity or group to evaluate. Examples: "AAPL", "user_abc123".
deliveryDeliveryConfigRequiredHow to deliver alerts when the condition fires.
constraintsConstraintsConfigOptionalLLM hints: sensitivity (low|medium|high) and namespace.
dry_runbooleanOptionalDefault false. Returns DryRunResult without persisting.

Response — Task

ParameterTypeRequiredDescription
task_idstringAlwaysUnique task identifier.
intentstringAlwaysOriginal natural language intent.
concept_id / concept_versionstringAlwaysPinned concept reference.
condition_id / condition_versionstringAlwaysPinned condition reference.
action_id / action_versionstringAlwaysPinned action binding.
entity_scopestringAlwaysEntity scope.
statusenumAlwaysactive | paused | deleted | preview.
created_at / last_triggered_atdatetimeAlwaysISO 8601. last_triggered_at is null if never triggered.

Response Codes

StatusDescription
200Task created, or DryRunResult when dry_run: true.
400Schema or constraint validation failed.
401Missing or invalid API key.
422Intent could not be resolved — no primitive, no valid strategy, or action binding failed.
429Rate limit exceeded.

TypeScript Example

// Dry run: verify guardrails-resolved strategy and params
const preview = await client.tasks.create({
intent: "Alert me when AAPL price rises significantly",
entityScope: "AAPL",
delivery: { type: "notification" },
dryRun: true,
});

// "significantly" → high severity → change.high prior → value: 0.10
console.log(preview.condition.strategy);
// { type: "change", params: { direction: "increase", value: 0.10, window: "1d" } }

const task = await client.tasks.create({
intent: "Alert me when AAPL price rises significantly",
entityScope: "AAPL",
delivery: { type: "webhook", endpoint: "https://myapp.com/hooks/alert" },
});

List Tasks

GET /tasks

Returns a paginated list of tasks in the current workspace.

Query Parameters

ParameterTypeRequiredDescription
statusenumOptionalFilter: active | paused | deleted.
limitintegerOptionalDefault 20, max 100.
cursorstringOptionalPagination cursor.

Response Codes

StatusDescription
200Paginated TaskList: items[], has_more, next_cursor, total_count.
401Unauthorised.

TypeScript Example

const { items } = await client.tasks.list({ status: "active", limit: 50 });

Get Task

GET /tasks/{id}

Retrieves the full task definition including pinned concept, condition, and action references, plus execution metadata.

Path Parameters

ParameterTypeRequiredDescription
idstringRequiredThe task_id.

Response Codes

StatusDescription
200Full Task object.
401Unauthorised.
404Task not found.

TypeScript Example

const task = await client.tasks.get(taskId);
console.log(task.condition_id, task.condition_version);

Update Task

PATCH /tasks/{id}

Updates operational settings. Cannot modify concept logic, condition logic, strategy, or action logic — those require the calibration flow.

Rebinding

Passing conditionVersion rebinds the task to a new condition version — the final step of the calibration flow. Verify the new version with GET /conditions/{id} and POST /conditions/explain before rebinding.

Request Body (all optional, at least one required)

ParameterTypeRequiredDescription
condition_versionstringOptionalRebind to this condition version after apply-calibration.
deliveryDeliveryConfigOptionalUpdate alert delivery channel.
entity_scopestringOptionalUpdate entity or group evaluated.
statusenumOptionalactive | paused.

Disallowed (HTTP 400): concept_id, concept_version, condition logic, strategy, parameters, action_id, action_version.

Response Codes

StatusDescription
200Updated Task.
400Validation error or disallowed update.
401Unauthorised.
404Not found.

TypeScript Example

await client.tasks.update(taskId, { status: "paused" });
await client.tasks.update(taskId, { conditionVersion: "1.3" });
await client.tasks.update(taskId, { entityScope: "premium_users" });

Delete Task

DELETE /tasks/{id}

Soft-deletes a task (status = deleted). Retained for audit and replay. Hard deletion is not supported.

Response Codes

StatusDescription
200Soft-deleted Task.
401Unauthorised.
404Not found.

TypeScript Example

const deleted = await client.tasks.delete(taskId);
console.log(deleted.status); // "deleted"