Skip to content

openagents_sdk::runs

Presence and progress for runs from any agent or harness.

ItemWhat it does
RunFilter structFilters combined with AND.
RunHeartbeat structA host's latest report.
RunKind enumWhere a run executes.
Runs structRuns belonging to one signed-in account.
valid_id fnWhether an identifier can be used in a run URL or report.
HEARTBEAT_INTERVAL_MS constMinimum interval between heartbeats with the same status, in milliseconds.
LIVE_WINDOW_MS constA run is live for three minutes after its last accepted heartbeat.

RunFilter

pub struct RunFilter {
    pub live: Option<bool>,
    pub issue: Option<u64>,
}

Filters combined with AND. live: Some(false) selects ended or expired runs.

RunHeartbeat

pub struct RunHeartbeat {
    pub run: String,
    pub kind: RunKind,
    pub harness: String,
    pub harness_session: Option<String>,
    pub computer: String,
    pub issues: Vec<u64>,
    pub status: SessionStatus,
    pub last_output_at: i64,
    pub last_progress_at: Option<i64>,
    pub note: Option<String>,
    pub agent: Option<String>,
}

A host's latest report. Output and progress times are Unix milliseconds; neither is proof of liveness. The server records receipt time separately.

RunHeartbeat::valid

pub fn valid(&self) -> bool

Whether the report meets the API's size and value limits.

RunKind

pub enum RunKind {
    AppChat,
    Terminal,
    CloudWork,
    Landing,
}

Where a run executes.

Runs

pub struct Runs<'a> {}

Runs belonging to one signed-in account.

Runs::heartbeat

pub async fn heartbeat(
    &self,
    beat: &RunHeartbeat,
    cancel: &CancellationToken,
) -> Result<(), Error>

Report once a minute and on status changes. An exact retry within a minute succeeds without extending liveness. Ended IDs cannot receive heartbeats.

Calls PUT /v1/runs/{id}/heartbeat

Runs::list

pub async fn list(
    &self,
    filter: RunFilter,
    cancel: &CancellationToken,
) -> Result<Vec<RunHeartbeat>, Error>

List at most 512 reports, newest receipt first. Reports disappear after 24 hours without a heartbeat; ended runs use their end time.

Calls GET /v1/runs

Runs::end

pub async fn end(&self, run: &str, cancel: &CancellationToken) -> Result<(), Error>

Record that a known run has ended. Repeated requests succeed; an unknown ID is 404.

Calls POST /v1/runs/{id}/end

valid_id

pub fn valid_id(id: &str) -> bool

Whether an identifier can be used in a run URL or report.

HEARTBEAT_INTERVAL_MS

pub const HEARTBEAT_INTERVAL_MS: i64 = 60_000;

Minimum interval between heartbeats with the same status, in milliseconds.

LIVE_WINDOW_MS

pub const LIVE_WINDOW_MS: i64 = 180_000;

A run is live for three minutes after its last accepted heartbeat.