Skip to main content

klieo_core/
lib.rs

1#![deny(missing_docs)]
2#![deny(rust_2018_idioms)]
3#![deny(rustdoc::broken_intra_doc_links)]
4
5//! Core traits and runtime for the klieo agent framework.
6//!
7//! See the spec at
8//! `docs/superpowers/specs/2026-05-04-agent-framework-foundation-design.md`.
9
10pub mod agent;
11pub mod bus;
12pub mod cancel;
13pub mod checkpoint;
14pub mod error;
15pub mod guardrail;
16pub mod ids;
17pub mod leader;
18pub mod llm;
19pub mod memory;
20pub mod observability;
21pub mod profile;
22pub mod rate_limit;
23pub mod reaper;
24pub mod redact;
25pub mod response;
26pub mod resume;
27pub mod runtime;
28pub mod server_outbound;
29pub mod summarize;
30pub mod tenants;
31pub mod tool;
32
33pub use agent::{
34    Agent, AgentContext, AgentContextBuilder, AgentContextBuilderError, AgentEvent, SimpleAgent,
35};
36#[cfg(feature = "otel")]
37pub use bus::{extract_traceparent, inject_traceparent};
38pub use bus::{
39    validate_subject_token, AckHandle, AckHandleImpl, BusHandles, ClaimHandle, ClaimHandleImpl,
40    ClaimedJob, Headers, Job, JobQueue, KeyPage, KvEntry, KvStore, Lease, LeaseImpl, Msg,
41    MsgStream, Pubsub, RequestReply, Revision,
42};
43pub use cancel::CancelRegistry;
44pub use error::{BusError, ConfigError, Error, LlmError, MemoryError, ToolError};
45pub use guardrail::{
46    Guardrail, GuardrailOutcome, MaxResponseLengthGuardrail, RefusalKeywordGuardrail,
47};
48pub use ids::{DurableName, FactId, JobId, RunId, ThreadId};
49pub use leader::{LeaderEntry, LeaderHandle, LeaderRegistry, FAILOVER_ATTEMPT_CAP};
50pub use llm::{
51    Capabilities, CapabilitiesBuilder, ChatChunk, ChatRequest, ChatResponse, ChunkStream,
52    Embedding, FinishReason, LlmClient, Message, ResponseFormat, Role, ToolCall, ToolDef, Usage,
53};
54pub use memory::{
55    Episode, EpisodicMemory, Fact, LongTermMemory, MemoryHandles, RunFilter, RunSummary, Scope,
56    ShortTermMemory, ToolResult,
57};
58pub use observability::principal_hash;
59pub use profile::{DeploymentProfile, ProfileViolation};
60pub use reaper::{spawn_kv_reaper, KvReaperHandle};
61pub use redact::{opaque_digest, AuditRedactor};
62pub use response::{parse_structured, KlieoResponse};
63pub use runtime::{
64    gc_checkpoints, resume_from_checkpoint, run_steps, run_steps_streaming, spawn_checkpoint_gc,
65    ApprovalDecision, CheckpointGcHandle, NeverReview, ReviewPolicy, RunCheckpoint, RunOptions,
66    CHECKPOINT_BUCKET,
67};
68pub use server_outbound::{ServerOutbound, ServerOutboundError};
69pub use summarize::{summarize_history, SummarizeOptions};
70pub use tenants::{
71    OwnershipCheck, OwnershipClaim, OwnershipHandle, OwnershipRecord, OwnershipRegistry,
72};
73pub use tool::{Tool, ToolCtx, ToolInvoker};
74
75#[cfg(any(test, feature = "test-utils"))]
76pub mod test_utils;
77
78/// Re-exports used exclusively by the `klieo-macros` proc-macro
79/// expansions (W3.A18). Macro-generated code targets
80/// `::klieo_core::__macro_support::...` rather than per-module paths
81/// such as `::klieo_core::tool::Tool` so an upstream rename of a
82/// submodule does not break downstream `#[tool]` invocations.
83///
84/// Not part of the public API. Items here may be renamed or removed
85/// without a semver bump as long as the corresponding klieo-macros
86/// version moves in lockstep.
87#[doc(hidden)]
88pub mod __macro_support {
89    pub use crate::error::ToolError;
90    pub use crate::response::{parse_structured, KlieoResponse};
91    pub use crate::tool::{Tool, ToolCtx};
92}