pub struct WorkflowHandle { /* private fields */ }Expand description
A compiled workflow, ready to run any number of times concurrently.
Implementations§
Source§impl WorkflowHandle
impl WorkflowHandle
Sourcepub fn allow_env(&self, names: Vec<String>)
pub fn allow_env(&self, names: Vec<String>)
Give a bundle the app’s env variables names (from the runtime’s env).
A bundle gets none otherwise: it is foreign code, also when the app
downloaded it. Names that read like a credential of the app (a model
key, a cloud credential, GRAPHRT_*, a variable the app’s providers,
knowledge or MCP config reads) also need WorkflowHandle::allow_credential.
A run that needs a variable it was not given fails with env_refused.
A workflow of the app’s own (load_workflow) reads every variable it declares.
Sourcepub fn allow_credential(&self, names: Vec<String>)
pub fn allow_credential(&self, names: Vec<String>)
Give a bundle names although they read like credentials of the app:
with WorkflowHandle::allow_env too, the bundle can send them anywhere.
Sourcepub fn warnings(&self) -> Vec<String>
pub fn warnings(&self) -> Vec<String>
Non-fatal findings from compilation (e.g. unreachable nodes).
Sourcepub fn catalog_json(&self) -> String
pub fn catalog_json(&self) -> String
Descriptors of the node kinds this workflow uses, as a JSON array.
Sourcepub fn document_json(&self) -> String
pub fn document_json(&self) -> String
The workflow document as canonical JSON.
Sourcepub fn run(
&self,
inputs_json: String,
sys_json: String,
listener: Arc<dyn EventListener>,
) -> Result<Arc<RunHandle>, GraphrtError>
pub fn run( &self, inputs_json: String, sys_json: String, listener: Arc<dyn EventListener>, ) -> Result<Arc<RunHandle>, GraphrtError>
Start a run. inputs_json / sys_json are JSON objects ("{}" when empty).
Sourcepub fn start(
&self,
inputs_json: String,
sys_json: String,
listener: Arc<dyn RunListener>,
) -> Result<Arc<RunHandle>, GraphrtError>
pub fn start( &self, inputs_json: String, sys_json: String, listener: Arc<dyn RunListener>, ) -> Result<Arc<RunHandle>, GraphrtError>
Start a run whose events arrive typed (RunEvent). It ends with
RunEvent::Paused or RunEvent::Finished.
Sourcepub fn resume_paused(
&self,
paused: Arc<PausedRun>,
secrets_json: String,
listener: Arc<dyn RunListener>,
) -> Result<Arc<RunHandle>, GraphrtError>
pub fn resume_paused( &self, paused: Arc<PausedRun>, secrets_json: String, listener: Arc<dyn RunListener>, ) -> Result<Arc<RunHandle>, GraphrtError>
Resume a paused run with the answers given on paused
(PausedRun::approve, PausedRun::answer…). secrets_json
re-supplies non-env secrets as {"namespace.name": "value"}.
Sourcepub fn resume(
&self,
snapshot_json: String,
inputs_json: String,
secrets_json: String,
listener: Arc<dyn EventListener>,
) -> Result<Arc<RunHandle>, GraphrtError>
pub fn resume( &self, snapshot_json: String, inputs_json: String, secrets_json: String, listener: Arc<dyn EventListener>, ) -> Result<Arc<RunHandle>, GraphrtError>
Resume a paused run from the snapshot carried by its run_paused event.
inputs_json maps paused node ids (or frame/node ids) to their input,
e.g. {"review": {"action": "approve", "values": {}}}. secrets_json
re-supplies non-env secrets as {"namespace.name": "value"}.