GeezerVison is showing adk.dev — FunctionNode | ADK for TypeScript: API Reference - v2.5.0
Class FunctionNode<TInput, TOutput>
A node that wraps a plain function, async function, or (sync/async) generator.
Ported (TS-idiomatic subset) from google/adk-python _function_node.py.
Return-value handling:
Event → emitted as-is (output validated against outputSchema)
- genai
Content → emitted as the event content
null/undefined → skipped (unless there are pending state deltas)
- anything else → emitted as
Event(output=value)
State written via ctx.state during execution is attached to emitted events.
Type Parameters
- TInput = unknown
- TOutput = unknown
Constructors
constructor
-
Type Parameters
- TInput = unknown
- TOutput = unknown
Properties
Readonly[BASE_NODE_SIGNATURE_SYMBOL]
"[BASE_NODE_SIGNATURE_SYMBOL]": true
Brand identifying this object as a BaseNode (see isBaseNode).
Optional ReadonlyauthConfig
Readonlydescription
description: string
Optional ReadonlyinputSchema
Optional ReadonlyisolationScope
isolationScope?: string | true
Readonlyname
name: string
Optional ReadonlyoutputSchema
Optional ReadonlypreparedRetryConfig
The retry config with its exception filter normalized once, up front (see
prepareRetryConfig). Used by the node runner so the retry hot path
never re-normalizes or throws on a malformed config mid-retry.
ReadonlyrerunOnResume
rerunOnResume: boolean
Optional ReadonlyretryConfig
Optional ReadonlystateSchema
Optional Readonlytimeout
timeout?: number
ReadonlywaitForOutput
waitForOutput: boolean
Accessors
Methods
run
-
Runs the node, normalizing every yielded item into an Event. This
is what the engine (and ctx.runNode()) consumes. Validates the input
against inputSchema once, up front (skipping genai Content, which nodes
coerce themselves).
Returns AsyncGenerator<Event, void, void>
ProtectedrunImpl
-
Core execution contract. Subclasses yield one of:
- an Event (emitted as-is),
- a raw value (boxed into an event whose
output is that value),
null/undefined (skipped).
Returns AsyncGenerator<unknown, void, void>
ProtectedtoEvent
-
Normalizes a single yielded item into an Event (or null to skip).
Subclasses may override for richer coercion (e.g. FunctionNode).
Returns Event | null
ProtectedvalidateInput
-
Validates node input against inputSchema (Content passes through). Only
enforced for Zod schemas; a genai Schema is left unvalidated (see
parseWithSchema).
ProtectedvalidateOutput
-
validateOutput(output: unknown): unknown
Validates node output against outputSchema (Content passes through). Only
enforced for Zod schemas; a genai Schema is left unvalidated (see
parseWithSchema).
Returns unknown
Constructors
Properties
Accessors
Methods
|