Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Xybrid Core
The Rust orchestrator runtime for hybrid cloud-edge AI inference. This library provides the core components for building applications that intelligently route AI model inference between local devices and cloud services.
Overview
Xybrid Core implements a policy-driven orchestrator that:
- Evaluates policies to enforce data-handling and routing rules
- Makes routing decisions based on device metrics, policy results, and model availability
- Executes inference on local or cloud targets with fallback handling
- Manages streaming data flows for real-time applications
- Collects telemetry for observability and performance monitoring
- Provides event-driven communication between components
Architecture
The orchestrator follows a five-stage runtime flow:
- Policy Evaluation - Check if the request is allowed and determine constraints
- Routing Decision - Choose execution target (local, cloud, or fallback)
- Execution - Run the model inference on the selected target
- Telemetry - Emit observability data
- Event Broadcasting - Notify subscribers of pipeline events
Core Components
Orchestrator
The main entry point that coordinates pipeline execution.
use Orchestrator;
use ;
use LocalAvailability;
// Create a new orchestrator
let mut orchestrator = new;
// Execute a single stage
let stage = StageDescriptor ;
let input = new;
let metrics = DeviceMetrics ;
let availability = new;
let result = orchestrator.execute_stage?;
// Execute a multi-stage pipeline
let stages = vec!;
let results = orchestrator.execute_pipeline?;
Policy Engine
Evaluates policies to determine if requests are allowed and what constraints apply.
use ;
let mut engine = new;
// Load policies from YAML or JSON
let policy_yaml = r#"
version: "0.1.0"
rules:
- id: "audio_rule"
expression: "input.kind == \"AudioRaw\""
action: "deny"
signature: "test-signature"
"#;
engine.load_policies?;
// Evaluate policy for a request
let result = engine.evaluate;
if !result.allowed
Routing Engine
Makes intelligent routing decisions based on device metrics, policy results, and model availability.
use ;
let mut routing_engine = new;
// Make a routing decision
let decision = routing_engine.decide;
match decision.target
Executor
Executes model inference on the selected target.
use ;
let executor = new;
// Execute on a specific target
let = executor.execute?;
println!;
Device Adapter
Collects real-time device metrics for routing decisions.
use ;
let adapter = new;
let metrics = adapter.collect_metrics;
println!;
println!;
println!;
Registry
Manages storage and retrieval of bundles (policies, models, configs).
use ;
// Create a registry (defaults to ~/.xybrid/registry)
let mut registry = default?;
// Store a bundle
let bundle_data = b"model binary data".to_vec;
let metadata = registry.store_bundle?;
// Retrieve a bundle
let retrieved = registry.get_bundle?;
// List all bundles
let bundles = registry.list_bundles?;
Telemetry
Collects and exports structured observability data.
use Telemetry;
let telemetry = new;
// Log events
telemetry.log_stage_start;
telemetry.log_routing_decision;
telemetry.log_stage_complete;
Event Bus
Pub/sub mechanism for event-driven communication.
use ;
let event_bus = new;
// Subscribe to events
let subscription = event_bus.subscribe;
// Publish events
event_bus.publish;
// Receive events
if let Ok = subscription.try_recv
Stream Manager
Manages streaming data flows for real-time applications.
use ;
let config = StreamConfig ;
let mut stream_manager = with_config;
// Push input chunks
stream_manager.push_input_chunk?;
stream_manager.push_input_chunk?; // last chunk
// Pop output chunks
while let Some = stream_manager.pop_output_chunk?
Examples
The examples/ directory contains several examples:
hiiipe.rs- Complete Hiiipe pipeline demonstration (ASR → Motivator → TTS)device_metrics.rs- Device metrics collection exampleregistry_demo.rs- Registry bundle storage and retrieval
Run an example:
Testing
The library includes comprehensive unit tests and integration tests:
# Run all tests
# Run with output
# Run integration tests
Module Structure
orchestrator- Main orchestrator coordination logicpolicy_engine- Policy evaluation and enforcementrouting_engine- Routing decision makingexecutor- Model execution on local/cloud targetsstream_manager- Streaming data flow managementtelemetry- Observability and metrics collectionevent_bus- Event-driven pub/sub communicationcontext- Shared data structures (Envelope, DeviceMetrics, etc.)device_adapter- Device metrics collectionregistry- Bundle storage and retrievalcontrol_sync- Control plane synchronization (TODO)
Dependencies
serde/serde_json/serde_yaml- Serializationanyhow- Error handlingdirs- Platform-specific directories
License
See the main repository LICENSE file.