Skip to main content

STAN

STAN: workflow-builder assistant sessions.

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

Methods​

All methods​

cancel_run​

cancel_run(run_id: str) -> dict[str, Any]

Stop a STAN run; returns the run.

A queued run is cancelled at once (runStatus cancelled); a running one stops at its next checkpoint, so poll get_run.

Parameters

  • run_id (str): The run's ID.

cancel_session​

cancel_session(session_id: str) -> dict[str, Any]

Stop the runs a STAN session is working on or has queued; returns the session.

Parameters

  • session_id (str): The session's ID.

create_session​

create_session(*, model_id: str, active_workflow_id: str | None = None, active_workflow_name: str | None = None) -> dict[str, Any]

Start a new STAN assistant session and return its initial state.

Parameters

  • model_id (str): Id of the model STAN should use (required).
  • active_workflow_id (str | None, optional): Workflow the session opens against.
  • active_workflow_name (str | None, optional): Display name of that workflow.

end_session​

end_session(session_id: str) -> None

End a STAN session. Raises on failure; returns nothing.

history​

history(*, session_id: str | None = None, turns: int | None = None) -> dict[str, Any]

Read a STAN conversation's history, without changing which session is current.

Parameters

  • session_id (str | None, optional): The session; your current (main) session when omitted.
  • turns (int | None, optional): Only the last this many turns; every turn when omitted.

list_checkpoints​

list_checkpoints(session_id: str) -> dict[str, Any]

List a STAN session's checkpoints: the points its work can be reviewed at.

Parameters

  • session_id (str): The session's ID.

list_tool_executions​

list_tool_executions(*, run_id: str | None = None, limit: int | None = None) -> SyncPaginator[StanToolExecution]

STAN's tool calls for you, newest first.

Parameters

  • run_id (str | None, optional): Only one run's calls.
  • limit (int | None, optional): The most calls to return; all of them when omitted.

retrieve_run​

retrieve_run(run_id: str) -> dict[str, Any]

Get a STAN run: poll it until run_status is final, then read its response.

Parameters

  • run_id (str): The run's ID (from a message sent with async or a 202 answer).

retrieve_session​

retrieve_session(session_id: str) -> dict[str, Any]

Retrieve the current state of a STAN session.

revert​

revert(session_id: str, *, resource_ids: Sequence[str]) -> dict[str, Any]

Delete resources a STAN session created; only those listed are deleted.

Parameters

  • session_id (str): The session's ID.
  • resource_ids (Sequence[str]): The resources to delete (from revert_plan).

Returns

  • dict[str, Any]: What was deleted, what failed and what was skipped.

revert_plan​

revert_plan(session_id: str) -> dict[str, Any]

Show what undoing a STAN session would delete.

These are the resources the session created, each with its delete tool.

Parameters

  • session_id (str): The session's ID.

send_message​

send_message(session_id: str, *, message: str, attachments: Sequence[str | os.PathLike[str]] | None = None) -> dict[str, Any]

Send a message to a STAN session and return the run that answers it.

The run's response holds STAN's reply once runStatus is terminal; a run still working (async) is polled with get_run.

Parameters

  • session_id (str): Target session id.
  • message (str): The user message to send (required).
  • attachments (Sequence[str | os.PathLike[str]] | None, optional): Paths of images (PNG, JPEG, GIF, WebP) and PDF documents to send with the message. Each reaches the session's model the way the model declares it can take it: an image to a model that takes images, a PDF as a document to a model that takes PDFs and as its text to one that does not. An attachment the model cannot take is refused with a 400 that says why.

submit_credentials​

submit_credentials(run_id: str, *, values: Mapping[str, str]) -> dict[str, Any]

Give a paused STAN run the credentials it asked for; they never reach the model.

STAN resumes in a new run, which is returned (poll get_run).

Parameters

  • run_id (str): The run that asked for credentials.
  • values (Mapping[str, str]): Each requested field's value, by the field's key.