---
title: "Node Types in ADK Workflows: FunctionNode, LlmAgent, and ToolNode Auto-Wrapping"
date: "2026-11-30T11:02:02+07:00"
description: "How ADK coerces callables, agents, and tools into graph nodes: FunctionNode, LlmAgent cloning, and automatic tool wrapping explained with the rules."
author: "AI Assistant"
image: "https://blog.redlinesoft.net/images/post/adk-workflow-node-types-functionnode-toolnode.jpg"
alt: "Conversion diagram showing a Python function, an LlmAgent, and an ADK tool each wrapped as a graph node"
tags: ['google-adk', 'graph-workflows', 'functionnode', 'tools', 'python']
---

You can write an ADK graph without ever naming a node class: drop a Python function, an `Agent`, and a tool into an `edges` list, and the workflow runs. Then the first time something misbehaves — a tool node that ignores your `require_confirmation`, an agent that answers chat-style when you expected a single turn, a `WorkflowConfigurationError` naming a type you never imported — you need to know what your object was *coerced into*.

Under the hood ADK applies a fixed set of wrapping rules to every item in an edge row. This post walks those rules: the callable → `FunctionNode` path, the `LlmAgent` → agent-node path, and the tool → tool-node path, plus the `@node` decorator you use to override the result.

```python
from google.adk import Agent, Workflow, Event
from google.adk.workflow import FunctionNode, node
```

## 1. NodeLike: What the Engine Accepts

Every element of an edge row is checked against one predicate — *is it "node-like?"* — and satisfied by any of these:

- a `BaseNode` (including `FunctionNode`, `JoinNode`, and `Workflow` itself),
- a `BaseAgent` such as an `Agent` / `LlmAgent`,
- a `BaseTool` such as a `FunctionTool`,
- any callable,
- the string `"START"` (the entrypoint sentinel).

The conversion happens once, when the `Workflow` is built. A tool becomes a node, a function becomes a node, an agent is cloned into a node — and only after that does the graph engine see a uniform world of `BaseNode` instances:

```
   edge row item                 built node
  ─────────────────────────────────────────────────────
   "START"                   →  START sentinel (never runs)
   def f(...)                →  FunctionNode(func=f)
   Agent(...) / LlmAgent     →  cloned LlmAgent (node)
   FunctionTool(...) / tool  →  internal tool node
   Workflow(...)             →  the workflow, as a node
   BaseNode instance         →  returned as-is (+ overrides)
```

Anything else raises `WorkflowConfigurationError` with the message "Node must be a BaseNode, a BaseAgent, a BaseTool, or a callable."

## 2. FunctionNode: Your Code as a Node

A plain `def` or `async def` in an edge row becomes a `FunctionNode`. This is the workhorse node for deterministic steps.

```python
def lookup_time_function(node_input: str):
    """Simulate returning the current time in the specified city."""
    return CityTime(time_info="10:10 AM", city=node_input)
```

What `FunctionNode` gives you:

- **Return-value binding.** Return a bare value and it is wrapped as the node's `output`. Return or `yield` an `Event` when you need to control routing or emit a user-facing message alongside it.
- **Schema inference.** The node fills its `input_schema` and `output_schema` from the wrapped function's type hints. A `-> dict` return and a `node_input: Triage` parameter become validated boundaries without you writing schema code.
- **Per-node policy.** `retry_config`, `timeout`, `auth_config`, `require_confirmation`, and `rerun_on_resume` are all attachable when the node is built.
- **Parameter binding modes.** By default parameters bind from state (`parameter_binding='state'`); `parameter_binding='node_input'` binds them from the incoming node input instead and infers schemas from the signature — the mode used when a node acts as an agent's tool.

Two emit rules are enforced at runtime: only one event per execution may carry `output` (later ones silently overwrite it), and `Event(route=...)` is independent of `output`, so a router node forwards its payload and picks its branch in the same event.

```python
from google.adk import Event

def router(node_input: str):
    return Event(route="RUN_TASK_C", output=node_input)
```

One trap: `require_confirmation=True` on a `FunctionNode` requires `rerun_on_resume=True`. The node *must* re-run after the user answers the confirmation prompt — a node that skips re-running would never execute the confirmed action. ADK raises `WorkflowConfigurationError` if you explicitly set `rerun_on_resume=False` in that combination.

## 3. LlmAgent as a Node

Agents are already nodes, but they are never used raw. When an `LlmAgent` appears in an edge row, ADK **clones** it into the graph with node-level defaults applied:

- **Mode defaulting.** If the agent has no `mode` and no parent agent, it defaults to `single_turn` — it receives the predecessor's output, makes its model call, and returns. An agent attached under a parent defaults to `chat` instead, preserving agent-transfer behavior. A `chat`-mode agent is only legal directly after `START`, because it consumes conversational history rather than a node input.
- **`include_contents='none'`.** For a standalone `single_turn` agent node (unless you set `include_contents` explicitly), conversation history is stripped. The node sees *only* its node input — the strict data context that keeps graph prompts small.
- **`rerun_on_resume=True`.** Agent nodes default to re-running after an interrupt, because an agent that paused mid-turn needs to resume its work rather than accept the human's reply as its output.
- **Schema delivery.** `input_schema` validates what arrives from the predecessor; `output_schema` constrains the model's reply to a shape (a Pydantic `BaseModel`) that the next node receives as typed data.

```python
from pydantic import BaseModel

class CityTime(BaseModel):
    time_info: str
    city: str

city_report_agent = Agent(
    name="city_report_agent",
    model="gemini-flash-latest",
    input_schema=CityTime,
    instruction=(
        "You receive a CityTime with time_info and city fields. "
        "Reply with a single sentence stating it is that time there now."
    ),
)
```

