Skip to main content

RunnableConfig

Struct RunnableConfig 

Source
pub struct RunnableConfig {
Show 23 fields pub thread_id: Option<String>, pub checkpoint_id: Option<String>, pub recursion_limit: usize, pub max_parallel_tasks: usize, pub run_name: Option<String>, pub graph_name: Option<String>, pub run_id: Option<String>, pub checkpoint_ns: Option<CheckpointNamespace>, pub cache: Option<CacheConfig>, pub tags: Vec<String>, pub metadata: HashMap<String, Value>, pub cancellation_token: Option<CancellationToken>, pub budget: Option<BudgetConfig>, pub durability: Option<Durability>, pub node_finished_callback: Option<Arc<dyn Fn(&str) + Send + Sync>>, pub resume_value: Option<ResumeValue>, pub interrupt_before: Option<Vec<String>>, pub interrupt_after: Option<Vec<String>>, pub metrics_collector: Option<Arc<dyn MetricsCollector>>, pub callback_handler: Option<Arc<dyn GraphLifecycleCallback>>, pub llm_cache_policy: Option<CachePolicy>, pub heartbeat: Option<Heartbeat>, pub budget_tracker: Option<Arc<BudgetTracker>>,
}
Expand description

Configuration for graph execution

Fields§

§thread_id: Option<String>

Thread ID for checkpoint isolation

§checkpoint_id: Option<String>

Checkpoint ID to resume from (time-travel)

§recursion_limit: usize

Maximum superstep count (default 25)

§max_parallel_tasks: usize

Maximum parallel tasks (for bounded concurrency)

§run_name: Option<String>

Run name for observability

§graph_name: Option<String>

Graph name for observability (specified at graph construction time)

§run_id: Option<String>

Unique run identifier for logging, stream resumption, and cancellation.

When None, the execution layer (CompiledGraph::stream, invoke, etc.) generates a new UUIDv4 automatically before creating the Pregel loop. Callers may set this explicitly to correlate multiple operations with the same run ID (e.g., for stream resumption or distributed tracing).

§checkpoint_ns: Option<CheckpointNamespace>

Checkpoint namespace (for subgraph isolation)

§cache: Option<CacheConfig>

Cache configuration

§tags: Vec<String>

Tags for filtering

§metadata: HashMap<String, Value>

User metadata

§cancellation_token: Option<CancellationToken>

Cancellation token for aborting execution

§budget: Option<BudgetConfig>

Budget configuration for execution limits

§durability: Option<Durability>

Checkpoint durability mode

§node_finished_callback: Option<Arc<dyn Fn(&str) + Send + Sync>>

Callback invoked when a node finishes execution

§resume_value: Option<ResumeValue>

Resume value for HITL interrupt continuation

Supports single value, ID-based resume, and namespace-based resume for multi-interrupt workflows.

§interrupt_before: Option<Vec<String>>

Nodes that should interrupt before execution (HITL)

§interrupt_after: Option<Vec<String>>

Nodes that should interrupt after execution (HITL)

§metrics_collector: Option<Arc<dyn MetricsCollector>>

Optional metrics collector for OpenTelemetry or in-memory metrics

§callback_handler: Option<Arc<dyn GraphLifecycleCallback>>

Optional callback handler for graph lifecycle events

Receives notifications at key points during graph execution: node start/end/error, graph completion, and checkpoint saves. All methods have default no-op implementations.

§llm_cache_policy: Option<CachePolicy>

LLM response cache policy for controlling key generation and TTL

§heartbeat: Option<Heartbeat>

Optional heartbeat sender for long-running node liveness signals

When set by the execution engine, nodes can call config.heartbeat.as_ref().map(Heartbeat::ping) periodically to prevent idle timeout detection.

§budget_tracker: Option<Arc<BudgetTracker>>

Runtime budget tracker shared across nodes for token/cost tracking

Set by the execution engine when a BudgetConfig is configured. Nodes can access this via Self::budget_tracker to report LLM token usage for automatic budget enforcement.

Implementations§

Source§

impl RunnableConfig

Source

pub fn new() -> Self

Create a new configuration with sensible defaults

Source

pub fn with_thread_id(self, id: impl Into<String>) -> Self

Set the thread ID for checkpoint isolation

Source

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

Set the checkpoint ID for time-travel resume

Source

pub fn with_run_id(self, id: impl Into<String>) -> Self

Set the run ID for stream resumption and observability correlation

Source

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

Set the recursion limit (maximum superstep count)

Source

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

Set the maximum number of parallel tasks

Source

pub fn with_run_name(self, name: impl Into<String>) -> Self

Set the run name for observability

Source

pub fn with_graph_name(self, name: impl Into<String>) -> Self

Set the graph name for observability

Source

pub fn with_checkpoint_ns(self, ns: CheckpointNamespace) -> Self

Set the checkpoint namespace for subgraph isolation

Source

pub fn with_cache(self, cache: CacheConfig) -> Self

Set cache configuration

Source

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

Add a tag for filtering

Source

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

Add metadata key-value pair

Source

pub fn with_cancellation_token(self, token: CancellationToken) -> Self

Set the cancellation token for aborting execution

Source

pub fn with_budget(self, budget: BudgetConfig) -> Self

Set the budget configuration for execution limits

Source

pub fn with_interrupt_before(self, nodes: Vec<String>) -> Self

Set interrupt_before nodes (HITL - interrupt before node execution)

§Examples
use juncture_core::config::RunnableConfig;

let config = RunnableConfig::new()
    .with_interrupt_before(vec!["human_input".to_string()]);
Source

pub fn with_interrupt_after(self, nodes: Vec<String>) -> Self

Set interrupt_after nodes (HITL - interrupt after node execution)

§Examples
use juncture_core::config::RunnableConfig;

let config = RunnableConfig::new()
    .with_interrupt_after(vec!["confirmation".to_string()]);
Source

pub fn with_metrics_collector( self, collector: Arc<dyn MetricsCollector>, ) -> Self

Set the metrics collector for observability

§Examples
use std::sync::Arc;
use juncture_core::config::RunnableConfig;
use juncture_core::observability::MetricsCollector;

let collector: Arc<dyn MetricsCollector> = /* ... */;
let config = RunnableConfig::new()
    .with_metrics_collector(collector);
Source

pub fn with_callback_handler( self, handler: Arc<dyn GraphLifecycleCallback>, ) -> Self

Set the callback handler for graph lifecycle events

§Examples
use std::sync::Arc;
use juncture_core::config::RunnableConfig;
use juncture_core::observability::GraphLifecycleCallback;

let handler: Arc<dyn GraphLifecycleCallback> = /* ... */;
let config = RunnableConfig::new()
    .with_callback_handler(handler);
Source

pub fn with_llm_cache_policy(self, policy: LlmCachePolicy) -> Self

Set the LLM response cache policy

Source

pub const fn budget_tracker(&self) -> Option<&Arc<BudgetTracker>>

Get a reference to the budget tracker, if configured

Nodes can call this to report LLM token usage for automatic budget enforcement during graph execution.

Trait Implementations§

Source§

impl Clone for RunnableConfig

Source§

fn clone(&self) -> RunnableConfig

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

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

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> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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