Skip to main content

Crate leviath_runtime

Crate leviath_runtime 

Source
Expand description

§Leviath Runtime

ECS-based agent execution engine using bevy_ecs.

The runtime manages agent lifecycle, context window management, task scheduling, and inference execution through a game-loop-inspired architecture where agents are entities and their behaviors are systems.

Re-exports§

pub use components::AgentState;
pub use components::AgentStatus;
pub use components::ContextWindow;
pub use components::ParentRef;
pub use components::SubAgentChildren;
pub use fanout::FanOutSpawner;
pub use fanout::FanOutSpawnerRes;
pub use inference_pool::InferencePoolConfig;
pub use inference_pool::InferencePools;
pub use provider_creds::ProviderCreds;
pub use provider_creds::build_provider_registry;
pub use taint::TaintGate;
pub use tool_bridge::BoxedToolExec;

Modules§

components
ECS components for agent state and execution.
context_setup
Context-window setup helpers shared by the ECS pipeline’s spawner and stage-entry.
control_socket
The local control transport: newline-delimited JSON ControlRequest/ControlResponse frames between clients (the TUI/CLI) and the world host, over a platform-native local socket.
custom_region
Runtime side of script-backed custom regions (RegionKind::Custom).
dynamic_interaction
Agent-initiated dynamic interaction tools: present_for_review, ask_user_text, ask_user_choice, ask_user_confirm, edit_document.
fanout
Fan-out stage handling as ECS systems.
host
The world host: the daemon-side wrapper that owns a single PipelineWorld, maps stable run ids to ECS entities, and interleaves external control operations with driving the world - all on one task, so there is never any locking around the world.
inference_pool
Per-model inference concurrency pools.
interaction_hub
In-memory interaction hub - the shared-world replacement for the imperative worker’s pending.json/response.json file polling.
interaction_points
Declarative stage-boundary interaction points (StageMode::InteractivePoints).
persistence
Agent-state persistence: turning a live ECS agent into the on-disk snapshot the dashboard/API read (meta.json + context.json under the run directory).
pipeline
The ECS pipeline (Phase 2): components + systems that drive every agent through check-input → infer → tools → apply → repeat, entirely as data.
provider_creds
Decoupled provider credentials + registry construction.
restore
Restart recovery: bring a freshly-spawned agent back to its persisted running state so the daemon resumes it where it stopped.
script_provider
Lazy, hot-reloading resolution of Rhai script providers.
taint
Taint gate checking for tool execution.
telemetry
Observability as an ECS system: watch the components every other system already writes and narrate them into the installed TelemetrySink.
title
One-shot run-title generation.
tool_bridge
The async worker side of the ECS tool stage - the sync-ECS ↔ async-I/O bridge for tool execution.
world
The pipeline driver: a single PipelineWorld that hosts every agent as ECS data and ticks the crate::pipeline systems over all of them - the traditional-game-loop core of the shared world.

Structs§

ProviderRegistry
Registry of inference providers, keyed by provider name (e.g. "anthropic").
RetryPolicy
How a transient inference failure is retried before the agent is failed.