Skip to main content

RunnableConfig

Struct RunnableConfig 

Source
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

Source

pub fn new() -> Self

Create a new configuration with default values.

Source

pub fn with_random_thread() -> Self

Create a configuration with a random thread ID.

Source

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.

Source

pub fn with_checkpoint_id(self, checkpoint_id: impl Into<String>) -> Self

Set the checkpoint ID to resume from.

Source

pub fn with_metadata( self, key: impl Into<String>, value: impl Into<String>, ) -> Self

Add a metadata key-value pair.

Source

pub fn with_metadata_map(self, metadata: HashMap<String, String>) -> Self

Add multiple metadata entries.

Source

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>().

Source

pub fn with_tag(self, tag: impl Into<String>) -> Self

Add a tag.

Source

pub fn with_tags( self, tags: impl IntoIterator<Item = impl Into<String>>, ) -> Self

Add multiple tags.

Source

pub fn with_max_iterations(self, max: usize) -> Self

Set the maximum iterations.

Source

pub fn with_recursion_limit(self, limit: usize) -> Self

Set the recursion limit.

Source

pub fn thread_id(&self) -> Option<&str>

Get the thread ID.

Source

pub fn checkpoint_id(&self) -> Option<&str>

Get the checkpoint ID.

Source

pub fn get_metadata(&self, key: &str) -> Option<&str>

Get a metadata value by key.

Source

pub fn metadata(&self) -> &HashMap<String, String>

Get all metadata.

Source

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.

Source

pub fn require_context<T: Send + Sync + 'static>(&self) -> Result<Arc<T>>

Get a typed context value, returning an error if not found.

Source

pub fn has_tag(&self, tag: &str) -> bool

Check if a tag is present.

Source

pub fn tags(&self) -> &[String]

Get all tags.

Source

pub fn max_iterations(&self) -> Option<usize>

Get the maximum iterations limit.

Source

pub fn recursion_limit(&self) -> usize

Get the recursion limit.

Source

pub fn child(&self) -> Result<Self>

Create a child configuration for nested graph execution.

This decrements the recursion limit and preserves other settings.

Source

pub fn merge(self, other: Self) -> Self

Merge another configuration into this one.

Values from other take precedence.

Trait Implementations§

Source§

impl Clone for RunnableConfig

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RunnableConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for RunnableConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl From<&RunnableConfig> for ConfigSnapshot

Source§

fn from(config: &RunnableConfig) -> Self

Converts to this type from the input type.
Source§

impl From<ConfigSnapshot> for RunnableConfig

Source§

fn from(snapshot: ConfigSnapshot) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more