Skip to contents

A node transforms the shared state. It may be: an Agent (its reply() is called on state[[input_key]] and the result written to state[[output_key]]); a plain function(state) returning the new state; an evaluator (a function or Agent + schema writing a structured verdict into state, used by conditional edges); or a human_gate() (pauses the run for sign-off).

Usage

add_node(
  wf,
  name,
  node,
  input_key = "input",
  output_key = NULL,
  schema = NULL,
  ...
)

Arguments

wf

An agent_workflow.

name

Node name (unique within the workflow).

node

An Agent, a function(state), or a human_gate() marker.

input_key, output_key

For an agent node: where to read the prompt and write the reply in state (default "input" / the node name).

schema

For an evaluator agent node: a JSON schema; the parsed verdict is written to state[[output_key]].

...

Reserved.

Value

The workflow, with the node added. The first node added is the entry.