Skip to main content

FrameTasks

Trait FrameTasks 

Source
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§

Source

fn caller_task(&self, lane: &str) -> Option<String>

The task lane acts for (callerTaskId); none for the root lane.

Source

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.

Source

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.

Source

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.

Source

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}).

Source

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.

Source

fn close_lane(&self, lane: &str)

Close lane once its frame ended.

Provided Methods§

Source

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.

Source

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).

Source

fn gate_request(&self, lane: &str, root: Option<&str>) -> FrameGate

The tree-limit gate of a request of the frame running code on lane (before_request).

Source

fn gate_tool(&self, lane: &str, root: Option<&str>) -> Option<(String, bool)>

The tree-limit gate of a cell of the frame running code on lane (before_tool): (reason, terminate) refuses it.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§