Skip to main content

STAN Tasks

STAN background tasks and heartbeat.

Access it as client.stan_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)
for stan in client.stan_tasks.list():
print(stan.id)

Methods​

Core​

list​

list(*, limit: int | None = None) -> SyncPaginator[StanScheduledTask]

List your scheduled STAN tasks, a page at a time as you iterate.

Each has its schedule and next run time.

create​

create(*, name: str, action: str, model_id: str, schedule_type: str, run_at: str | None = None, cron: str | None = None, timezone: str | None = None, description: str | None = None, execution_mode: str | None = None, tool_name: str | None = None, tool_params: Mapping[str, Any] | None = None, model_name: str | None = None) -> dict[str, Any]

Create a STAN background task.

Parameters

  • name (str): Task name (required).
  • action (str): Natural-language instruction for llm execution mode (required).
  • model_id (str): Model the task runs against (required).
  • schedule_type (str): once or recurring (required).
  • run_at (str | None, optional): ISO timestamp for once schedules.
  • cron (str | None, optional): Cron expression for recurring schedules.
  • timezone (str | None, optional): IANA timezone for the schedule.
  • description (str | None, optional): Optional task description.
  • execution_mode (str | None, optional): llm (default) or tool.
  • tool_name (str | None, optional): MCP tool to run directly in tool mode.
  • tool_params (Mapping[str, Any] | None, optional): Parameters for tool_name.
  • model_name (str | None, optional): Display name of the model.

retrieve​

retrieve(task_id: str) -> StanScheduledTask

Retrieve a single STAN background task.

update​

update(task_id: str, *, name: str | None = None, description: str | None = None, execution_mode: str | None = None, action: str | None = None, tool_name: str | None = None, tool_params: Mapping[str, Any] | None = None, schedule_type: str | None = None, run_at: str | None = None, cron: str | None = None, timezone: str | None = None, model_id: str | None = None, model_name: str | None = None, status: str | None = None) -> dict[str, Any]

Update a STAN background task (any subset of fields).

delete​

delete(task_id: str) -> None

Delete a STAN background task. Raises on failure; returns nothing.

Lifecycle & actions​

pause​

pause(task_id: str) -> StanScheduledTask

Pause a STAN background task; returns the task.

resume​

resume(task_id: str) -> StanScheduledTask

Resume a paused STAN background task; returns the task.

Other​

add_monitor​

add_monitor(*, instruction: str) -> dict[str, Any]

Add a heartbeat watch: what STAN checks on each heartbeat, and what it does.

Parameters

  • instruction (str): In plain language: what to watch, what to do, and what needs your approval.

heartbeat​

heartbeat() -> dict[str, Any]

Get STAN's heartbeat configuration and last-run state.

remove_monitor​

remove_monitor(monitor_id: str) -> None

Remove a heartbeat watch.

Parameters

  • monitor_id (str): The watch's ID.

run_heartbeat​

run_heartbeat() -> dict[str, Any]

Trigger a STAN heartbeat run immediately.

update_heartbeat​

update_heartbeat(*, enabled: bool | None = None, checks: Sequence[str] | None = None, interval_minutes: int | None = None) -> dict[str, Any]

Update STAN's heartbeat configuration.

Parameters

  • enabled (bool | None, optional): Whether the heartbeat runs.
  • checks (Sequence[str] | None, optional): Names of the checks to run.
  • interval_minutes (int | None, optional): Minutes between heartbeat runs (server floor 5).

update_monitor​

update_monitor(monitor_id: str, *, instruction: str | None = None, state: str | None = None, enabled: bool | None = None) -> dict[str, Any]

Change a heartbeat watch.

Parameters

  • monitor_id (str): The watch's ID.
  • instruction (str | None, optional): Its new instruction.
  • state (str | None, optional): What it should remember across runs.
  • enabled (bool | None, optional): False pauses it, True resumes it.