Skip to main content

Node

Enum Node 

Source
pub enum Node {
    Agent(AgentNode),
    Tool(ToolNode),
    Gate(GateNode),
    Branch(BranchNode),
    Map(MapNode),
    Fold(FoldNode),
}
Expand description

One node in a graph: exactly one of the six kinds the runtime knows how to execute.

Adjacently tagged like the event enum: each node serializes as {"kind": "...", "payload": {...}}. The tag (kind) and content (payload) live in separate keys, which never collides with a payload field and does not force payloads to be JSON objects. deny_unknown_fields on the enum rejects any key other than kind and payload.

The stable node id lives inside each payload (every payload struct carries an id), reachable generically through Node::id. Keeping the id in the payload is what lets the outer shape stay exactly the two-key adjacent tagging the event log uses, with no third common field to special-case.

Variants§

§

Agent(AgentNode)

A full agent loop (model, prompt, tools, budget). The whole v0.1 product becomes one node kind. It references its agent definition BY CONTENT HASH, never an embedded definition, so this crate stays a leaf that does not depend on the agent-definition schema.

§

Tool(ToolNode)

A single direct tool invocation, no model in the loop.

§

Gate(GateNode)

Human approval: suspends the graph run and renders in the approval inbox.

§

Branch(BranchNode)

Routes on a typed output. The cases (conditions and their names) are recorded as DATA here; this crate never evaluates them.

§

Map(MapNode)

Fan-out: spawn a sub-run per element of a typed list, join on completion, with a concurrency cap.

§

Fold(FoldNode)

Bounded iteration: run a body repeatedly, accumulating across passes, until a stop predicate holds or an iteration bound is reached, then join the passes into one value. Models an adversarial refine loop (draft, score, review, revise) as one node. Execution is not implemented: the fold exists in the format, the validator, the projection, and the canvas; the engine records a typed refusal for it.

Implementations§

Source§

impl Node

Source

pub fn id(&self) -> &str

The node’s stable id, whatever its kind.

Source

pub fn kind_name(&self) -> &'static str

The kind name ("agent", "tool", …), for error messages.

Source

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

The node’s optional display name, whatever its kind. See the module docs’ “The optional node display name” section.

Source

pub fn input_schema(&self) -> Option<&Value>

The JSON Schema this node declares for the payload it CONSUMES, if any. Absent means the node does not declare an input type, and an edge into it passes the type-compatibility check unchecked.

Source

pub fn output_schema(&self) -> Option<&Value>

The JSON Schema this node declares for the payload it PRODUCES, if any. Absent means the node does not declare an output type, and an edge out of it passes the type-compatibility check unchecked.

Trait Implementations§

Source§

impl Clone for Node

Source§

fn clone(&self) -> Node

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 Node

Source§

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

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

impl<'de> Deserialize<'de> for Node

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl JsonSchema for Node

Source§

fn schema_name() -> Cow<'static, str>

The name of the generated JSON Schema. Read more
Source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
Source§

fn json_schema(generator: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
Source§

fn inline_schema() -> bool

Whether JSON Schemas generated for this type should be included directly in parent schemas, rather than being re-used where possible using the $ref keyword. Read more
Source§

impl PartialEq for Node

Source§

fn eq(&self, other: &Node) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for Node

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Node

Auto Trait Implementations§

§

impl Freeze for Node

§

impl RefUnwindSafe for Node

§

impl Send for Node

§

impl Sync for Node

§

impl Unpin for Node

§

impl UnsafeUnpin for Node

§

impl UnwindSafe for Node

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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