Skip to main content

Crate leviath_core

Crate leviath_core 

Source
Expand description

§Leviath Core

Core types and traits for the Leviath agent framework.

This crate provides the foundational types for building agents with structured, hardware-inspired context window management. It includes:

  • Regions: Typed memory regions with different lifecycle policies
  • Layouts: Complete memory maps defining how context is structured
  • Blueprints: Agent definitions including stages, models, and tools
  • Lifecycle: Policies for eviction, compaction, and context management

Re-exports§

pub use blueprint::Blueprint;
pub use blueprint::ContextTransform;
pub use blueprint::EdgeTransform;
pub use blueprint::FileTrackingConfig;
pub use blueprint::NudgeConfig;
pub use blueprint::ReadPathsConfig;
pub use blueprint::RepetitionDetectionConfig;
pub use blueprint::ResolvedNudge;
pub use blueprint::Stage;
pub use blueprint::StuckConfig;
pub use blueprint::ToolResultRouting;
pub use blueprint::TransitionCondition;
pub use blueprint::TransitionEdge;
pub use blueprint::resolve_nudge;
pub use cache::CacheHint;
pub use context_cause::ContextCause;
pub use credentials::CredentialStore;
pub use credentials::CredentialStoreKind;
pub use credentials::MemoryStore;
pub use credentials::mcp_account;
pub use credentials::provider_account;
pub use error::Error;
pub use error::Result;
pub use error::ValidationError;
pub use layout::BudgetSpec;
pub use layout::ContextLayout;
pub use layout::RegionDefinition;
pub use lifecycle::CompactionConfig;
pub use output::FINAL_OUTPUT_FILE;
pub use output::FinalOutput;
pub use output::FinalOutputDescriptor;
pub use output::MAX_FINAL_OUTPUT_BYTES;
pub use output::OutputSpec;
pub use output::describe_spec;
pub use output::resolve_output_spec;
pub use panic_payload::panic_message;
pub use paths::agents_dir;
pub use paths::canonicalize_for_match;
pub use paths::data_dir;
pub use paths::home_dir;
pub use paths::is_safe_path_component;
pub use paths::providers_dir;
pub use paths::resolves_within;
pub use paths::tools_dir;
pub use policy::AllowlistRule;
pub use policy::McpToolOverride;
pub use policy::PolicyConfig;
pub use read_paths::ReadPathDecision;
pub use read_paths::ReadPathEntry;
pub use read_paths::ReadPathPolicy;
pub use read_paths::ReadPathSet;
pub use read_paths::validate_entry_syntax;
pub use region::ContentFormat;
pub use region::EntryKind;
pub use region::EvictionStrategy;
pub use region::Region;
pub use region::RegionEntry;
pub use region::RegionKind;
pub use region::RegionSchema;
pub use region::SerializedToolCall;
pub use region::Volatility;
pub use sandbox::OnUnavailable;
pub use sandbox::SandboxKind;
pub use sandbox::ToolSandboxConfig;
pub use sandbox::resolve_sandbox;
pub use secrets::ShellEnvMode;
pub use secrets::child_env_allowed;
pub use secrets::constant_time_eq;
pub use secrets::dotenv_var_allowed;
pub use secrets::is_secret_header;
pub use secrets::is_sensitive_env_name;
pub use secrets::redact;
pub use secrets::script_env_allowed;
pub use secrets::withheld_child_vars;
pub use taint::GateDecision;
pub use taint::GateDecisionSource;
pub use taint::GateEvent;
pub use taint::RegionTaint;
pub use taint::SecurityConfig;
pub use taint::TaintLevel;
pub use taint::ToolClassification;
pub use taint::ToolDirection;
pub use text::estimate_tokens;
pub use text::floor_char_boundary;
pub use text::truncate_at_boundary;
pub use text::truncate_chars;

Modules§

blueprint
Agent blueprints and stage definitions.
cache
Cache hint types for prompt caching across providers.
config
Plain configuration value types shared across crates.
context_cause
Why a context window changed.
credentials
Where Leviath’s long-lived secrets live.
duration
How Leviath writes a span of seconds, in the two shapes its surfaces need.
error
Error types for Leviath Core.
execution
Execution identity: what a run did, told apart from what it was asked to do.
files
The names of the files a run directory and an agent directory hold.
interaction
Plain value types for the worker ↔ dashboard interaction channel.
layout
Context window layouts and memory maps.
lifecycle
LLM compaction configuration for regions that summarize on overflow.
manifest
Manifest parsing for agent.leviath files.
mcp_names
The one place that decides what an MCP tool is called.
mime
Typed content: mime types, parts, and where their bytes live.
output
An agent’s final output: the one value a run hands back to whoever asked.
panic_payload
Rendering a caught panic payload as a human-readable message.
paths
Path containment, and the one definition of where Leviath’s data lives.
policy
Policy rules for taint tracking allowlists.
read_paths
The [read_paths] allowlist: how an agent is granted read access outside its workdir, and how each access is checked.
region
Memory region types and validation schemas.
run_archive
A portable, self-contained record of an entire agent run.
run_meta
Plain, serializable run-state data types.
sandbox
Sandboxed tool-execution configuration.
secrets
Which environment variables agent-supplied code may see.
sync
Taking a lock without a panic path.
taint
Context taint tracking types for security gating.
telemetry
The telemetry seam: pure-data lifecycle events and the sink they flow into.
text
Cutting a &str at a byte offset without splitting a character.
write_limits
Deciding whether an agent may write, and how much.

Functions§

default_true
Serde default for a flag that is on unless a file turns it off.