Skip to content

Nodes

A Node is a unit of work that is executed by the graph. It can be a single agent, a tool, a router, or any other type of node.

FieldTypeDescription
idstringThe ID of the node.
typestringThe type of the node.
agent_idstringThe ID of the agent to run (agent, supervisor, synthesizer nodes).
tool_idstringThe tool to execute (tool nodes).
toolsArray<ToolSource>Tool sources for this node. Overrides agent config tools when set.
subgraph_idstringThe ID of the graph to embed (subgraph nodes).
subgraph_configSubgraphConfigInput/output mapping and iteration limits (subgraph nodes).
supervisor_configSupervisorConfigManaged nodes and iteration limits (supervisor nodes).
approval_configApprovalGateConfigApproval type, review keys, and timeout (approval nodes).
map_reduce_configMapReduceConfigWorker node, items path, concurrency, and error strategy (map nodes).
voting_configVotingConfigVoter agents, aggregation strategy, and quorum (voting nodes).
annealing_configAnnealingConfigSelf-annealing iterative refinement (agent nodes).
swarm_configSwarmConfigSwarm peer delegation (agent nodes).
evolution_configEvolutionConfigPopulation size, fitness evaluation, and selection strategy (evolution nodes).
read_keysArray<string>The keys to read from the state.
write_keysArray<string>The keys to write to the state.
failure_policyFailurePolicyThe failure policy for the node.
requires_compensationbooleanWhether the node requires compensation.
TypeDescription
agentRuns an LLM with tools via streamText. The workhorse of the system.
toolExecutes a specific MCP tool directly, without an LLM.
routerEvaluates a state expression and routes to the matching target node.
supervisorLLM-powered dynamic routing — delegates to managed nodes iteratively.
approvalPauses the workflow for human review. Resumes when approved or rejected.
mapFans out work to parallel workers (one per item).
synthesizerMerges parallel outputs into a single result using an LLM agent.
votingMultiple agents vote on a decision to reach consensus.
subgraphDelegates to a nested graph with isolated state. Input/output mapping between parent and child.
evolutionPopulation-based selection — runs N candidates, scores fitness, breeds next generation.

Nodes declare which state keys they can read and write:

read_keys: ['goal', 'notes'] — the node sees only these keys from state
write_keys: ['draft'] — the node can only write to these keys
read_keys: ['*'] / write_keys: ['*'] — Allow all state access (use sparingly)

This enforces the principle of least privilege — a writer agent can’t read database credentials, and a researcher can’t overwrite the final draft.

Nodes can opt into compensation for rollback support by setting requires_compensation: true. If the workflow fails after a compensatable node completes, the orchestrator executes the compensation_stack in reverse order — unwinding side effects like a database transaction rollback.

Controls retry behaviour when a node fails. Applied per-node.

FieldTypeDefaultDescription
max_retriesnumber3Maximum retry attempts before the node fails permanently.
backoff_strategy'linear' | 'exponential' | 'fixed''exponential'Delay growth between retries.
initial_backoff_msnumber1000Initial delay between retries (ms).
max_backoff_msnumber60000Maximum delay cap (ms).
timeout_msnumberPer-node execution timeout (ms).
circuit_breakerobjectTrip after repeated failures, auto-recover via half-open probes.

Optional. Prevents repeatedly calling a failing external service.

FieldTypeDefaultDescription
enabledbooleanfalseWhether the circuit breaker is active.
failure_thresholdnumber5Consecutive failures before the circuit opens.
success_thresholdnumber2Consecutive successes to close the circuit.
timeout_msnumber60000Half-open probe timeout (ms).

Each node type has an optional config block that controls its behaviour. These are set as top-level fields on the node object (e.g. supervisor_config, subgraph_config).

Used by supervisor nodes. The supervisor LLM dynamically routes work between managed sub-nodes until a completion condition is met or the iteration limit is reached.

FieldTypeDefaultDescription
agent_idstringAgent ID for the routing LLM. Falls back to node.agent_id if omitted.
managed_nodesstring[]requiredNode IDs this supervisor can delegate to.
max_iterationsnumber10Max routing iterations before forced completion (loop guard).
completion_conditionstringJSONPath expression that, when truthy, signals completion.

Used by subgraph nodes. Executes an entire nested workflow as a single step, with isolated state and explicit memory mapping.

