Skip to main content

Module native_skill

Module native_skill 

Source
Expand description

Native Skill Trait System.

Provides a mechanism for embedding high-performance Rust tool implementations directly into the runtime binary, bypassing MCP serialization overhead for critical hot-path operations.

§Architecture

Native skills implement the NativeSkill trait and are registered in the NativeSkillRegistry. When the orchestrator receives a tool call, it first checks whether a native skill is registered for that tool name. If found, the native skill is executed directly; otherwise, the call falls through to MCP.

§Example

ⓘ
use universal_agent_runtime::uar::runtime::native_skill::{NativeSkill, NativeSkillRegistry};

struct MyTool;

#[async_trait::async_trait]
impl NativeSkill for MyTool {
    fn name(&self) -> &str { "my_tool" }
    fn description(&self) -> &str { "Does something useful" }
    fn parameters_schema(&self) -> serde_json::Value {
        serde_json::json!({ "type": "object", "properties": {} })
    }
    async fn execute(&self, _args: serde_json::Value) -> anyhow::Result<serde_json::Value> {
        Ok(serde_json::json!({ "result": "done" }))
    }
}

let registry = NativeSkillRegistry::new();
registry.register(MyTool).await?;

Structs§

NativeCanonicalReceiptData
NativeExecutionContext
Non-model-owned capability supplied by the governed host tool loop.
NativeSkillRegistry
Registry holding all registered native skills, keyed by their name.
PresentationExecutionContext
Opaque per-call Presentation capability. Only the trusted run host can construct it; public context struct-update construction remains supported.

Traits§

NativeSkill
Trait for embedding high-performance Rust tool implementations directly into the runtime binary.