Skip to main content

AgentGraphBuilder

Struct AgentGraphBuilder 

Source
pub struct AgentGraphBuilder { /* private fields */ }
Expand description

Builder for AgentGraph.

Implementations§

Source§

impl AgentGraphBuilder

Source

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

Set the graph name (used in streaming events and debugging).

Source

pub fn add_node(self, name: impl Into<String>, node: Box<dyn Node>) -> Self

Add a node to the graph.

Source

pub fn add_node_with_retry( self, name: impl Into<String>, node: Box<dyn Node>, retry: RetryPolicy, ) -> Self

Add a node with a retry policy.

Source

pub fn add_subgraph(self, name: impl Into<String>, subgraph: AgentGraph) -> Self

Add a subgraph as a node.

Source

pub fn add_edge(self, from: impl Into<String>, to: impl Into<String>) -> Self

Add a normal edge (always goes to next node). Multiple edges from the same node create fan-out (parallel execution).

Source

pub fn add_conditional_edge( self, from: impl Into<String>, router: Box<dyn RoutingFunction>, ) -> Self

Add a conditional edge (uses router to determine next node).

Source

pub fn set_entry_point(self, node: impl Into<String>) -> Self

Set the entry point (sugar for add_edge(START, node)).

Source

pub fn set_finish_point(self, node: impl Into<String>) -> Self

Set the finish point (sugar for add_edge(node, END)).

Source

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

Set maximum iterations before stopping (prevents infinite loops).

Source

pub fn with_cycle_detection(self, enable: bool) -> Self

Enable or disable cycle detection.

Source

pub fn with_reducer( self, key: impl Into<String>, reducer: impl Reducer + 'static, ) -> Self

Register a state reducer for a key.

Source

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

Set interrupt-before configuration.

Source

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

Set interrupt-after configuration.

Source

pub fn with_checkpointer( self, checkpointer: impl CheckpointSaver + 'static, ) -> Self

Set the legacy checkpointer for persistence (superstep-level).

Source

pub fn with_checkpoint_store(self, store: Arc<dyn CheckpointStore>) -> Self

Set the granular checkpoint store (per-attempt recording).

Source

pub fn with_event_sink(self, sink: Arc<dyn EventSink>) -> Self

Set a custom event sink for structured event handling.

Source

pub fn with_executor(self, executor: Arc<dyn Executor>) -> Self

Set a custom executor for node execution.

Source

pub fn build(self) -> Result<AgentGraph>

Build the graph.

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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