Skip to main content

Crate pe_core

Crate pe_core 

Source
Expand description

§pe-core — Core types for Potential Expectations

Zero internal dependencies. Every other crate in the workspace depends on this. Contains: messages, channels, state traits, node traits, error types, agent types.

Re-exports§

pub use agent::Agent;
pub use channel::Channel;
pub use channel_store::ChannelId;
pub use channel_store::ChannelStore;
pub use cognitive::CognitiveArchitecture;
pub use cognitive::CognitiveState;
pub use cognitive::CognitiveStateUpdate;
pub use cognitive::CognitiveStream;
pub use cognitive::SynthesisStrategy;
pub use cognitive_budget::BudgetTracker;
pub use cognitive_budget::CognitiveBudget;
pub use cognitive_memory::MeditateConfig;
pub use cognitive_memory::MeditateResult;
pub use cognitive_memory::MemoryConfig;
pub use cognitive_memory::NoteCategory;
pub use cognitive_memory::WorkingNote;
pub use cognitive_signal::CognitiveSignal;
pub use error::PeError;
pub use formatter::MessageFormatter;
pub use internal_tool::InternalTool;
pub use internal_tool::InternalToolRegistry;
pub use llm::LlmProvider;
pub use llm::LlmResponse;
pub use llm::StreamChunk;
pub use llm::StreamFuture;
pub use llm::ToolSchema;
pub use lobe::Lobe;
pub use lobe::LobeActivation;
pub use lobe::LobeBudget;
pub use lobe::LobeContext;
pub use lobe::LobeFuture;
pub use lobe::LobeInput;
pub use lobe::LobeInspectionEntry;
pub use lobe::LobeInspectionEntryKind;
pub use lobe::LobeInspectionRequest;
pub use lobe::LobeInspectionResult;
pub use lobe::LobeOutput;
pub use lobe::LobeOutputFormat;
pub use lobe::LobeRuntimeServiceFactory;
pub use lobe::LobeRuntimeServices;
pub use lobe_cache::LobeCache;
pub use lobe_node::LobeNode;
pub use lobe_registry::LobeRegistry;
pub use mock_provider::MockProvider;
pub use node::ActivationReason;
pub use node::ConvergenceSignal;
pub use node::HumanInput;
pub use node::InterruptRequest;
pub use node::NodeContext;
pub use node::NodeFn;
pub use node::NodeFuture;
pub use node::NodeObserver;
pub use node::NodeResult;
pub use node::ToolObserver;
pub use openai_formatter::OpenAiFormatter;
pub use phase_store::PhaseStateStore;
pub use phase_store::PhaseStoreError;
pub use reducers::add_messages;
pub use scope::ExecutionScope;
pub use self_model::FailureRecord;
pub use self_model::NegativeKnowledge;
pub use self_model::SelfModel;
pub use self_model::Severity;
pub use state::CoreState;
pub use state::CoreStateUpdate;
pub use state::State;
pub use state::StateUpdate;
pub use synthesizer::IntegrateSynthesizer;
pub use synthesizer::SynthesisResult;
pub use synthesizer::Synthesizer;
pub use synthesizer::VoteSynthesizer;
pub use synthesizer::WeightedSynthesizer;
pub use token::CharTokenCounter;
pub use token::TokenCounter;
pub use token::TrimStrategy;
pub use token::trim_messages;
pub use types::AgentCapability;
pub use types::AgentMatrix;
pub use types::BuilderMode;
pub use types::END;
pub use types::ExecutionBudget;
pub use types::NodeId;
pub use types::START;
pub use validation::ExecutionMetrics;
pub use validation::WriteRecord;
pub use circuit_breaker::CircuitBreaker;
pub use fallback_provider::FallbackProvider;
pub use middleware_stack::MiddlewareStack;
pub use provider_middleware::ProviderMiddleware;
pub use retry_middleware::RetryMiddleware;
pub use timeout_middleware::TimeoutMiddleware;
pub use message::*;

Modules§

agent
Agent — bounded execution context.
boundaries
Agent boundary types — library primitives, user policies.
channel
Channel system — the actual state mechanism underneath everything.
channel_store
ChannelStore — heterogeneous typed channel storage.
circuit_breaker
Circuit breaker – fail-fast on repeated transient LLM errors.
cognitive
Cognitive architecture — optional inner subgraph for agent reasoning.
cognitive_budget
Cognitive budget — resource limits for the inner reasoning graph.
cognitive_memory
Cognitive memory types — working notes, categories, and memory configuration.
cognitive_signal
Cognitive signals — inner world → outer world communication.
error
Error taxonomy — complete set of errors the library produces. Based on Group 7 of the pre-plan.
fallback_provider
Fallback provider – tries a primary LLM, falls back to secondary on transient failure.
formatter
Message formatter trait – decouples wire format from LLM provider.
internal_tool
Internal tools – cognitive-only tools for agent self-management.
llm
LLM provider abstraction — the interface every execution path depends on.
lobe
Lobe — the cognitive processing unit.
lobe_cache
Lobe output cache — skip re-execution when input hasn’t changed.
lobe_node
Lobe-to-Node bridge — wraps a Lobe into a NodeFn<CognitiveState>.
lobe_registry
Lobe registry — manages a collection of cognitive lobes.
macros
Declarative macros for pe-core.
message
Message type hierarchy — flows through every agent and LLM call.
middleware_stack
Middleware stack – composes middlewares over a base LlmProvider.
mock_provider
MockProvider — deterministic LLM provider for testing.
node
Node traits — the unit of execution within a graph.
openai_formatter
OpenAI-compatible message formatter.
phase_store
Phase state store – TypeId-keyed storage for node phase enums.
provider_middleware
Provider middleware trait for composable LLM call wrappers.
reducers
Built-in reducers for channel merge operations.
retry_middleware
Retry middleware — exponential backoff with jitter for transient LLM errors.
scope
ExecutionScope — multi-tenant isolation.
self_model
Self-model — the agent’s model of itself, users, and collective.
state
State traits — the foundation every agent state implements.
synthesizer
Synthesizer — merges lobe outputs into enriched context.
timeout_middleware
Timeout middleware — enforces a per-call time limit on LLM completions.
token
Token counting and message trimming utilities.
types
Shared type aliases and common structures used across crates.
validation
Execution validation — guardrail checks and write governance enforcement.

Macros§

core_state_fields
Embeds the standard CoreState fields into a state struct.