Note the distinction the docs make: on a plain agent, `input_schema` governs the agent when it is exposed as a tool; **inside a graph**, set the schema that validates a node's input on the node itself (in TypeScript, `node(agent, {inputSchema})`; in Python, on the agent/node it is attached to). And remember that `{key}` placeholders in an `instruction` are substituted from *session state*, not from the node input — fields of the input object are addressed by name through the schema.

A special case worth knowing: `parallel_worker=True` on an agent node wraps it in ADK's parallel-worker node, running the agent once per item of a list input, with `max_parallel_workers` capping concurrency.

## 4. Tool Auto-Wrapping: BaseTool → Tool Node

Drop an ADK tool straight into an edge row and it is wrapped in an internal **tool node** (the class is `_ToolNode` in `google.adk.workflow._tool_node` — private, and you never construct it yourself). The wrapper does real work, which is why tools behave differently from function nodes:

```python
from google.adk.tools import FunctionTool

def refund(amount: float) -> dict:
    """Refunds an order."""
    return {"refunded": amount}

root_agent = Workflow(
    name="refund_workflow",
    edges=[("START", refund, summarize)],
)
```

What the tool node handles for you:

- **Argument coercion.** The incoming node input is coerced into the tool's declared arguments: a `Content` object is reduced to its text, a Pydantic model is dumped, a JSON string is parsed, and — when the tool declares exactly one parameter (or one required parameter) — a bare scalar is wrapped into `{param: value}`. Anything else must be a dict, or you get `TypeError: The input to ToolNode must be a dictionary of tool arguments or None`. Missing required parameters fall back to `ctx.state` by name.
- **Confirmation and auth gates.** A tool that requests confirmation (via `require_confirmation` on a `FunctionTool`, or `tool_context.request_confirmation()` inside the body) pauses the workflow and yields a `RequestInput`; on resume the node **re-runs** with the answer in `ctx.tool_confirmation`. That is why tool nodes default to `rerun_on_resume=True`. Credential requests go through the same interrupt path.
- **Plugin callbacks.** The wrapper runs the same `before_tool` → confirmation gate → `run_async` → `after_tool` pipeline (plus `on_tool_error`) that an `LlmAgent`'s tool pipeline runs. No agent owns a tool node, so *agent-level* tool callbacks do not apply.
- **Output as the next input.** A non-`None` tool result is emitted as `Event(output=response)`; state and artifact deltas the tool recorded on `ctx.actions` are attached to the emitted event.

One unpacking rule to remember: if the tool is a `NodeTool` (a tool that *is* a node in disguise), the wrapper unwraps it and returns the underlying native node directly instead of double-wrapping.

Also note what is *not* allowed: `require_confirmation` on the edge is only supported for function nodes and callables — passing it for a tool node raises `WorkflowConfigurationError`.

## 5. The `@node` Decorator: The Override Layer

`node(...)` is the single entry point for coercion *and* customization. As a decorator it wraps a function; as a function it wraps any node-like value, applying overrides:

```python
from google.adk.workflow import RetryConfig, node

@node(name="fetch_orders", timeout=10.0,
      retry_config=RetryConfig(max_attempts=3))
def fetch_orders(node_input: str) -> dict:
    return {"orders": lookup_orders(node_input)}

# Same coercion, applied to an existing agent:
research_node = node(research_agent, name="deep_research", rerun_on_resume=True)
```

Supported overrides: `name`, `rerun_on_resume`, `retry_config`, `timeout`, `auth_config`, `require_confirmation`, `parameter_binding`, and `parallel_worker` / `max_parallel_workers` (the latter pair only valid together).

The name override matters more than it looks: node names must be valid Python identifiers, must be unique in the graph, and are the keys used by join records, traces, and the audit trail.

## 6. Choosing the Right Node Type

| You have | Becomes | Use it when |
|---|---|---|
| `def` / `async def` | `FunctionNode` | Deterministic logic, transforms, routing decisions |
| `Agent` / `LlmAgent` | Cloned agent node (`single_turn` default) | The step genuinely needs reasoning |
| `FunctionTool` / `BaseTool` | Internal tool node | Calling an existing ADK tool as a first-class step |
| `Workflow` | Nested workflow node | A reusable sub-process with one terminal output |
| `JoinNode` | Fan-in barrier | Converging parallel branches |

A quick decision rule: if a model adds nothing to the step, it is a `FunctionNode`; if the step is an existing tool with confirmation/auth needs, hand over the tool and let the wrapper handle it; if the step needs judgment, use an agent — and keep it `single_turn`.

## 7. Checklist

- [ ] Every edge item is a `BaseNode`, agent, tool, or callable — anything else fails at build time.
- [ ] Function nodes get type hints on parameters and return values so schemas are inferred.
- [ ] `require_confirmation` is only attached to function/callable nodes, and it forces `rerun_on_resume=True`.
- [ ] Agent nodes rely on the `single_turn` default; only a `chat`-mode agent sits directly after `START`.
- [ ] Tool inputs arrive as dicts (or a single-parameter scalar) matching the tool's declaration.
- [ ] `@node(...)` is used for name overrides, retries, and timeouts — names double as trace keys.
- [ ] Anything needing runtime-shaped control flow (recursion, unbounded fan-out) leaves the static graph for a dynamic workflow.

## References

- https://adk.dev/graphs/
- https://adk.dev/graphs/routes/
- https://adk.dev/graphs/data-handling/
- https://adk.dev/graphs/retry/
- https://github.com/google/adk-python
