| Crates.io | regula |
| lib.rs | regula |
| version | 0.1.0 |
| created_at | 2026-01-05 22:09:16.897305+00 |
| updated_at | 2026-01-05 22:09:16.897305+00 |
| description | A LangGraph-style agentic orchestration framework in Rust |
| homepage | |
| repository | |
| max_upload_size | |
| id | 2024668 |
| size | 120,191 |
Rust Execution Graph for Unified LLM Agents
REGULA is a LangGraph-style agentic orchestration framework in Rust, built on the Pregel message-passing model. It enables the creation of stateful, multi-step workflows with cycles, controllable side-effects, and persistence.
Add regula to your Cargo.toml:
[dependencies]
regula = "0.1.0"
Here's a simple example of a chat agent that responds to user input:
use regula::prelude::*;
use std::time::Duration;
#[derive(Clone, Default, Debug, Serialize, Deserialize, GraphState)]
struct ChatState {
messages: Vec<Message>,
}
#[tokio::main]
async fn main() -> Result<()> {
// Define an LLM agent node
let agent_node = node_fn(|state: &ChatState, _| async move {
// ... call LLM ...
println!("Processing: {:?}", state.messages.last());
Ok(NodeOutput::update(state.clone()))
});
// Build the graph
let graph = StateGraph::<ChatState>::new()
.add_node("agent", agent_node)
.add_edge(start(), "agent")
.add_edge("agent", end())
.compile(Default::default())?;
// Execute
let executor = GraphExecutor::new(graph);
let initial_state = ChatState::default();
executor.invoke(initial_state, RunnableConfig::default()).await?;
Ok(())
}
REGULA follows a modular architecture:
regula: The main facade crate.regula-core: Core traits and type definitions.regula-runtime: The Pregel-style execution engine.regula-macros: Derive macros for state management.regula-checkpoint: Persistence and checkpointing.regula-llm: LLM client integrations.Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.