pub trait FrameTasks: Send + Sync {
// Required methods
fn caller_task(&self, lane: &str) -> Option<String>;
fn spawn(
&self,
lane: &str,
input: Value,
model: Option<&str>,
timeout_ms: u64,
) -> Result<String, String>;
fn result(&self, lane: &str, task_id: &str, signal: &Signal) -> Value;
fn reserve(&self, request: &Value) -> Result<Option<Value>, String>;
fn settle(&self, reservation: &Value, status: &str, usage: Option<&Value>);
fn code_tool(&self, lane: &str) -> Result<Arc<dyn AgentTool>, String>;
fn close_lane(&self, lane: &str);
// Provided methods
fn frame_context(&self, lane: &str, model: &Model, meter: FrameMeter) { ... }
fn charge_turn(&self, root: Option<&str>, reply: &AssistantMessage) { ... }
fn gate_request(&self, lane: &str, root: Option<&str>) -> FrameGate { ... }
fn gate_tool(
&self,
lane: &str,
root: Option<&str>,
) -> Option<(String, bool)> { ... }
}Expand description
The task host frames are admitted through (NativeHostApi): rlm-frame@1 tasks in the session’s task journal,
the usage ledger they charge, and the lanes that frames with depth run their rlm cells on.
Required Methods§
Sourcefn caller_task(&self, lane: &str) -> Option<String>
fn caller_task(&self, lane: &str) -> Option<String>
The task lane acts for (callerTaskId); none for the root lane.
Sourcefn spawn(
&self,
lane: &str,
input: Value,
model: Option<&str>,
timeout_ms: u64,
) -> Result<String, String>
fn spawn( &self, lane: &str, input: Value, model: Option<&str>, timeout_ms: u64, ) -> Result<String, String>
Admit an rlm-frame@1 task with input ({frame, task}) for lane; returns its task id.
Sourcefn result(&self, lane: &str, task_id: &str, signal: &Signal) -> Value
fn result(&self, lane: &str, task_id: &str, signal: &Signal) -> Value
Wait for the task’s terminal result ({status, value?, error?}); once signal aborts the task is cancelled
(“the calling cell was aborted”) and its cancelled result returned.
Sourcefn reserve(&self, request: &Value) -> Result<Option<Value>, String>
fn reserve(&self, request: &Value) -> Result<Option<Value>, String>
Reserve one model request in the usage ledger ({kind: "model", rootId?, taskId, parentTaskId, requestKey, budgetId, timeoutMs | deadlineAt}); None without a ledger.
Sourcefn settle(&self, reservation: &Value, status: &str, usage: Option<&Value>)
fn settle(&self, reservation: &Value, status: &str, usage: Option<&Value>)
Settle a reservation with the request’s status and provider-reported usage ({inputTokens, outputTokens, totalTokens, cost}).
Sourcefn code_tool(&self, lane: &str) -> Result<Arc<dyn AgentTool>, String>
fn code_tool(&self, lane: &str) -> Result<Arc<dyn AgentTool>, String>
The rlm tool on lane (its own kernel) for a frame that runs code.
Sourcefn close_lane(&self, lane: &str)
fn close_lane(&self, lane: &str)
Close lane once its frame ended.
Provided Methods§
Sourcefn frame_context(&self, lane: &str, model: &Model, meter: FrameMeter)
fn frame_context(&self, lane: &str, model: &Model, meter: FrameMeter)
The frame running code on lane talks to model; meter reads its conversation’s context use (the
newest answer’s usage plus estimates after it), for the context reminder of the lane’s cells. Ends with
FrameTasks::close_lane.
Sourcefn charge_turn(&self, root: Option<&str>, reply: &AssistantMessage)
fn charge_turn(&self, root: Option<&str>, reply: &AssistantMessage)
Count one model response of a frame toward its root’s tree limits (recordTurn(usageRootForLane(lane, runId)) of every lane’s after_response).
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".