# klieo-core
Core traits + runtime for the klieo agent framework.
Part of the [klieo](https://crates.io/crates/klieo) Rust agent framework.
## What it is
`klieo-core` defines the trait surface that all klieo crates program against.
Implement these traits once; swap implementations without touching agent code.
## Trait surface
| `Agent` | Runnable agent with typed input/output |
| `SimpleAgent` | Built-in single-LLM agent implementation |
| `Tool` / `ToolInvoker` | Callable tool + dispatcher |
| `LlmClient` | LLM completion provider |
| `ShortTermMemory` | Ephemeral key-value memory |
| `LongTermMemory` | Persistent / vector memory |
| `EpisodicMemory` | Append-only episode log |
| `Pubsub` | Publish/subscribe bus |
| `RequestReply` | RPC over bus |
| `KvStore` | Distributed key-value store |
| `JobQueue` | Durable work queue |
| `ServerOutbound` | Server-initiated outbound requests (MCP/A2A) |
## Usage
`klieo-core` is the dependency boundary. Your agent code depends on it;
concrete implementations live in crates like `klieo-llm-ollama`,
`klieo-bus-nats`, etc. The umbrella crate `klieo` re-exports everything.
```toml
[dependencies]
klieo-core = "0.38"
```
```rust
use klieo_core::tool::{Tool, ToolCtx};
use klieo_core::error::ToolError;
use async_trait::async_trait;
struct MyTool;
#[async_trait]
impl Tool for MyTool {
fn name(&self) -> &str { "my_tool" }
fn description(&self) -> &str { "Does something useful." }
fn json_schema(&self) -> &serde_json::Value {
static SCHEMA: std::sync::OnceLock<serde_json::Value> = std::sync::OnceLock::new();
SCHEMA.get_or_init(|| serde_json::json!({}))
}
async fn invoke(
&self,
_args: serde_json::Value,
_ctx: ToolCtx,
) -> Result<serde_json::Value, ToolError> {
Ok(serde_json::json!({ "result": "ok" }))
}
}
```
Or use the `#[tool]` macro from `klieo-macros` for less boilerplate.
## Status
`0.38.x` — pre-1.0; patch releases are backward-compatible.
See [`docs/SEMVER.md`](https://github.com/mohrimic/klieo/blob/main/docs/SEMVER.md).
## License
MIT — see [`LICENSE`](https://github.com/mohrimic/klieo/blob/main/LICENSE).