Skip to main content

Crate enact_core

Crate enact_core 

Source
Expand description

enact-core - The core runtime for graph-centric agent execution

This crate provides the foundational types and runtime for executing agent graphs with full observability and control.

§Architecture

┌─────────────────────────────────────────────────────────────────────┐
│                           enact-core                                │
├─────────────────────────────────────────────────────────────────────┤
│  kernel/       - ExecutionKernel, state machine, reducer, replay    │
│  flow/         - Sequential, parallel, conditional, loop primitives │
│  callable/     - Callable trait, LlmCallable, GraphCallable         │
│  policy/       - Execution, tool, tenant policies and guardrails    │
│  streaming/    - Events, event log, IDs, SSE streaming              │
│  graph/        - StateGraph, CompiledGraph, nodes, edges            │
│  telemetry/    - OpenTelemetry integration, spans, traces           │
│  providers/    - LLM adapters (Azure, Anthropic, Gemini)            │
│  tool/         - Tool trait and implementations                     │
│  memory/       - Episodic, semantic, working memory (future)        │
└─────────────────────────────────────────────────────────────────────┘

§Core Concepts

  • ExecutionId: One run of a blueprint (Agent/Graph/Workflow)
  • StepId: A distinct action within that execution
  • ArtifactId: Data produced by steps
  • RuntimeContext: The execution context spine
  • TenantContext: Multi-tenant isolation boundary (REQUIRED)

§Getting Started

Most users should start with:

use enact_core::prelude::*;

This imports the stable, user-facing API for defining agents, graphs, and executions. Internal modules remain accessible for advanced use cases.

@see docs/TECHNICAL/01-EXECUTION-TELEMETRY.md @see docs/TECHNICAL/02-ENACT-CORE-ARCHITECTURE.md

Re-exports§

