Skip to content

openagents_sdk::attention

Account-wide events that need an agent's or person's attention.

ItemWhat it does
Attention enumWhat needs attention.
AttentionEvent structOne event in an account's attention stream.
AttentionStream structAttention events in order, read with [`AttentionStream::next`].
Resource enumA machine resource that can run low.
CLAIM_IDLE_AFTER_MS constA live run holding issues with no progress for this long raises [`Attention::ClaimNoProgress`], in milliseconds.
STALL_AFTER_MS constA working run with no output for this long is stalled, in milliseconds.

Attention

pub enum Attention {
    RunStalled { run: String, since: i64 },
    RunAwaitingInput { run: String, question: String },
    RunErrored { run: String, reason: String },
    ClaimNoProgress { issue: u64, holder: String, since: i64 },
    LandingFailed { entry: String, issue: Option<u64>, reason: String },
    WorkFinished { work: String, issue: u64, outcome: String },
    MachineLow { computer: String, resource: Resource, value: u64 },
    Unknown,
}

What needs attention. Times are Unix milliseconds.

AttentionEvent

pub struct AttentionEvent {
    pub seq: u64,
    pub at: i64,
    pub agent: Option<String>,
    pub attention: Attention,
}

One event in an account's attention stream.

AttentionStream

pub struct AttentionStream {}

Attention events in order, read with [AttentionStream::next].

AttentionStream::cursor

pub fn cursor(&self) -> u64

The last event's seq, or the starting cursor; resume from here.

AttentionStream::next

pub async fn next(&mut self) -> Result<Option<AttentionEvent>, Error>

Reads the next event. Returns None when the server closes the stream; reconnect with [AttentionStream::cursor].

Resource

pub enum Resource {
    Disk,
    Memory,
}

A machine resource that can run low.

CLAIM_IDLE_AFTER_MS

pub const CLAIM_IDLE_AFTER_MS: i64 = 20 * 60 * 1000;

A live run holding issues with no progress for this long raises [Attention::ClaimNoProgress], in milliseconds.

STALL_AFTER_MS

pub const STALL_AFTER_MS: i64 = 20 * 60 * 1000;

A working run with no output for this long is stalled, in milliseconds.