| Crates.io | zoey-core |
| lib.rs | zoey-core |
| version | 0.1.1 |
| created_at | 2026-01-07 22:08:31.361587+00 |
| updated_at | 2026-01-09 23:58:36.86243+00 |
| description | ZoeyAI core runtime and types β privacy-first AI agent framework optimized for local models |
| homepage | https://github.com/Agent-Zoey/Zoey |
| repository | https://github.com/Agent-Zoey/Zoey |
| max_upload_size | |
| id | 2029103 |
| size | 1,426,670 |
Always watching over your code
Your secrets are safe with Zoey
The foundational crate powering ZoeyOSβproviding the runtime, plugin system, type definitions, and agent API. Built for privacy-first AI agents optimized for local model deployment.
Add to your Cargo.toml:
[dependencies]
zoey-core = "0.1"
use zoey_core::{AgentRuntime, RuntimeOpts};
#[tokio::main]
async fn main() -> zoey_core::Result<()> {
// Create runtime with default options
let opts = RuntimeOpts::default();
let runtime = AgentRuntime::new(opts).await?;
// Zoey is ready to serve
println!("π Zoey runtime initialized");
Ok(())
}
use zoey_core::{AgentRuntime, RuntimeOpts};
use std::sync::Arc;
let mut opts = RuntimeOpts::default();
// Add plugins
opts.add_plugin(Arc::new(BootstrapPlugin::new()));
opts.add_plugin(Arc::new(KnowledgePlugin::new()));
opts.add_plugin(Arc::new(CompliancePlugin::new()));
let runtime = AgentRuntime::new(opts).await?;
zoey-core
βββ runtime/ # Agent runtime and lifecycle
β βββ mod.rs # AgentRuntime implementation
β βββ opts.rs # RuntimeOpts configuration
β βββ services.rs # Service orchestration
βββ plugin/ # Plugin system
β βββ mod.rs # Plugin trait and registry
β βββ loader.rs # Dynamic plugin loading
β βββ context.rs # Plugin execution context
βββ agent_api/ # HTTP/WebSocket API
β βββ handlers.rs # Request handlers
β βββ routes.rs # Route definitions
β βββ auth.rs # Authentication
βββ types/ # Core type definitions
β βββ memory.rs # Memory structures
β βββ message.rs # Message models
β βββ agent.rs # Agent configuration
βββ lib.rs # Public API exports
#[async_trait]
pub trait Plugin: Send + Sync {
fn name(&self) -> &str;
fn description(&self) -> &str;
async fn init(&self, runtime: &AgentRuntime) -> Result<()>;
fn actions(&self) -> Vec<Arc<dyn Action>>;
fn providers(&self) -> Vec<Arc<dyn Provider>>;
fn evaluators(&self) -> Vec<Arc<dyn Evaluator>>;
}
#[async_trait]
pub trait Action: Send + Sync {
fn name(&self) -> &str;
fn description(&self) -> &str;
fn examples(&self) -> Vec<Example>;
async fn validate(&self, input: &ActionInput) -> Result<bool>;
async fn execute(&self, ctx: ActionContext) -> Result<ActionOutput>;
}
#[async_trait]
pub trait Provider: Send + Sync {
fn name(&self) -> &str;
async fn get(&self, ctx: &ProviderContext) -> Result<ProviderOutput>;
}
# Runtime configuration
ZOEY_LOG_LEVEL=info
ZOEY_MAX_WORKERS=4
ZOEY_PLUGIN_DIR=./plugins
# API configuration
ZOEY_API_HOST=127.0.0.1
ZOEY_API_PORT=3000
ZOEY_API_CORS_ORIGINS=http://localhost:3000
# Storage configuration
ZOEY_DATA_DIR=./.zoey/db
ZOEY_DB_PATH=./.zoey/db/zoey.db
let opts = RuntimeOpts {
log_level: LogLevel::Info,
max_workers: 4,
plugin_dir: PathBuf::from("./plugins"),
api_host: "127.0.0.1".to_string(),
api_port: 3000,
..Default::default()
};
zoey-core defines the IDatabaseAdapter trait. Choose your storage backend:
| Crate | Backend | Best For |
|---|---|---|
zoey-storage-sql |
SQLite, PostgreSQL | Most deployments |
zoey-storage-mongo |
MongoDB | Document-based storage |
zoey-storage-supabase |
Supabase | Serverless PostgreSQL |
zoey-storage-vector |
Local | Dedicated vector search |
[dependencies]
zoey-core = "0.1"
zoey-storage-sql = "0.1" # Pick your backend
use zoey_core::{AgentRuntime, RuntimeOpts, IDatabaseAdapter};
use zoey_storage_sql::SqliteAdapter;
use std::sync::Arc;
let mut adapter = SqliteAdapter::new(":memory:");
adapter.init().await?;
let opts = RuntimeOpts::default()
.with_adapter(Arc::new(adapter));
| Crate | Description |
|---|---|
zoey-provider-openai |
OpenAI GPT models |
zoey-provider-anthropic |
Claude models |
zoey-provider-local |
Ollama, llama.cpp (no API key!) |
zoey-provider-voice |
TTS/STT capabilities |
| Crate | Description |
|---|---|
zoey-plugin-bootstrap |
Essential actions and providers |
zoey-plugin-memory |
Conversation memory |
zoey-plugin-knowledge |
Document ingestion and RAG |
zoey-plugin-search |
Web search integration |
| Crate | Description |
|---|---|
zoey-adaptor-discord |
Discord bot |
zoey-adaptor-telegram |
Telegram bot |
zoey-adaptor-web |
Web UI |
zoey-adaptor-terminal |
CLI interface |
This crate has minimal external dependencies:
tokio - Async runtimeaxum - HTTP frameworksqlx - Database accessserde - Serializationtracing - Logging and diagnostics# Run unit tests
cargo test -p zoey-core
# Run with logging
RUST_LOG=debug cargo test -p zoey-core -- --nocapture
# Run specific test
cargo test -p zoey-core test_runtime_init
MIT License - See LICENSE for details.
π Your secrets are safe with Zoey