Skip to main content

Crate active_rpc

Crate active_rpc 

Source
Expand description

Active RPC — capability-based, promise-pipelined RPC for Active.

Active RPC moves Active Infinity modules and capabilities between agents. It is built around five ideas:

  1. Capabilities, not ambient authority. A capability is an unforgeable 128-bit id minted by a kernel. Holding it is the only permission needed, attenuation can only narrow it, and dropping the last handle notifies the provider.
  2. Promises that pipeline. A pending result can be passed to another call, so a chain costs one provider round-trip instead of one per step.
  3. Lanes and channels. One agent runs many lanes with independent budgets and speaks on many channels at once, including transfers of capabilities.
  4. Domain operations. evaluate, why, impact, subgraph and patch operate directly on Infinity modules under the capability’s budget.
  5. Transports as adapters. In-process, shared memory, TCP, QUIC and a gRPC/Connect bridge carry the same envelope, so capability semantics do not depend on the wire.

§Example

use active_rpc::cap::CapAttrs;
use active_rpc::domain::ModuleProvider;
use active_rpc::value::{Arg, Value};
use active_rpc::{Agent, Budget};

// A module capability with a call budget.
let mut provider = ModuleProvider::new();
let object = provider.install(active_rpc::domain::module_from_source(
    "port = 8080\n",
    "demo.active",
)?);
let agent = Agent::new();
let provider_id = agent.register(Box::new(provider));
let cap = agent.mint(provider_id, object, CapAttrs::new(&["stats"]))?;
let lane = agent.create_lane("main", Budget::default())?;

let promise = agent.call(lane, &cap, "stats", vec![])?;
let stats = promise.value()?;
assert!(matches!(stats, Value::Map(_)));

Re-exports§

pub use budget::Budget;
pub use budget::BudgetMeter;
pub use cap::CapAttrs;
pub use cap::CapHandle;
pub use cap::CapId;
pub use cap::CapRecord;
pub use cap::ProviderId;
pub use cap::ToolPolicy;
pub use channel::Channel;
pub use channel::ChannelId;
pub use channel::Direction;
pub use channel::Message;
pub use error::Error;
pub use error::Result;
pub use kernel::Agent;
pub use kernel::Event;
pub use kernel::PromiseHandle;
pub use kernel::Provider;
pub use lane::Lane;
pub use lane::LaneId;
pub use promise::PromiseId;
pub use promise::PromiseState;
pub use value::Arg;
pub use value::Call;
pub use value::Response;
pub use value::Value;
pub use wire::CapDescriptor;
pub use wire::Envelope;
pub use wire::Kind;
pub use wire::WireLimits;

Modules§

budget
Hard resource budgets.
cap
Capabilities: unforgeable, attenuable references.
channel
Channels: named streams of messages and capability transfers.
domain
Domain operations over Active Infinity modules.
error
Stable, machine-readable errors for Active RPC.
kernel
The kernel: one agent’s capability table, promise graph, lanes, channels and dispatch loop.
lane
Lanes: independent concurrent execution contexts inside one agent.
promise
Promises: results that exist before they are ready.
security
Security helpers shared by providers and transports.
tool
Tool handles: MCP sessions, HTTP/OpenAPI endpoints, local processes.
transport
Transports.
value
Values, arguments and results crossing an Active RPC boundary.
wire
The wire envelope: one frame of Active RPC traffic.

Constants§

MODULE_METHODS
Methods every module capability can be granted.
PROTOCOL_VERSION
Protocol version carried in every envelope.
VERSION
Crate version.