pub struct Runtime { /* private fields */ }Expand description
A configured runtime: node registry, host services and a thread pool. Create one per app and share it.
Implementations§
Source§impl Runtime
impl Runtime
Sourcepub fn list_lessons(
&self,
agent: String,
status: Option<LessonStatus>,
) -> Result<Vec<LessonInfo>, GraphrtError>
pub fn list_lessons( &self, agent: String, status: Option<LessonStatus>, ) -> Result<Vec<LessonInfo>, GraphrtError>
The lessons of agent, optionally only those in status.
Sourcepub fn add_lesson(
&self,
agent: String,
user: Option<String>,
kind: LessonKind,
text: String,
) -> Result<LessonInfo, GraphrtError>
pub fn add_lesson( &self, agent: String, user: Option<String>, kind: LessonKind, text: String, ) -> Result<LessonInfo, GraphrtError>
A lesson the owner wrote; it is approved at once.
Sourcepub fn propose_lesson(
&self,
proposal: LessonProposal,
) -> Result<LessonInfo, GraphrtError>
pub fn propose_lesson( &self, proposal: LessonProposal, ) -> Result<LessonInfo, GraphrtError>
Propose a lesson from feedback on a run. It waits for the owner’s decision
(Runtime::decide_lesson) before any run uses it.
Sourcepub fn decide_lesson(
&self,
agent: String,
id: String,
decision: LessonDecision,
) -> Result<LessonInfo, GraphrtError>
pub fn decide_lesson( &self, agent: String, id: String, decision: LessonDecision, ) -> Result<LessonInfo, GraphrtError>
Approve, reject or retire a lesson.
Sourcepub fn delete_lesson(
&self,
agent: String,
id: String,
) -> Result<(), GraphrtError>
pub fn delete_lesson( &self, agent: String, id: String, ) -> Result<(), GraphrtError>
Delete a lesson for good.
Source§impl Runtime
impl Runtime
Sourcepub fn install_skill(
&self,
request: SkillInstall,
) -> Result<SkillInfo, GraphrtError>
pub fn install_skill( &self, request: SkillInstall, ) -> Result<SkillInfo, GraphrtError>
Install a skill from its SKILL.md. It is enabled once installed.
Sourcepub fn list_skills(&self) -> Result<Vec<SkillInfo>, GraphrtError>
pub fn list_skills(&self) -> Result<Vec<SkillInfo>, GraphrtError>
Every installed skill.
Sourcepub fn set_skill_enabled(
&self,
name: String,
enabled: bool,
) -> Result<SkillInfo, GraphrtError>
pub fn set_skill_enabled( &self, name: String, enabled: bool, ) -> Result<SkillInfo, GraphrtError>
Turn a skill on or off for every agent.
Sourcepub fn remove_skill(&self, name: String) -> Result<(), GraphrtError>
pub fn remove_skill(&self, name: String) -> Result<(), GraphrtError>
Remove an installed skill.
Source§impl Runtime
impl Runtime
Sourcepub fn new(config_json: String) -> Result<Arc<Self>, GraphrtError>
pub fn new(config_json: String) -> Result<Arc<Self>, GraphrtError>
Create a runtime from a config JSON document ("{}" for defaults).
May perform network I/O (MCP handshakes); call it off the UI thread.
Sourcepub fn register_tool_provider(
&self,
name: String,
tools: Vec<HostToolSpec>,
provider: Arc<dyn ToolProvider>,
) -> Result<(), GraphrtError>
pub fn register_tool_provider( &self, name: String, tools: Vec<HostToolSpec>, provider: Arc<dyn ToolProvider>, ) -> Result<(), GraphrtError>
Register native tools implemented by the app under provider name.
Agents list them in tools as <name>/<tool>, or all of them with a * as the tool; require_approval
of an agent node can hold their calls for approval. Workflows loaded
after this call see the tools. Fails when the name is taken (by an MCP
server, the files workspace or an earlier provider) or a declaration
is invalid.
Sourcepub fn tool_providers(&self) -> Vec<String>
pub fn tool_providers(&self) -> Vec<String>
Names of the registered tool providers (MCP servers, files, the app’s own).
Sourcepub fn set_credential_provider(
&self,
provider: String,
callback: Arc<dyn CredentialProvider>,
)
pub fn set_credential_provider( &self, provider: String, callback: Arc<dyn CredentialProvider>, )
Register the host’s credential callback for provider (a name from the
config’s credentials section), or "*" for every provider. Replaces any
previous callback and drops every cached credential, so it takes effect for
requests made after the call (e.g. a different user signed in).
Sourcepub fn clear_credential_provider(&self, provider: String)
pub fn clear_credential_provider(&self, provider: String)
Remove the credential callback registered for provider (or "*") and drop
every cached credential (sign-out takes effect on the next request).
Sourcepub fn clear_credential_cache(&self)
pub fn clear_credential_cache(&self)
Drop every cached credential without changing the registered callbacks (e.g. the user signed out of your backend and broker tokens must not be reused).
Sourcepub fn register_wasm_plugin(
&self,
wasm: Vec<u8>,
) -> Result<Vec<String>, GraphrtError>
pub fn register_wasm_plugin( &self, wasm: Vec<u8>, ) -> Result<Vec<String>, GraphrtError>
Load a sandboxed WebAssembly plugin; its node kinds become available to workflows loaded afterwards. Returns the registered kinds.
Sourcepub fn catalog_json(&self) -> String
pub fn catalog_json(&self) -> String
Catalog of every node kind available in this runtime, as a JSON array.
Sourcepub fn load_workflow(
self: Arc<Self>,
document: String,
) -> Result<Arc<WorkflowHandle>, GraphrtError>
pub fn load_workflow( self: Arc<Self>, document: String, ) -> Result<Arc<WorkflowHandle>, GraphrtError>
Parse and compile a workflow (YAML or JSON).
Sourcepub fn load_bundle(
self: Arc<Self>,
bundle: Vec<u8>,
trusted_keys: Vec<String>,
) -> Result<Arc<WorkflowHandle>, GraphrtError>
pub fn load_bundle( self: Arc<Self>, bundle: Vec<u8>, trusted_keys: Vec<String>, ) -> Result<Arc<WorkflowHandle>, GraphrtError>
Open a portable bundle (.grt bytes), register its WebAssembly plugins and
compile its entry workflow. Every file is checked against the manifest’s
SHA-256; when trusted_keys (hex Ed25519 public keys) is non-empty, the
bundle must be signed by one of them. Bundles needing process or HTTP
plugins are rejected: embedded hosts cannot spawn processes.