Skip to main content

Crate klieo_core

Crate klieo_core 

Source
Expand description

Core traits and runtime for the klieo agent framework.

See the spec at docs/superpowers/specs/2026-05-04-agent-framework-foundation-design.md.

Re-exports§

pub use agent::Agent;
pub use agent::AgentContext;
pub use agent::AgentContextBuilder;
pub use agent::AgentContextBuilderError;
pub use agent::AgentEvent;
pub use agent::SimpleAgent;
pub use bus::extract_traceparent;
pub use bus::inject_traceparent;
pub use bus::validate_subject_token;
pub use bus::AckHandle;
pub use bus::AckHandleImpl;
pub use bus::BusHandles;
pub use bus::ClaimHandle;
pub use bus::ClaimHandleImpl;
pub use bus::ClaimedJob;
pub use bus::Headers;
pub use bus::Job;
pub use bus::JobQueue;
pub use bus::KeyPage;
pub use bus::KvEntry;
pub use bus::KvStore;
pub use bus::Lease;
pub use bus::LeaseImpl;
pub use bus::Msg;
pub use bus::MsgStream;
pub use bus::Pubsub;
pub use bus::RequestReply;
pub use bus::Revision;
pub use cancel::CancelRegistry;
pub use error::BusError;
pub use error::ConfigError;
pub use error::Error;
pub use error::LlmError;
pub use error::MemoryError;
pub use error::ToolError;
pub use guardrail::Guardrail;
pub use guardrail::GuardrailOutcome;
pub use guardrail::MaxResponseLengthGuardrail;
pub use guardrail::RefusalKeywordGuardrail;
pub use ids::DurableName;
pub use ids::FactId;
pub use ids::JobId;
pub use ids::RunId;
pub use ids::ThreadId;
pub use leader::LeaderEntry;
pub use leader::LeaderHandle;
pub use leader::LeaderRegistry;
pub use leader::FAILOVER_ATTEMPT_CAP;
pub use llm::Capabilities;
pub use llm::CapabilitiesBuilder;
pub use llm::ChatChunk;
pub use llm::ChatRequest;
pub use llm::ChatResponse;
pub use llm::ChunkStream;
pub use llm::Embedding;
pub use llm::FinishReason;
pub use llm::LlmClient;
pub use llm::Message;
pub use llm::ResponseFormat;
pub use llm::Role;
pub use llm::ToolCall;
pub use llm::ToolDef;
pub use llm::Usage;
pub use memory::Episode;
pub use memory::EpisodicMemory;
pub use memory::Fact;
pub use memory::LongTermMemory;
pub use memory::MemoryHandles;
pub use memory::RunFilter;
pub use memory::RunSummary;
pub use memory::Scope;
pub use memory::ShortTermMemory;
pub use memory::ToolResult;
pub use observability::principal_hash;
pub use profile::DeploymentProfile;
pub use profile::ProfileViolation;
pub use reaper::spawn_kv_reaper;
pub use reaper::KvReaperHandle;
pub use redact::opaque_digest;
pub use redact::AuditRedactor;
pub use response::parse_structured;
pub use response::KlieoResponse;
pub use runtime::gc_checkpoints;
pub use runtime::resume_from_checkpoint;
pub use runtime::run_steps;
pub use runtime::run_steps_streaming;
pub use runtime::spawn_checkpoint_gc;
pub use runtime::ApprovalDecision;
pub use runtime::CheckpointGcHandle;
pub use runtime::NeverReview;
pub use runtime::ReviewPolicy;
pub use runtime::RunCheckpoint;
pub use runtime::RunOptions;
pub use runtime::CHECKPOINT_BUCKET;
pub use server_outbound::ServerOutbound;
pub use server_outbound::ServerOutboundError;
pub use summarize::summarize_history;
pub use summarize::SummarizeOptions;
pub use tenants::OwnershipCheck;
pub use tenants::OwnershipClaim;
pub use tenants::OwnershipHandle;
pub use tenants::OwnershipRecord;
pub use tenants::OwnershipRegistry;
pub use tool::Tool;
pub use tool::ToolCtx;
pub use tool::ToolInvoker;

Modules§

agent
Agent trait and AgentContext.
bus
Inter-agent bus traits — Pubsub, RequestReply, KvStore, JobQueue.
cancel
Per-replica registry of in-flight cancellation tokens.
checkpoint
Durable continuation state for a suspended run (ADR-045).
error
Error types used across klieo-core.
guardrail
Pre/post-LLM validation hooks for refuse + handoff workflows.
ids
Strongly-typed IDs used throughout the framework.
leader
Per-replica leader claim + liveness probe for orphan detection.
llm
LLM client trait and request/response types.
memory
Memory traits — short-term, long-term, episodic.
observability
Cluster-0.23 observability primitives — PII-safe principal hashing + helpers for span attribute construction.
profile
Deployment posture profiles that bundle several fail-open guards into a single fail-closed opt-in. See ADR-022 (tenant binding).
rate_limit
Client-side token-bucket rate limiter for any LlmClient.
reaper
Background task that periodically evicts orphaned entries from cluster-0.20’s klieo-leaders and cluster-0.22’s klieo-tenants KV buckets.
redact
Audit-redaction port and the fail-closed opaque-digest fallback.
response
Typed structured-output trait + parser.
resume
Per-stream SSE event buffer used by HTTP/SSE transports for resumption via Last-Event-ID / klieo/tools/resume.
runtime
Runtime loop driving an crate::agent::Agent through LLM ↔ tool exchanges.
server_outbound
Server-initiated outbound JSON-RPC primitive — transport-agnostic.
summarize
Rolling LLM-summary checkpoint for bounding conversation context cost.
tenants
Per-stream ownership claim backed by a dedicated KV bucket.
test_utils
In-process fakes used in klieo-core’s own tests and exported under the test-utils feature for downstream crates.
tool
Tool trait, invoker, and tool context.