Skip to content

openagents_sdk::agents::assignments

Requests to an app on a person's computer, carried by that computer's signed-in session.

ItemWhat it does
Assignment structA task assigned to an agent on a computer, with its chat, state, and result.
AssignmentAction enumA user action on an assignment.
AssignmentCommand structA user action on an assignment with its request ID.
AssignmentPage structOne page of assignments and the cursor for the next page.
AssignmentReport structThe request body a computer sends to report an assignment's state and result.
AssignmentSpec structWhat to run: an agent revision, the computer and optional project, and the task text.
AssignmentState enumWhere an assignment is in its life.
CreateAssignment structThe request body that assigns a task to an agent.

Assignment

pub struct Assignment {
    pub id: String,
    pub revision: u64,
    pub spec: AssignmentSpec,
    pub definition: AgentDefinition,
    pub chat: String,
    pub state: AssignmentState,
    pub commands: Vec<AssignmentCommand>,
    pub result: Option<String>,
    pub archived: bool,
    pub active_command: Option<String>,
    pub after_seq: u64,
}

A task assigned to an agent on a computer, with its chat, state, and result.

AssignmentAction

pub enum AssignmentAction {
    FollowUp { text: String },
    Stop,
    Archive,
}

A user action on an assignment.

AssignmentCommand

pub struct AssignmentCommand {
    pub request_id: String,
    pub action: AssignmentAction,
}

A user action on an assignment with its request ID.

AssignmentPage

pub struct AssignmentPage {
    pub data: Vec<Assignment>,
    pub next: Option<String>,
}

One page of assignments and the cursor for the next page.

AssignmentReport

pub struct AssignmentReport {
    pub active_command: Option<String>,
    pub after_seq: u64,
    pub request_id: String,
    pub host: String,
    pub expected_revision: u64,
    pub state: AssignmentState,
    pub result: Option<String>,
}

The request body a computer sends to report an assignment's state and result.

AssignmentSpec

pub struct AssignmentSpec {
    pub agent: String,
    pub agent_revision: u64,
    pub host: String,
    pub project: Option<String>,
    pub task: String,
}

What to run: an agent revision, the computer and optional project, and the task text.

AssignmentSpec::validate

pub fn validate(&self) -> Result<(), &'static str>

Checks the fields and returns a message for the user when one is not valid.

AssignmentState

pub enum AssignmentState {
    Queued,
    Running,
    Completed,
    Failed,
    Stopped,
    Unknown,
}

Where an assignment is in its life.

CreateAssignment

pub struct CreateAssignment {
    pub request_id: String,
    pub spec: AssignmentSpec,
}

The request body that assigns a task to an agent.