Skip to main content

Tasks

Tasks are user-owned work items, optionally recurring and scoped to an agent/app/workflow. Use this resource for CRUD plus lifecycle (complete, cancel, skip, end recurrence).

Access it as client.tasks on a Strongly client, or the same path on AsyncStrongly with await. All methods exist on both with identical signatures.

Quick start​

from strongly import Strongly

client = Strongly()

# List (auto-paginates as you iterate) # filters: kind, status, include_completed, search_text, tags, trigger_type, due_only, linked_ids, sort
for task in client.tasks.list():
print(task.id)

Methods​

Core​

list​

list(*, kind: str | None = None, status: str | None = None, include_completed: bool | None = None, search_text: str | None = None, tags: Sequence[str] | None = None, trigger_type: str | None = None, due_only: bool | None = None, linked_ids: Sequence[str] | None = None, sort: str | None = None, limit: int | None = None) -> SyncPaginator[TaskSummary]

List tasks with pagination and filters.

Parameters

  • kind (str | None, optional): recurring or oneoff.
  • status (str | None, optional): open | fired | done | failed | cancelled.
  • include_completed (bool | None, optional): Include done/failed/cancelled rows (default off).
  • search_text (str | None, optional): Substring match on description and notes.
  • tags (Sequence[str] | None, optional): Only tasks carrying all of these tags.
  • trigger_type (str | None, optional): heartbeat or scheduled.
  • due_only (bool | None, optional): Only tasks whose due time has arrived.
  • linked_ids (Sequence[str] | None, optional): Only tasks that belong to all of these agents and pools.
  • sort (str | None, optional): The order: "-updatedAt" (the API's default, latest changed first), "updatedAt", "dueAt" (soonest due first; a task with no due time last), "-dueAt", "createdAt" or "-createdAt".
  • limit (int | None, optional): Maximum number of items to return (default: all matching items).

Returns

  • SyncPaginator[TaskSummary]: A paginator yielding each task's summary (TaskSummary); retrieve returns the full task.

create​

create(*, description: str, linked_ids: Sequence[str], subject_ref: Mapping[str, Any] | None = None, subject_id: str | None = None, due_at: str | None = None, notes: str | None = None, recurrence: Mapping[str, Any] | None = None, tags: Sequence[str] | None = None, trigger_type: str | None = None, created_by_agent: str | None = None, assigned_to_agent: str | None = None) -> Task

Create a task for one of your agents.

A task belongs to exactly one agent: linked_ids must name one of your agents (its workflow id), plus any pools; the platform refuses anything else (ValidationError). Deleting the agent deletes its tasks. Recurring tasks (recurrence.kind != "none") get a computed next_due_at; one-off tasks use the provided due_at.

Parameters

  • description (str): What needs to be done (required).
  • linked_ids (Sequence[str]): The id of the one agent that works the task, plus any pool ids (required).
  • subject_ref (Mapping[str, Any] | None, optional): Optional {kind, id, app?} pointer to the subject.
  • subject_id (str | None, optional): An app's own id for whom the task is about (a person's, say: 1 to 200 letters, digits and _ . : -): Apps.delete_agent_subject deletes every task tagged with it on the app's agents, with its fires.
  • due_at (str | None, optional): ISO timestamp for one-off tasks.
  • notes (str | None, optional): Free-form notes.
  • recurrence (Mapping[str, Any] | None, optional): A recurrence dict, e.g. {kind, interval, time_of_day, ...}.
  • tags (Sequence[str] | None, optional): Tag labels.
  • trigger_type (str | None, optional): heartbeat (the agent completes it when it next wakes) or scheduled (the platform fires it at an exact time). Defaults: a cron recurrence is scheduled, anything else heartbeat.
  • created_by_agent (str | None, optional): Id of the agent that created the task.
  • assigned_to_agent (str | None, optional): A label the Task Due trigger of the task's agent can filter on (exact match).

Returns

  • Task: The created Task.

retrieve​

retrieve(task_id: str) -> Task

Retrieve a single task by id.

update​

update(task_id: str, *, description: str | None = None, subject_ref: Mapping[str, Any] | None = None, due_at: str | None = None, notes: str | None = None, recurrence: Mapping[str, Any] | None = None, tags: Sequence[str] | None = None, trigger_type: str | None = None, assigned_to_agent: str | None = None, linked_ids: Sequence[str] | None = None, clear_due_at: bool | None = None, clear_assigned_to_agent: bool | None = None, clear_subject_ref: bool | None = None) -> Task

Update a task: only the arguments given change.

