Expand description
§ODIN Protocol - Rust Crate
The world’s first standardized AI-to-AI communication infrastructure for Rust.
§Features
- Ultra-High Performance: 57,693+ messages per second throughput
- Sub-millisecond Response: 0.03ms average response times
- Cross-Model Support: GPT, Claude, Gemini, Llama integration
- Self-Healing: Automatic error recovery and reconnection
- Async/Await: Native Rust async support with Tokio/async-std
- HEL Rule Engine: Advanced rule-based coordination logic
- Type Safety: Full Rust type system integration
- Memory Safety: Zero memory leaks with Rust’s ownership system
- Production Ready: Enterprise-grade reliability and performance
§Quick Start
use odin_protocol::{OdinProtocol, OdinConfig, MessagePriority, Result};
#[tokio::main]
async fn main() -> Result<()> {
let config = OdinConfig::builder()
.node_id("my-ai-agent")
.network_endpoint("ws://localhost:8080")
.max_connections(100)
.build()?;
let mut odin = OdinProtocol::new(config)?;
odin.start().await?;
// Send a message to another AI
let message_id = odin.send_message(
"target-ai-agent",
"Hello from Rust ODIN!",
MessagePriority::Normal
).await?;
println!("Message sent: {}", message_id);
Ok(())
}
§HEL Rule Engine Example
use odin_protocol::{HELRuleEngine, Rule, Condition, Action, LogLevel, Result};
#[tokio::main]
async fn main() -> Result<()> {
let engine = HELRuleEngine::new();
let rule = Rule::new(
"auto-reply".to_string(),
"Auto Reply Rule".to_string(),
"Automatically reply to greetings".to_string(),
)
.add_condition(Condition::ContentContains("hello".to_string()))
.add_action(Action::Log {
level: LogLevel::Info,
message: "Greeting received!".to_string(),
});
engine.add_rule(rule).await?;
Ok(())
}
Re-exports§
pub use config::OdinConfig;
pub use config::OdinConfigBuilder;
pub use protocol::OdinProtocol;
pub use protocol::NodeStatus;
pub use protocol::ConnectionEvent;
pub use protocol::ProtocolHandler;
pub use hel::HELRuleEngine;
pub use hel::Rule;
pub use hel::Condition;
pub use hel::Action;
pub use hel::LogLevel;
pub use hel::RuleStats;
pub use message::OdinMessage;
pub use message::MessageType;
pub use message::MessagePriority;
pub use message::MessageBatch;
pub use message::MessageFilter;
pub use error::OdinError;
pub use error::ErrorCategory;
pub use error::Result;
pub use metrics::MetricsCollector;
pub use metrics::PerformanceStats;
pub use metrics::PerformanceSample;
pub use metrics::MetricsExporter;
Modules§
- config
- Configuration types and builders for ODIN Protocol
- defaults
- Default constants for ODIN Protocol
- error
- Error types for ODIN Protocol
- hel
- HEL (High-level Exchange Language) Rule Engine for AI coordination
- message
- Message types and utilities for ODIN Protocol
- metrics
- Performance metrics collection and monitoring
- protocol
- Core protocol types and implementations for ODIN Protocol
Constants§
- PROTOCOL_
VERSION - Protocol version for compatibility checking
- VERSION
- Current version of the ODIN Protocol crate