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 max_turns: Option<u32>,
    pub max_wall_ms: 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.

§max_turns: Option<u32>

O3 per-node turn cap: the SDK sets the child run’s max_turns (falls back to the parent’s). Mirrors token_budget — same hop chain, additive ABI.

§max_wall_ms: Option<u64>

O3 per-node wall-clock cap (ms): the SDK sets the child run’s timeout. Additive ABI.

§depends_on: Vec<usize>

Indices into WorkflowSpec::nodes this node depends on.

Implementations§

Source§

impl WorkflowNode

Source

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

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

Source

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

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

Source

pub fn with_max_turns(self, turns: u32) -> WorkflowNode

O3: cap this node’s child run at turns provider turns.

Source

pub fn with_max_wall_ms(self, ms: u64) -> WorkflowNode

O3: cap this node’s child run at ms wall-clock milliseconds.

Source

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

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

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

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

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

Source

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

Source

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

Source

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

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

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

Source

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

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<(), Error>

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

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

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<WorkflowNode, <__D as Deserializer<'de>>::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 as Serializer>::Ok, <__S as Serializer>::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> 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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
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<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