pub struct RunnableConfig { /* private fields */ }Expand description
Configuration for a graph execution run.
RunnableConfig provides context and metadata to nodes during execution.
It includes thread identification for checkpointing, custom data storage,
and execution parameters.
§Examples
use regula_core::RunnableConfig;
let config = RunnableConfig::new()
.with_thread_id("conversation-1")
.with_metadata("user_id", "user-123");
assert_eq!(config.thread_id(), Some("conversation-1"));Implementations§
Source§impl RunnableConfig
impl RunnableConfig
Sourcepub fn with_random_thread() -> Self
pub fn with_random_thread() -> Self
Create a configuration with a random thread ID.
Sourcepub fn with_thread_id(self, thread_id: impl Into<String>) -> Self
pub fn with_thread_id(self, thread_id: impl Into<String>) -> Self
Set the thread ID.
The thread ID is used to identify a conversation or session for checkpointing and state persistence.
Sourcepub fn with_checkpoint_id(self, checkpoint_id: impl Into<String>) -> Self
pub fn with_checkpoint_id(self, checkpoint_id: impl Into<String>) -> Self
Set the checkpoint ID to resume from.
Sourcepub fn with_metadata(
self,
key: impl Into<String>,
value: impl Into<String>,
) -> Self
pub fn with_metadata( self, key: impl Into<String>, value: impl Into<String>, ) -> Self
Add a metadata key-value pair.
Sourcepub fn with_metadata_map(self, metadata: HashMap<String, String>) -> Self
pub fn with_metadata_map(self, metadata: HashMap<String, String>) -> Self
Add multiple metadata entries.
Sourcepub fn with_context<T: Send + Sync + 'static>(self, value: T) -> Self
pub fn with_context<T: Send + Sync + 'static>(self, value: T) -> Self
Add a typed context value.
Context values can be retrieved in nodes using config.get::<T>().
Add multiple tags.
Sourcepub fn with_max_iterations(self, max: usize) -> Self
pub fn with_max_iterations(self, max: usize) -> Self
Set the maximum iterations.
Sourcepub fn with_recursion_limit(self, limit: usize) -> Self
pub fn with_recursion_limit(self, limit: usize) -> Self
Set the recursion limit.
Sourcepub fn checkpoint_id(&self) -> Option<&str>
pub fn checkpoint_id(&self) -> Option<&str>
Get the checkpoint ID.
Sourcepub fn get_metadata(&self, key: &str) -> Option<&str>
pub fn get_metadata(&self, key: &str) -> Option<&str>
Get a metadata value by key.
Sourcepub fn get_context<T: Send + Sync + 'static>(&self) -> Option<Arc<T>>
pub fn get_context<T: Send + Sync + 'static>(&self) -> Option<Arc<T>>
Get a typed context value.
Returns None if the value was not set or is the wrong type.
Sourcepub fn require_context<T: Send + Sync + 'static>(&self) -> Result<Arc<T>>
pub fn require_context<T: Send + Sync + 'static>(&self) -> Result<Arc<T>>
Get a typed context value, returning an error if not found.
Get all tags.
Sourcepub fn max_iterations(&self) -> Option<usize>
pub fn max_iterations(&self) -> Option<usize>
Get the maximum iterations limit.
Sourcepub fn recursion_limit(&self) -> usize
pub fn recursion_limit(&self) -> usize
Get the recursion limit.