evo-common
Shared types, protocols, and utilities for the Evo self-evolution agent system.
This is a Rust library crate consumed by every component in the Evo system. It defines the Socket.IO message protocol, configuration structs, skill manifest types, and structured logging initialization.
Part of the Evo System
| Repository | Role |
|---|---|
| evo-common (this) | Shared types, protocol definitions, config structs, logging |
| evo-gateway | API aggregator (port 8080) unifying OpenAI, Anthropic, and local LLMs |
| evo-king | Central orchestrator with Socket.IO server (port 3000), config lifecycle, Turso DB |
| evo-agents | Runner binary (kernel agents in separate repos) |
Architecture
+------------------+
| evo-gateway |
| port 8080 |
| OpenAI |
| Anthropic |
| Local LLMs |
+--------+---------+
|
| HTTP
v
+------------------+ Socket.IO (port 3000) +------------------+
| evo-agents | <-------------------------> | evo-king |
| | | |
| runner binary | agent:register | orchestrator |
| kernel agents | agent:status | Socket.IO srv |
| user agents | agent:skill_report | config mgmt |
| | agent:health | Turso local DB |
| roles: | king:command -----> | |
| - learning | king:config_update ----> | |
| - building | pipeline:next <----> | |
| - pre_load | | |
| - evaluation | | |
| - skill_manage | | |
+------------------+ +------------------+
All components depend on evo-common for shared types.
Evolution pipeline (continuous cycle):
Learning --> Building --> Pre-load --> Evaluation --> Skill Manage
^ |
+-------------------------------------------------------+
Communication between evo-king (server, using socketioxide) and evo-agents runners (clients, using rust_socketio) uses the Socket.IO event types defined in this crate.
Modules
messages - Socket.IO Event Types
All communication between king and runners is typed through structs and enums in this module.
Message Structs
// Runner announces itself to king on connect
// Periodic heartbeat from runner to king
// Runner reports result of a skill execution
// Runner reports API health check results
// King sends a command to a specific agent
// King notifies runners of a config change
// Advances the evolution pipeline to the next stage
// Individual health check result within AgentHealth
Note: Runners may include additional fields in the registration payload beyond the struct definition. For example, the skills field (a JSON array of skill names) is passed as untyped JSON alongside the typed AgentRegister fields. King extracts and persists these extra fields when handling agent:register events.
Enums
// Agent reports completion of a pipeline stage back to king
Event Name Constants
The messages::events submodule provides string constants for all Socket.IO event names:
config - Shared Configuration Structs
Parsed from TOML files by evo-gateway and evo-agents.
GatewayConfig provides from_toml(&str) and to_toml() methods. AgentConfig provides from_toml(&str).
skill - Skill Manifest Types
Describes a skill's interface and runtime configuration. Loaded from TOML files by evo-agents.
SkillManifest and SkillConfig each provide from_toml(&str).
logging - Structured Logging
Initializes tracing with dual output: JSON to a daily rolling log file and human-readable to stdout.
// Returns the log directory path.
// Source: EVO_LOG_DIR env var, default: ./logs
Log files are written to {log_dir}/{component}.YYYY-MM-DD.log in JSON format. Stdout output is plain text. The log level is controlled by the RUST_LOG environment variable (default: info).
Socket.IO Protocol
| Event | Direction | Payload Type |
|---|---|---|
agent:register |
runner -> king | AgentRegister |
agent:status |
runner -> king | AgentStatus |
agent:skill_report |
runner -> king | AgentSkillReport |
agent:health |
runner -> king | AgentHealth |
king:command |
king -> runner | KingCommand |
king:config_update |
king -> runner | KingConfigUpdate |
pipeline:next |
king <-> runner | PipelineNext |
pipeline:stage_result |
runner -> king | PipelineStageResult |
All payloads are JSON-serialized using serde_json. Enum variants use snake_case serialization by default; HttpMethod uses UPPERCASE.
Configuration Format Examples
Gateway Configuration (gateway.toml)
[]
= "0.0.0.0"
= 8080
[[]]
= "openai"
= "https://api.openai.com/v1"
= "OPENAI_API_KEY"
= true
[[]]
= "anthropic"
= "https://api.anthropic.com/v1"
= "ANTHROPIC_API_KEY"
= true
[[]]
= "ollama"
= "http://localhost:11434/v1"
= "OLLAMA_API_KEY"
= true
[]
= 60
= 10
Agent Configuration (agent.toml)
= "learning"
= ["web-search", "summarize"]
= "http://localhost:3000"
Skill Manifest (manifest.toml)
= "web-search"
= "0.1.0"
= "Search the web for information"
= ["search", "summarize"]
= false
= []
[[]]
= "query"
= "string"
= true
= "Search query string"
[[]]
= "results"
= "array"
= true
= "List of search result objects"
Skill Config (config.toml)
= "SEARCH_API_KEY"
[[]]
= "search"
= "https://api.search.com/v1/search"
= "GET"
[]
= "application/json"
Usage
Add evo-common as a dependency in Cargo.toml:
[]
= "0.2"
Logging initialization
use logging;
Sending a registration message
use ;
use serde_json;
let msg = AgentRegister ;
let payload = to_string?;
socket.emit.await?;
Loading a gateway config
use GatewayConfig;
use fs;
let content = read_to_string?;
let config = from_toml?;
println!;
Parsing a skill manifest
use SkillManifest;
use fs;
let content = read_to_string?;
let manifest = from_toml?;
println!;
Build and Test
# Build the library
# Run all unit tests
# Run tests with output visible
# Check without building
Dependencies
| Crate | Version | Purpose |
|---|---|---|
serde |
1.0 | Serialization/deserialization framework |
serde_json |
1.0 | JSON encoding for Socket.IO payloads |
toml |
0.8 | TOML config file parsing |
chrono |
0.4 | Timestamps with serde support |
tracing |
0.1 | Structured logging macros |
tracing-subscriber |
0.3 | Tracing output (JSON + stdout, env-filter) |
tracing-appender |
0.2 | Non-blocking rolling file appender |
License
MIT