Expand description
§stdiobus
AI agent transport layer - unified SDK for MCP/ACP protocols.
This is the umbrella crate that re-exports everything you need.
§Quick Start
use stdiobus::{StdioBus, BusConfig, PoolConfig, Result, RequestOptions};
use serde_json::json;
use std::time::Duration;
#[tokio::main]
async fn main() -> Result<()> {
let bus = StdioBus::builder()
.config(BusConfig {
pools: vec![PoolConfig {
id: "worker".into(),
command: "node".into(),
args: vec!["./worker.js".into()],
instances: 4,
}],
limits: None,
})
.backend_native()
.timeout(Duration::from_secs(60))
.build()?;
bus.start().await?;
let result = bus.request("tools/list", json!({})).await?;
bus.stop().await?;
Ok(())
}§Features
docker(default) - Docker backendnative- Native FFI backend (requires libstdio_bus.a)full- Both backends
Structs§
- BusConfig
- stdio_bus JSON configuration.
- BusMessage
- Message received from the bus
- BusStats
- Runtime statistics
- Docker
Options - Docker backend options
- Extensions
- Extension negotiation data
- Identity
- Identity extension data
- Json
RpcRequest - JSON-RPC 2.0 request
- Json
RpcResponse - JSON-RPC 2.0 response
- Limits
Config - Operational limits.
- Pool
Config - Worker pool configuration.
- Request
Options - Options for individual requests
- Stdio
Bus - Main stdio_bus client
- Stdio
BusBuilder - Builder for creating StdioBus instances
Enums§
- Backend
Mode - Backend mode selection
- BusState
- State of the stdio_bus instance
- Config
Source - Configuration source for the bus.
- Error
- Main error type for stdio_bus operations
- Error
Code - Canonical error codes for stdio_bus operations
- Json
RpcMessage - Generic JSON-RPC message (can be request or response)
Traits§
- Backend
- Backend trait that all implementations must satisfy
Type Aliases§
- Result
- Result type alias for stdio_bus operations