Changing recurrence recomputes next_due_at; {"kind": "none"} stops it repeating. linked_ids replaces the agent and pools the task belongs to (still exactly one of the task owner's agents). clear_due_at, clear_assigned_to_agent and clear_subject_ref remove those fields. To finish or cancel a task use complete or cancel.

delete​

delete(task_id: str) -> None

Delete a task (hard delete). Raises on failure; returns nothing.

Lifecycle & actions​

cancel​

cancel(task_id: str, *, reason: str | None = None) -> Task

Cancel a task (sets status cancelled). Optional reason.

complete​

complete(task_id: str, *, notes: str | None = None, execution_id: str | None = None, run_id: str | None = None) -> Task

Mark a task complete and return the updated task.

Recurring tasks advance to the next due instant; one-off tasks transition to done. One fire has one completion: completing a fire that is already complete (the same run_id again, a done task, a failed fire whose retry already completed it) records nothing and answers with already_complete true.

Parameters

  • task_id (str): Target task id.
  • notes (str | None, optional): Optional completion notes.
  • execution_id (str | None, optional): Workflow execution that completed the task.
  • run_id (str | None, optional): Agent run that completed the task; the same run completing it again is already complete.

skip_next​

skip_next(task_id: str) -> Task

Skip the next scheduled fire on a recurring task.

end_recurrence​

end_recurrence(task_id: str) -> Task

Stop recurrence on a recurring task (history is preserved).

Other​

add_member​

add_member(resource_id: str, *, user_id: str, role: str) -> Permissions

Share the resource with a user.

Parameters

  • resource_id (str): The resource's id.
  • user_id (str): The user to share it with.
  • role (str): "editor" (use and change it) or "user" (use it only; types without a use-only tier, such as knowledge bases, take "editor" only).

claim​

claim(task_id: str, *, claimant_id: str) -> Task

Claim a task's current occurrence before working it, so two agents never both do.

Returns the task, its claimed_by you, when you won it (claiming again as the winner returns it again).

Parameters

  • claimant_id (str): Your agent's id.

Raises

  • ConflictError: Another agent holds this occurrence (skip it); the message names it.

fires​

fires(task_id: str, *, search: str | None = None, sort: str | None = None, limit: int | None = None) -> SyncPaginator[TaskFireRecord]

List a task's fires, newest first: one record per fire, every fire kept.

Task.fire_count is how many there are.

Parameters

  • task_id (str): Target task id.
  • search (str | None, optional): Only fires whose status, failure reason or run or execution id contains this text.
  • sort (str | None, optional): -occurredAt (default), occurredAt, firedAt, completedAt or status (- for descending).
  • limit (int | None, optional): Maximum number of fires to return (default: all of them).

Returns

  • SyncPaginator[TaskFireRecord]: A paginator yielding TaskFireRecord objects.

permissions​

permissions(resource_id: str) -> Permissions

Return who can reach the resource: its owner, members and their roles, and visibility.

Parameters

  • resource_id (str): The resource's id.

remove_member​

remove_member(resource_id: str, user_id: str) -> None

Stop sharing the resource with a user.

Parameters

  • resource_id (str): The resource's id.
  • user_id (str): The user to stop sharing it with.

set_visibility​

set_visibility(resource_id: str, visibility: str) -> Permissions

Make the resource public (every user can find and use it) or private.

Parameters

  • resource_id (str): The resource's id.
  • visibility (str): "public" or "private".

stats​

stats(*, kind: str | None = None, status: str | None = None, include_completed: bool | None = None, search_text: str | None = None, tags: Sequence[str] | None = None, trigger_type: str | None = None, due_only: bool | None = None, linked_ids: Sequence[str] | None = None) -> TaskStats

Count the tasks list lists, with the same filters.

It counts them in all, by status and by how each fires, the times they fired, and how many are failing.

Every task the list holds for you with these filters is counted (not a page); finished ones only with include_completed.

Parameters

  • kind, status, include_completed, search_text, tags, trigger_type, due_only, linked_ids: As list takes them.

Returns

  • TaskStats: total, by_status and by_trigger_type (most first), fires (added up) and failing (tasks whose latest failed fire STAN has not fixed).

time_series​

time_series(task_id: str, *, window: SeriesWindow | None = None, granularity: SeriesGranularity | None = None) -> TaskFiresSeries

Get a task's fires over time, by status.

Each fire counts once, in the hour or day it occurred: fired (running now), no subscriber, done, failed or cancelled, which add up to fires.

Every hour (24h) or UTC day (7d, 30d) of the window is a point, from the one its start falls in to the current one; a quiet point counts zero.

Parameters

  • task_id (str): The task ID.
  • window ({"24h", "7d", "30d"} | None, optional): The window. The API's default is "30d".
  • granularity ({"hourly", "daily"} | None, optional): hourly for 24h, daily otherwise; the window's when left out (another is refused).