Skip to main content

WorkflowNode

Struct WorkflowNode 

Source
pub struct WorkflowNode {
    pub task: RuntimeTask,
    pub role: AgentRole,
    pub isolation: AgentIsolation,
    pub context_inheritance: ContextInheritance,
    pub model_hint: Option<String>,
    pub trust: NodeTrust,
    pub output_schema: Option<Value>,
    pub kind: NodeKind,
    pub token_budget: Option<u64>,
    pub depends_on: Vec<usize>,
}
Expand description

One node in a workflow DAG: a task plus the contract its agent runs under.

Fields§

§task: RuntimeTask§role: AgentRole§isolation: AgentIsolation§context_inheritance: ContextInheritance§model_hint: Option<String>

Optional model preference (e.g. “opus” / “sonnet”); the SDK resolves it. See W4.

§trust: NodeTrust

W3 trust level. Default Trusted.

§output_schema: Option<Value>

G3 structured output: an optional JSON Schema the node’s agent output must conform to. The kernel is zero-I/O and never validates it — it carries the schema verbatim to the spawn descriptor so the SDK can instruct the agent and validate/retry on its result (the structured “summary only” contract from image 8 is enforced SDK-side; the kernel owns the contract). Additive: omitted on the wire when absent.

§kind: NodeKind

Control-flow kind. Default Spawn (run once).

§token_budget: Option<u64>

M4/G5: optional per-node cumulative token cap. The kernel carries it to the spawn descriptor; the SDK sets the node’s child-run max_total_tokens to it, so an expensive node self-terminates at the cap (the “use N tokens” budget, applied per node). Additive: omitted on the wire when None.

§depends_on: Vec<usize>

Indices into WorkflowSpec::nodes this node depends on.

Implementations§

Source§

impl WorkflowNode

Source

pub fn new(task: RuntimeTask, role: AgentRole) -> Self

A node with role-default isolation/inheritance and no dependencies.

Source

pub fn with_token_budget(self, tokens: u64) -> Self

M4/G5: cap this node’s child run at tokens cumulative tokens.

Source

pub fn with_loop(self, max_iters: usize) -> Self

Make this a loop node: re-run the agent up to max_iters times before completing. Dependents wait for the whole loop to finish.

Source

pub fn with_classify(self, branches: Vec<ClassifyBranch>) -> Self

Make this a classify node: its result selects one of branches to run; the rest are pruned.

Source

pub fn with_tournament(self, entrants: Vec<RuntimeTask>) -> Self

Make this a tournament controller node: it spawns no agent of its own but generates each of entrants (in parallel), then pairwise-judges them to a single winner. The node’s own task.goal is the judging criterion handed to every judge. Requires ≥2 entrants.

Source

pub fn with_reduce(self, reducer: impl Into<String>) -> Self

G2: make this a deterministic reduce node — it runs no LLM agent; the SDK routes it to the registered reducer function over its dependencies’ outputs (dedupe / filter / merge). Give it depends_on the nodes whose outputs it consumes.

Source

pub fn with_depends_on(self, depends_on: Vec<usize>) -> Self

Source

pub fn with_isolation(self, isolation: AgentIsolation) -> Self

Source

pub fn with_context_inheritance(self, inheritance: ContextInheritance) -> Self

Source

pub fn with_model_hint(self, hint: impl Into<String>) -> Self

Source

pub fn with_trust(self, trust: NodeTrust) -> Self

W3: mark this node’s trust level. Quarantined nodes read untrusted content and are kernel-enforced to read-only (a quarantined node declaring write isolation is denied).

Source

pub fn quarantined(self) -> Self

Mark this node as quarantined (reads untrusted content, runs without privileges).

Source

pub fn with_output_schema(self, schema: Value) -> Self

G3: require this node’s output to conform to a JSON Schema. The kernel carries it verbatim to the spawn descriptor; the SDK instructs the agent and validates/retries on its result.

Trait Implementations§

Source§

impl Clone for WorkflowNode

Source§

fn clone(&self) -> WorkflowNode

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 WorkflowNode

Source§

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

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

impl<'de> Deserialize<'de> for WorkflowNode

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 Serialize for WorkflowNode

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

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

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.