openagents_sdk::agents
Private, revisioned agent definitions. Saving a definition never starts work.
| Item | What it does |
|---|---|
AgentPage struct | One page of agent definitions and the cursor for the next page. |
AgentRequest struct | A saved mutation belongs to exactly one account and deployment. |
Agents struct | Calls the agent definition and assignment routes for one signed-in session. |
CreateAgent struct | The request body that saves a new agent definition. |
DeleteAgent struct | The request body that deletes an agent definition at an expected revision. |
UpdateAgent struct | The request body that replaces an agent definition at an expected revision. |
request_id fn | Returns a new random request ID as 64 hexadecimal characters. |
AgentPage
pub struct AgentPage {
pub data: Vec<AgentDefinition>,
pub next: Option<String>,
}
One page of agent definitions and the cursor for the next page.
AgentRequest
pub struct AgentRequest<T> {
pub body: T,
}
A saved mutation belongs to exactly one account and deployment. Keep it across retries.
Agents
pub struct Agents<'a> {}
Calls the agent definition and assignment routes for one signed-in session.
Agents::assignment_request
pub fn assignment_request(
&self,
spec: AssignmentSpec,
) -> Result<AgentRequest<CreateAssignment>, Error>
Checks spec and prepares a request that creates an assignment.
Agents::command_request
pub fn command_request(
&self,
action: AssignmentAction,
) -> Result<AgentRequest<AssignmentCommand>, Error>
Checks action and prepares a request that sends it to an assignment.
Agents::report_request
pub fn report_request(
&self,
host: String,
expected_revision: u64,
state: AssignmentState,
result: Option<String>,
active_command: Option<String>,
after_seq: u64,
) -> Result<AgentRequest<AssignmentReport>, Error>
Prepares a request a computer uses to report an assignment's state.
Agents::assign
pub async fn assign(
&self,
request: &AgentRequest<CreateAssignment>,
cancel: &CancellationToken,
) -> Result<Assignment, Error>
Creates an assignment from a prepared request.
Agents::assignment
pub async fn assignment(
&self,
id: &str,
cancel: &CancellationToken,
) -> Result<Assignment, Error>
Fetches the assignment id.
Agents::assignments
pub async fn assignments(
&self,
host: Option<&str>,
after: Option<&str>,
cancel: &CancellationToken,
) -> Result<AssignmentPage, Error>
Lists assignments, optionally for one computer, starting after the cursor after.
Agents::command
pub async fn command(
&self,
id: &str,
request: &AgentRequest<AssignmentCommand>,
cancel: &CancellationToken,
) -> Result<Assignment, Error>
Sends a prepared user action to the assignment id.
Agents::report
pub async fn report(
&self,
id: &str,
request: &AgentRequest<AssignmentReport>,
cancel: &CancellationToken,
) -> Result<Assignment, Error>
Sends a prepared state report for the assignment id.
Agents::create_request
pub fn create_request(
&self,
spec: AgentSpec,
) -> Result<AgentRequest<CreateAgent>, Error>
Checks spec and prepares a request that saves it as a new agent.
Agents::update_request
pub fn update_request(
&self,
expected_revision: u64,
spec: AgentSpec,
) -> Result<AgentRequest<UpdateAgent>, Error>
Checks spec and prepares a request that replaces the agent at expected_revision.
Agents::delete_request
pub fn delete_request(
&self,
expected_revision: u64,
) -> Result<AgentRequest<DeleteAgent>, Error>
Prepares a request that deletes the agent at expected_revision.
Agents::list
pub async fn list(
&self,
after: Option<&str>,
limit: usize,
cancel: &CancellationToken,
) -> Result<AgentPage, Error>
Lists up to limit agent definitions (1 to 100), starting after the cursor after.
Agents::get
pub async fn get(
&self,
id: &str,
revision: Option<u64>,
cancel: &CancellationToken,
) -> Result<AgentDefinition, Error>
Fetches one agent definition, at revision when given or the latest otherwise.
Agents::create
pub async fn create(
&self,
request: &AgentRequest<CreateAgent>,
cancel: &CancellationToken,
) -> Result<AgentDefinition, Error>
Saves a new agent definition from a prepared request.
Agents::update
pub async fn update(
&self,
id: &str,
request: &AgentRequest<UpdateAgent>,
cancel: &CancellationToken,
) -> Result<AgentDefinition, Error>
Replaces the agent definition id from a prepared request.
Agents::delete
pub async fn delete(
&self,
id: &str,
request: &AgentRequest<DeleteAgent>,
cancel: &CancellationToken,
) -> Result<AgentDefinition, Error>
Deletes the agent definition id from a prepared request.
CreateAgent
pub struct CreateAgent {
pub request_id: String,
pub spec: AgentSpec,
}
The request body that saves a new agent definition.
DeleteAgent
pub struct DeleteAgent {
pub request_id: String,
pub expected_revision: u64,
}
The request body that deletes an agent definition at an expected revision.
UpdateAgent
pub struct UpdateAgent {
pub request_id: String,
pub expected_revision: u64,
pub spec: AgentSpec,
}
The request body that replaces an agent definition at an expected revision.
request_id
pub fn request_id() -> Result<String, Error>
Returns a new random request ID as 64 hexadecimal characters.
Re-exported from other crates
ANY_RUNTIMEfromagent_contractAccessfromagent_contractAgentDefinitionfromagent_contractAgentSpecfromagent_contractMAX_FALLBACKSfromagent_contractProfilefromagent_contractRuntimeChoicefromagent_contractvalid_idfromagent_contract