pub struct PausedRun { /* private fields */ }Expand description
A paused run: its requests, the answers given so far and its snapshot.
Implementations§
Source§impl PausedRun
impl PausedRun
Sourcepub fn from_json(json: String) -> Result<Arc<Self>, GraphrtError>
pub fn from_json(json: String) -> Result<Arc<Self>, GraphrtError>
A paused run from the result JSON of a run that ended with status
paused (what RunHandle.waitJson and EventListener.onFinish return),
or from what PausedRun::to_json returned.
Sourcepub fn to_json(&self) -> String
pub fn to_json(&self) -> String
The paused run as JSON (requests and snapshot, not the answers), to store
and read back with PausedRun::from_json. It holds the run’s variables
(never secrets): keep it in the app’s private storage.
Sourcepub fn snapshot_json(&self) -> String
pub fn snapshot_json(&self) -> String
The snapshot alone, for WorkflowHandle.resume.
Sourcepub fn requests(&self) -> Vec<ApprovalRequest>
pub fn requests(&self) -> Vec<ApprovalRequest>
Every request of the run, in the order the nodes paused.
Sourcepub fn unanswered(&self) -> Vec<String>
pub fn unanswered(&self) -> Vec<String>
Keys of the requests that have no answer yet. Resuming with requests unanswered keeps those nodes paused.
Sourcepub fn approve(
&self,
key: String,
reason: Option<String>,
) -> Result<(), GraphrtError>
pub fn approve( &self, key: String, reason: Option<String>, ) -> Result<(), GraphrtError>
Approve request key: every held tool call runs, or a form is answered
with its approve action and the fields’ defaults.
Sourcepub fn reject(
&self,
key: String,
reason: Option<String>,
) -> Result<(), GraphrtError>
pub fn reject( &self, key: String, reason: Option<String>, ) -> Result<(), GraphrtError>
Reject request key: the model is told the calls were not approved (and
why, with reason), or a form is answered with its reject action.
Sourcepub fn decide_tool_call(
&self,
key: String,
call_id: String,
approved: bool,
) -> Result<(), GraphrtError>
pub fn decide_tool_call( &self, key: String, call_id: String, approved: bool, ) -> Result<(), GraphrtError>
Approve or reject one held tool call of request key. Calls without a
decision keep the node paused.
Sourcepub fn answer(
&self,
key: String,
action: String,
values_json: String,
) -> Result<(), GraphrtError>
pub fn answer( &self, key: String, action: String, values_json: String, ) -> Result<(), GraphrtError>
Answer the form of request key with action (one of its actions) and
field values as a JSON object; fields left out get their defaults.
Sourcepub fn set_input(
&self,
key: String,
input_json: String,
) -> Result<(), GraphrtError>
pub fn set_input( &self, key: String, input_json: String, ) -> Result<(), GraphrtError>
Set the resume input of request key as raw JSON, for pause kinds the
helpers above do not cover.
Sourcepub fn inputs_json(&self) -> String
pub fn inputs_json(&self) -> String
The resume inputs collected so far, as JSON (what WorkflowHandle.resume takes).