pub use kernel::reduce;
pub use kernel::replay;
pub use kernel::EventLog as KernelEventLog;
pub use kernel::Execution;
pub use kernel::ExecutionAction;
pub use kernel::ExecutionKernel;
pub use kernel::ExecutionState;
pub use kernel::ReducerError;
pub use kernel::ReplayError;
pub use kernel::Step;
pub use kernel::StepState;
pub use kernel::WaitReason;
pub use kernel::BackoffStrategy;
pub use kernel::ExecutionError;
pub use kernel::ExecutionErrorCategory;
pub use kernel::LlmErrorCode;
pub use kernel::RetryPolicy;
pub use kernel::ToolErrorCode;
pub use kernel::EnforcementMiddleware;
pub use kernel::EnforcementPolicy;
pub use kernel::EnforcementResult;
pub use kernel::EnforcementViolation;
pub use kernel::EnforcementWarning;
pub use kernel::ExecutionUsage;
pub use kernel::StepTimeoutGuard;
pub use kernel::UsageSnapshot;
pub use kernel::ViolationType;
pub use kernel::artifact::ArtifactMetadata;
pub use kernel::artifact::ArtifactStore;
pub use kernel::artifact::ArtifactStoreError;
pub use kernel::artifact::ArtifactType;
pub use kernel::artifact::CompressionType;
pub use kernel::artifact::FilesystemArtifactStore;
pub use flow::Branch;
pub use flow::Condition;
pub use flow::ConditionalFlow;
pub use flow::FanIn;
pub use flow::FanOut;
pub use flow::LoopCondition;
pub use flow::LoopFlow;
pub use flow::ParallelFlow;
pub use flow::ParallelResult;
pub use flow::SequentialFlow;
pub use callable::Callable;
pub use callable::CallableDescriptor;
pub use callable::CallableInvocation;
pub use callable::CallableInvocationResult;
pub use callable::CallableInvoker;
pub use callable::CallableRegistry;
pub use callable::CostTier;
pub use callable::DiscoveryQuery;
pub use callable::DiscoveryResult;
pub use callable::DynCallable;
pub use callable::GraphCallable;
pub use callable::LlmCallable;
pub use callable::ResourceAllocation;
pub use callable::ResourceAllocationStrategy;
pub use callable::ResourceBudget;
pub use policy::ContentFilter;
pub use policy::ExecutionLimits;
pub use policy::ExecutionPolicy;
pub use policy::FeatureFlags;
pub use policy::FilterAction;
pub use policy::FilterResult;
pub use policy::InputProcessor;
pub use policy::InputProcessorPipeline;
pub use policy::InputProcessorResult;
pub use policy::PiiInputMode;
pub use policy::PiiInputProcessor;
pub use policy::PolicyAction;
pub use policy::PolicyContext;
pub use policy::PolicyDecision;
pub use policy::PolicyEvaluator;
pub use policy::TenantLimits;
pub use policy::TenantPolicy;
pub use policy::ToolPermissions;
pub use policy::ToolPolicy;
pub use policy::ToolTrustLevel;
pub use streaming::ControlAction;
pub use streaming::ControlActor;
pub use streaming::ControlEvent;
pub use streaming::ControlOutcome;
pub use streaming::DataDestination;
pub use streaming::DecisionRecord;
pub use streaming::DecisionType;
pub use streaming::Event;
pub use streaming::EventEmitter;
pub use streaming::EventLog;
pub use streaming::EventLogEntry;
pub use streaming::EventStore;
pub use streaming::EventStream;
pub use streaming::ExecutionContext;
pub use streaming::ExecutionEvent;
pub use streaming::ExecutionEventType;
pub use streaming::InMemoryEventStore;
pub use streaming::OutputProcessor;
pub use streaming::PiiProtectionProcessor;
pub use streaming::ProcessedEvent;
pub use streaming::ProcessorPipeline;
pub use streaming::ProtectedEventEmitter;
pub use streaming::ProtectionContext;
pub use streaming::StreamEvent;
pub use streaming::StreamMode;
pub use streaming::prefixes;
pub use streaming::ArtifactId;
pub use streaming::ExecutionId;
pub use streaming::GraphId;
pub use streaming::MessageId;
pub use streaming::NodeId;
pub use streaming::ParentType;
pub use streaming::RunId;
pub use streaming::StepId;
pub use streaming::StepType;
pub use streaming::TenantId;
pub use streaming::ThreadId;
pub use streaming::UserId;
pub use kernel::CostInfo;
pub use kernel::ExecutionStats;
pub use kernel::FinishReason;
pub use kernel::InMemoryMessageStore;
pub use kernel::Message;
pub use kernel::MessageMetadata;
pub use kernel::MessagePart;
pub use kernel::MessageRole;
pub use kernel::MessageStore;
pub use kernel::Thread;
pub use kernel::TokenUsage;
pub use context::InvocationContext;
pub use context::InvocationServices;
pub use context::ResourceLimits;
pub use context::RuntimeContext;
pub use context::RuntimeContextBuilder;
pub use context::SessionContext;
pub use context::TenantContext;
pub use context::TraceContext;
pub use graph::Checkpoint;
pub use graph::CheckpointStore;
pub use graph::CompiledGraph;
pub use graph::FunctionNode;
pub use graph::InMemoryCheckpointStore;
pub use graph::Node;
pub use graph::NodeState;
pub use graph::StateGraph;
pub use runner::run_parallel;
pub use runner::DefaultRunner;
pub use runner::InterruptableRunner;
pub use runner::Runner;
pub use inbox::A2aMessage;
pub use inbox::ControlAction as InboxControlAction;
pub use inbox::ControlMessage;
pub use inbox::EvidenceImpact;
pub use inbox::EvidenceSource;
pub use inbox::EvidenceUpdate;
pub use inbox::GuidanceMessage;
pub use inbox::GuidancePriority;
pub use inbox::GuidanceSource;
pub use inbox::InMemoryInboxStore;
pub use inbox::InboxMessage;
pub use inbox::InboxMessageType;
pub use inbox::InboxStore;
pub use background::apply_transform;
pub use background::BackgroundExecution;
pub use background::BackgroundExecutionConfig;
pub use background::BackgroundExecutionMode;
pub use background::BackgroundExecutionQueue;
pub use background::BackgroundExecutionStatus;
pub use background::RetryConfig;
pub use background::TargetBindingConfig;
pub use background::TargetBindingResult;
pub use background::TargetBindingTransform;
pub use background::TargetBindingType;
pub use background::ThresholdOperator;
pub use background::Trigger;
pub use background::TriggerAction;
pub use background::TriggerCondition;
pub use background::TriggerFiredEvent;
pub use background::TriggerId;
pub use background::TriggerStatus;
pub use background::TriggerType;
pub use storage::create_event_log;
pub use storage::create_event_store;
pub use storage::create_state_store;
pub use storage::EventStoreConfig;
pub use storage::InMemoryStateStore;
pub use storage::StateStoreConfig;
pub use storage::StorageContext;
pub use streaming::JsonlEventStore;
pub use streaming::JsonlStateStore;
pub use providers::ChatMessage;
pub use providers::ChatRequest;
pub use providers::ChatResponse;
pub use providers::EmbeddingRequest;
pub use providers::EmbeddingResponse;
pub use providers::ModelCapabilities;
pub use providers::ModelProvider;
pub use routing::resolve_model_precedence;
pub use routing::ModelRouter;
pub use routing::ModelSelectionSource;
pub use routing::RoutingDecision;
pub use routing::RoutingPolicy;
pub use routing::RoutingProfile;
pub use routing::DEFAULT_MODEL_ROUTER_ID;
pub use tool::FunctionTool;
pub use tool::Tool;
pub use tool::ToolExecutionContext;
pub use tool::ToolExecutionError;
pub use tool::ToolExecutor;

Modules§

background
Background Module - Background execution and triggers
callable
Callable - The execution unit abstraction
context
Context module - Execution context types
flow
Flow - Execution semantics and control flow
graph
Graph module - DAG execution engine and flow semantics
inbox
Agent Inbox - Mid-Execution Guidance
kernel
Kernel - The Execution Engine
memory
Memory abstractions.
policy
Policy - Execution constraints and guardrails
prelude
Prelude module - Convenient imports for most users
providers
Providers module - LLM adapters
routing
Routing primitives for model selection.
runner
Runner module - thin execution shell
signal
Signal module - Optional, best-effort signaling for hints and notifications
storage
Storage Factory - Create storage backends from configuration
streaming
Streaming - Event delivery and persistence
telemetry
Telemetry module - OpenTelemetry integration
tool
Tool module - Tool trait and policy-aware execution
util
Shared utility types and helpers.
workflow
Workflow module - Opinionated workflow blueprints and execution

Macros§

tool
Macro to create a FunctionTool more easily