# Ceylon Runtime
A Rust-based agent mesh framework for building local and distributed AI agent systems.
[](https://crates.io/crates/ceylon-runtime)
[](https://docs.rs/ceylon-runtime)
[](https://opensource.org/licenses/MIT)
## Features
- **Agent Framework**: Build autonomous AI agents with a simple trait-based API
- **Local Mesh**: Connect multiple agents in a local mesh for inter-agent communication
- **LLM Integration**: Built-in support for various LLM providers (OpenAI, Ollama, Vertex AI, etc.)
- **Memory Backends**: Pluggable memory systems with in-memory, SQLite, and Redis support
- **Async-first**: Built on Tokio for high-performance async operations
- **Logging & Metrics**: Structured logging and metrics collection built-in
## Installation
Add to your `Cargo.toml`:
```toml
[dependencies]
ceylon-runtime = "0.1"
```
### Feature Flags
- `sqlite` - Enable SQLite memory backend
- `redis` - Enable Redis memory backend
- `full` - Enable all optional backends
```toml
[dependencies]
ceylon-runtime = { version = "0.1", features = ["sqlite", "redis"] }
```
## Quick Start
```rust
use ceylon_runtime::{Agent, AgentContext, LocalMesh, Message};
use async_trait::async_trait;
struct MyAgent {
name: String,
}
#[async_trait]
impl Agent for MyAgent {
fn name(&self) -> String {
self.name.clone()
}
async fn on_message(&mut self, msg: Message, ctx: &mut AgentContext) -> ceylon_runtime::core::error::Result<()> {
println!("Received: {:?}", msg);
Ok(())
}
}
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let agent = MyAgent { name: "my-agent".to_string() };
let mut mesh = LocalMesh::new("my-mesh");
mesh.add_agent(Box::new(agent));
mesh.start().await?;
Ok(())
}
```
## Using LLM Agents
```rust
use ceylon_runtime::{LlmAgent, LLMConfig, InMemoryBackend};
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let config = LLMConfig::ollama("llama3.2", None);
let memory = InMemoryBackend::new();
let agent = LlmAgent::new(
"assistant",
"You are a helpful assistant",
config,
memory,
);
// Add to mesh and use...
Ok(())
}
```
## Core Components
| `Agent` | Trait for defining agent behavior |
| `LocalMesh` | Local multi-agent coordination |
| `LlmAgent` | Pre-built agent with LLM capabilities |
| `Memory` | Trait for memory backends |
| `InMemoryBackend` | In-memory storage (default) |
| `SqliteBackend` | SQLite persistent storage (feature: `sqlite`) |
| `RedisBackend` | Redis distributed storage (feature: `redis`) |
## Documentation
- [API Documentation](https://docs.rs/ceylon-runtime)
- [GitHub Repository](https://github.com/ceylonai/ceylon)
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
## Contributing
Contributions are welcome! Please feel free to submit a Pull Request.