Skip to main content

NodeAction

Enum NodeAction 

Source
#[non_exhaustive]
pub enum NodeAction { LlmInfer { system_prompt_override: Option<String>, use_streaming: bool, include_tool_definitions: bool, tool_filter_override: Option<Vec<String>>, thinking_budget: Option<u32>, temperature: Option<f32>, max_tokens: Option<u32>, }, ToolCall { tool_name: String, args_template: Option<String>, }, Delegate { agent_kind: String, task_template: String, }, HumanApproval { description: String, }, ConditionCheck { condition: String, }, SwitchParadigm { paradigm: String, }, }
Expand description

The action performed by a graph node.

Each node can perform one of several action types:

  • LLM inference (the core reasoning step)
  • Tool execution (calling a specific tool)
  • Sub-agent delegation (spawning a specialized sub-agent)
  • Human approval (a checkpoint requiring human intervention)
  • Condition check (a routing node that evaluates a condition)
  • Paradigm switch (changing the active paradigm for subsequent nodes)

When a GraphActionExecutor (from oneai-agent) is configured, the LlmInfer and ToolCall nodes delegate to the AgentLoop’s full inference and execution pipeline (context assembly, tool definitions, hooks, permission, domain pack). This is the P2-2 “闭环” mechanism.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

LlmInfer

LLM inference node — sends conversation to the model and gets a response.

When include_tool_definitions is true, the GraphActionExecutor will build tool definitions for this node (filtered by tool_filter_override or the active paradigm’s tool set). This is critical for ReAct loops — the model needs to see available tools to decide whether to call them.

When include_tool_definitions is false, the node sends a pure inference request without tool definitions (for final answer nodes, condition checks, etc).

Fields

§system_prompt_override: Option<String>

System prompt override for this node (if any).

§use_streaming: bool

Whether to use streaming inference.

§include_tool_definitions: bool

Whether to include tool definitions in the inference request. When true, the GraphActionExecutor builds tool definitions based on tool_filter_override or the active paradigm config. When false (default), the LLM receives a pure text prompt without tools.

§tool_filter_override: Option<Vec<String>>

Override the tool filter for this node (if any). When Some, only these tools are included in the inference request. When None, the active paradigm’s tool_filter is used (or all tools if no paradigm is active).

§thinking_budget: Option<u32>

Token budget for extended thinking/reasoning (Anthropic budget_tokens). None = thinking disabled; Some(N) = enable thinking with N token budget.

§temperature: Option<f32>

Temperature for sampling (0.0 = deterministic, 1.0 = creative).

§max_tokens: Option<u32>

Maximum tokens to generate.

§

ToolCall

Tool execution node — calls a specific tool with arguments.

Fields

§tool_name: String

The tool name to call.

§args_template: Option<String>

Template for constructing tool arguments from state. Uses {{variable}} syntax for state variable interpolation.

§

Delegate

Sub-agent delegation node — spawns a specialized sub-agent.

Fields

§agent_kind: String

The sub-agent kind to spawn.

§task_template: String

Template for constructing the task description from state.

§

HumanApproval

Human approval node — pauses execution for human review. This is an interrupt point where the user can inspect state and decide to continue, modify, or abort.

Fields

§description: String

The description of what requires approval.

§

ConditionCheck

Condition check node — evaluates a condition and routes to different edges. This is the mechanism for dynamic routing in the graph.

Fields

§condition: String

The condition expression to evaluate. Examples: “has_tool_calls”, “is_final_answer”, “error_occurred”

§

SwitchParadigm

Paradigm switch node — changes the active paradigm for subsequent nodes.

When executed, this node updates GraphState.active_paradigm and clears GraphState.parsed_decision. Subsequent LlmInfer nodes (with include_tool_definitions = true) will use the new paradigm’s tool set and system prompt. This enables multi-paradigm workflows as explicit graph paths (e.g., Plan → ReAct → Reflect).

The paradigm string maps to ParadigmKind in oneai-agent: “plan”, “react”, “reflect”, “explore”.

Fields

§paradigm: String

The target paradigm to switch to.

Trait Implementations§

Source§

impl Clone for NodeAction

Source§

fn clone(&self) -> Self

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 NodeAction

Source§

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

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

impl<'de> Deserialize<'de> for NodeAction

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 NodeAction

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

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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