Skip to main content

Transition

Enum Transition 

Source
pub enum Transition {
    Await(Vec<Effect>),
    Spawn {
        specs: Vec<NodeSpec>,
        join: JoinPolicy,
    },
    Goto {
        target: NodeId,
        carry: Value,
    },
    Suspend {
        reason: SuspendReason,
    },
    Done(Value),
}
Expand description

What a step wants to happen next.

Deliberately NOT #[non_exhaustive], for the same reason as crate::node::NodeOutcome, its other half: the driver decides control flow off this value, and a wildcard arm there is a silent wrong answer. Adding a variant should break every consumer — each one has to decide what the new transition means for it.

Variants§

§

Await(Vec<Effect>)

Perform these effects — concurrently — then poll again with the results in the same order.

§

Spawn

Create and run these nodes now, then poll again with their outputs.

The map half of map-reduce, where the fan-out width is only known at runtime. LangGraph calls this Send.

Fields

§specs: Vec<NodeSpec>

The nodes to create — one per unit of discovered work.

§join: JoinPolicy

How their outputs recombine, and what one failure does to the rest.

§

Goto

Hand control to another node, with a value. The current step is done.

A handoff, in the sense the OpenAI Agents SDK uses: delegation that transfers control rather than nesting a call.

Fields

§target: NodeId

Where control goes — a node reachable over a declared handoff edge.

§carry: Value

The value it receives as its input.

§

Suspend

Stop the run and persist it. Resuming replays the journal up to here and continues with whatever came back.

Fields

§reason: SuspendReason

What the run is waiting for, and what would restart it.

§

Done(Value)

Finished, with this output.

Implementations§

Source§

impl Transition

Source

pub fn label(&self) -> String

A short label for events. Payload-free by construction.

Source

pub fn is_terminal(&self) -> bool

Is this the step’s last word? Done and Goto are — nothing polls the step again this run. The other three expect another poll: after the effects, after the spawned nodes, or after a resume.

Trait Implementations§

Source§

impl Debug for Transition

Source§

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

Formats the value using the given formatter. 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> AsAny for T
where T: Any,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

The receiver as &dyn Any, ready for downcast_ref.
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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> Same for T

Source§

type Output = T

Should always be Self
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.