FieldTypeDefaultDescription
subgraph_idstringrequiredID of the graph to embed (loaded via loadGraphFn).
input_mappingRecord<string, string>{}Maps parent memory keys → child memory keys.
output_mappingRecord<string, string>{}Maps child memory keys → parent memory keys.
max_iterationsnumber50Iteration cap for the child workflow.

The child gets a fresh, isolated WorkflowState. Only mapped keys cross the boundary. The child inherits the parent’s remaining token budget. A _subgraph_stack prevents cyclic nesting (e.g. A → B → A throws immediately).

Used by approval nodes. Pauses execution until a human reviewer approves or rejects.

FieldTypeDefaultDescription
approval_type'human_review''human_review'Type of approval required.
prompt_messagestring'Please review and approve this workflow step.'Message shown to the reviewer.
review_keysstring[]['*']Memory keys the reviewer should see.
timeout_msnumber86400000 (24h)Timeout before auto-rejection.
rejection_node_idstringNode to route to on rejection. If unset, the workflow fails.

Used by map nodes. Fans out work to parallel workers, then optionally fans in via a synthesizer.

FieldTypeDefaultDescription
worker_node_idstringrequiredNode ID of the worker to fan out to.
items_pathstringJSONPath to extract the items array from memory.
static_itemsunknown[]Static items array (alternative to items_path).
synthesizer_node_idstringNode ID of the synthesizer to fan results into.
error_strategy'fail_fast' | 'best_effort''best_effort'How to handle worker errors.
max_concurrencynumber5Maximum concurrent workers.

Used by voting nodes. Multiple agents vote independently and a strategy aggregates the results.

FieldTypeDefaultDescription
voter_agent_idsstring[]requiredAgent IDs that will vote (min 1).
strategy'majority_vote' | 'weighted_vote' | 'llm_judge''majority_vote'Aggregation strategy.
vote_keystring'vote'Memory key where each voter writes their vote.
quorumnumberMinimum votes required for a valid result.
judge_agent_idstringAgent ID for the llm_judge strategy.
weightsRecord<string, number>Per-agent weights for weighted_vote.

Used by agent nodes for iterative self-refinement. Progressively lowers the LLM temperature and re-evaluates until a quality threshold is met.

FieldTypeDefaultDescription
evaluator_agent_idstringAgent ID for the evaluator. Falls back to score_path extraction.
score_pathstring'$.score'JSONPath to extract a numeric score from agent output.
thresholdnumber0.8Quality threshold (0–1) to stop iteration.
max_iterationsnumber5Maximum annealing iterations.
initial_temperaturenumber1.0Starting LLM temperature.
final_temperaturenumber0.2Ending temperature (converges toward this).
diminishing_returns_deltanumber0.02Stop if score improvement is less than this delta.

Used by agent nodes in swarm mode. Peer agents hand off work to each other until the task is complete.

FieldTypeDefaultDescription
peer_nodesstring[]requiredNode IDs of peer agents in the swarm.
max_handoffsnumber10Maximum handoffs before forcing completion.
handoff_mode'agent_choice''agent_choice'How peers are selected for handoff.

Used by evolution nodes. Population-based optimization — generates N candidates, scores fitness, selects the best, and breeds the next generation.

FieldTypeDefaultDescription
population_sizenumber5Number of candidates per generation (min 2).
candidate_agent_idstringrequiredAgent that generates candidate solutions.
evaluator_agent_idstringrequiredAgent that scores fitness.
selection_strategy'rank' | 'tournament' | 'roulette''rank'How parents are selected.
elite_countnumber1Top candidates preserved unchanged across generations.
max_generationsnumber10Maximum number of generations.
fitness_thresholdnumber0.9Fitness score (0–1) for early exit.
stagnation_generationsnumber3Stop if no improvement for this many generations.
initial_temperaturenumber1.0Starting temperature (diversity).
final_temperaturenumber0.3Ending temperature (exploitation).
tournament_sizenumber3Tournament size for tournament strategy.
max_concurrencynumber5Max concurrent candidate evaluations.
error_strategy'fail_fast' | 'best_effort''best_effort'How to handle candidate generation errors.
evaluation_criteriastringCustom instruction passed to the fitness evaluator.