Expand description
Kernel - The Execution Engine
The kernel is the heart of enact-core. It:
- Defines the execution state machine
- Applies all state transitions through a reducer
- Provides the ExecutionKernel for running graphs
- Enables replay from event logs
§Architecture
┌─────────────────────────────────────────────┐
│ ExecutionKernel │
│ ┌───────────────────────────────────────┐ │
│ │ Execution State │ │
│ │ (ExecutionState, Steps, Artifacts) │ │
│ └───────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌───────────────────────────────────────┐ │
│ │ Reducer │ │
│ │ (Action, State) → State │ │
│ └───────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌───────────────────────────────────────┐ │
│ │ Event Emitter │ │
│ │ (StreamEvent for UI/persistence) │ │
│ └───────────────────────────────────────┘ │
└─────────────────────────────────────────────┘§Key Invariants
- Single Source of Truth: ExecutionKernel owns the Execution state
- Reducer-Only Transitions: All state changes go through the reducer
- Deterministic: Same actions → same state (enables replay)
- Observable: All transitions emit events
@see docs/TECHNICAL/01-EXECUTION-TELEMETRY.md
Re-exports§
pub use ids::prefixes;pub use ids::ArtifactId;pub use ids::CallableType;pub use ids::CancellationPolicy;pub use ids::ExecutionId;pub use ids::GraphId;pub use ids::MessageId;pub use ids::NodeId;pub use ids::ParentLink;pub use ids::ParentType;pub use ids::RunId;pub use ids::SpawnMode;pub use ids::StepId;pub use ids::StepSource;pub use ids::StepSourceType;pub use ids::StepType;pub use ids::TenantId;pub use ids::ThreadId;pub use ids::UserId;pub use persistence::CollectionInfo;pub use persistence::CostInfo;pub use persistence::DistanceMetric;pub use persistence::EventStore;pub use persistence::ExecutionEventData;pub use persistence::ExecutionSnapshot;pub use persistence::ExecutionStats;pub use persistence::FinishReason;pub use persistence::InMemoryMessageStore;pub use persistence::Message;pub use persistence::MessageMetadata;pub use persistence::MessagePart;pub use persistence::MessageRole;pub use persistence::MessageStore;pub use persistence::StateStore;pub use persistence::StateStoreJsonExt;pub use persistence::StorageBackend;pub use persistence::StoredEvent;pub use persistence::Thread;pub use persistence::TokenUsage;pub use persistence::VectorDocument;pub use persistence::VectorFilter;pub use persistence::VectorSearchResult;pub use persistence::VectorStore;pub use cost::CostCalculator;pub use cost::ModelPricing;pub use cost::TokenUsage as LlmTokenUsage;pub use cost::UsageAccumulator;
Modules§
- artifact
- Artifact Lifecycle - First-class kernel entities
- cost
- Token Usage and Cost Calculation
- ids
- Execution & Telemetry IDs - Graph-centric observability identifiers
- persistence
- Persistence Layer - Storage Abstractions
Structs§
- Control
Event - ControlEvent - Governance event for control signals
- Decision
Alternative - DecisionAlternative - An alternative option that was not chosen
- Decision
Input - DecisionInput - Inputs that informed the decision
- Decision
Record - DecisionRecord - Audit trail for decisions made during execution
- Enforcement
Middleware - Enforcement middleware for checking limits before operations
- Enforcement
Policy - Configuration for enforcement behavior
- Enforcement
Violation - Details of an enforcement violation
- Enforcement
Warning - Warning about approaching limits
- Event
- Event - execution event with run/node context
- Event
Log - Event log for replay
- Execution
- Execution - one run of a blueprint
- Execution
Context - ExecutionContext - Minimal context attached to every event
- Execution
Error - The primary error type for all execution failures
- Execution
Event - ExecutionEvent - Base event schema for all execution events
- Execution
Kernel - ExecutionKernel - the core execution engine
- Execution
Usage - Tracks resource usage for a single execution
- Interruptable
Runner - Interruptable execution handler
- Long
Running Execution Policy - Policy configuration for long-running agentic executions
- Model
Context - ModelContext - Model configuration used for decision
- Parallel
Result - Result of a parallel execution branch
- Retry
Policy - Deterministic retry behavior for an error
- Step
- Step - a distinct action within an execution
- Step
Timeout Guard - Guard for enforcing step timeouts
- Usage
Snapshot - Serializable snapshot of execution usage
Enums§
- Backoff
Strategy - How to space out retry attempts
- Control
Action - ControlAction - What control action was requested
- Control
Actor - ControlActor - Who/what initiated the control action
- Control
Outcome - ControlOutcome - What happened as a result of the control action
- Decision
Type - DecisionType - Types of decisions made during execution
- Enforcement
Result - Result of an enforcement check
- Execution
Action - Execution event - all possible events that can change execution state
- Execution
Error Category - High-level error categories for deterministic recovery
- Execution
Event Type - ExecutionEventType - All event types in the execution lifecycle
- Execution
State - Execution lifecycle state - explicit state machine
- Interrupt
Decision - User decision for an interrupt
- Interrupt
Reason - Interrupt reason
- LlmError
Code - Specific LLM provider error codes
- Reducer
Error - Reducer error
- Replay
Error - Replay error
- Step
State - Step lifecycle state
- Tool
Error Code - Specific tool error codes
- Violation
Type - Type of enforcement violation
- Wait
Reason - Reason for waiting state
Functions§
- reduce
- Apply an action to an execution, producing a new state
- replay
- Replay an execution from an action log
- run_
parallel - Run multiple callables in parallel