Expand description
Graph-based execution primitives for Polaris (Layer 2).
polaris_graph provides the core abstractions for defining behavior as
directed graphs of systems. This is the foundation for safe, composable,
inspectable agent behavior.
§Core Concepts
Graph- Directed graph structure with builder APINode- Vertices representing computation or control flowEdge- Connections defining execution flowPredicate- Type-safe predicates for control flow decisionsGraphExecutor- Runtime engine for graph traversal and execution
§Example
let mut graph = Graph::new();
graph
.add_system(reason)
.add_system(decide)
.add_system(respond);
let mut ctx = SystemContext::new();
let executor = GraphExecutor::new();
let result = executor.execute(&graph, &mut ctx, None, None).await?;§Architecture
This crate is Layer 2 of the Polaris architecture:
- Layer 1 (
polaris_system): ECS-inspired primitives (System, Resource, Plugin) - Layer 2 (
polaris_graph): Graph execution primitives (this crate) - Layer 2 (
polaris_agent): Agent pattern definition (Agent trait) - Layer 3 (plugins): Concrete agent implementations
For the full framework guide, architecture overview, and integration patterns,
see the polaris-ai crate documentation.
Re-exports§
pub use dev::DevToolsPlugin;pub use dev::SystemInfo;pub use executor::CaughtError;pub use executor::ErrorKind;pub use executor::ExecutionError;pub use executor::ExecutionResult;pub use executor::GraphExecutor;pub use executor::ResourceValidationError;pub use graph::Graph;pub use graph::MergeError;pub use graph::SystemNodeBuilder;pub use graph::ValidationError;pub use graph::ValidationResult;pub use graph::ValidationWarning;pub use hooks::RunId;pub use hooks::RunLabels;pub use middleware::MiddlewareAPI;pub use middleware::MiddlewareError;pub use node::ContextMode;pub use node::ContextPolicy;pub use node::NodeId;pub use node::RetryPolicy;pub use node::ScopeNode;
Modules§
- dev
- Development tools for graph execution.
- edge
- Edge types for graphs.
- executor
- Graph execution engine.
- graph
- Graph structure and builder API.
- hooks
- Lifecycle hooks for graph execution.
- middleware
- Graph execution middleware.
- node
- Node types for graphs.
- predicate
- Type-safe predicates for control flow decisions.
- prelude
- Re-export all common types for easy access.