Repository navigation
Go plugin, callback chain and telemetry option docs are missing #2381
Description
Three extension points in ADK Go v2.5.0 are not documented for Go: the functioncallmodifier plugin, the rule for how a list of callbacks runs, and most of the telemetry package options. The callbacks page explains callback lists for Python only, and Go's stopping rule differs from Python's. The telemetry docs show only WithOtelToCloud, so Go developers who send traces to a backend other than Google Cloud, or who already have an OpenTelemetry setup, have no documented path. Code links below point to ADK Go v2.5.0.
The functioncallmodifier plugin
functioncallmodifier.NewPlugin (and MustNewPlugin) takes a FunctionCallModifierConfig with a Predicate on the tool name, a map of extra argument schemas in Args, and an optional OverrideDescription function. Before each model call, the plugin adds the extra arguments to the declarations of matching tools and can rewrite their descriptions. After the model call, it removes those arguments from the function calls before the tools run and stores each value in session state under <functionCallID>/<argName>.
This lets a Go developer have the model supply metadata for each tool call, such as a reason or a priority, without changing every tool's signature.
This belongs in Prebuilt Plugins, as a Go-only entry.
How a list of callbacks runs in Go
Every Go callback field is a slice, such as agent.Config.BeforeAgentCallbacks or llmagent.Config.BeforeModelCallbacks. ADK runs the callbacks in order and stops at the first one that returns a non-nil result (content, response or tool result) or a non-nil error. That result then replaces the normal step.
Composing independent callbacks, such as logging, guardrails and caching, depends on this rule. It differs from Python, where a before or after callback stops the chain only when it returns a truthy value. In Go, a callback that returns an empty but non-nil *genai.Content ends the chain, where Python would let the next callback run. OnModelErrorCallbacks and OnToolErrorCallbacks have no ordering comment in the source. The Go list form appears in some snippets, but no page states the Go rule.
This belongs next to the Python note on Types of Callbacks. Documented for Python in the note "Python: async callbacks and lists of callbacks" on that page.
Telemetry options
telemetry.New accepts these options beyond the documented WithOtelToCloud: WithSpanProcessors and WithLogRecordProcessors add OpenTelemetry processors, WithTracerProvider and WithLoggerProvider use an existing provider, WithResource sets the OpenTelemetry resource, WithGoogleCredentials passes explicit *google.Credentials, and WithGcpResourceProject and WithGcpQuotaProject set the Google Cloud projects. WithGcpResourceProject appears only in a code comment in the Cloud Trace snippet.
These are how a Go developer exports ADK traces to Jaeger, Langfuse or an OTLP collector, reuses the application's own TracerProvider, or runs without Application Default Credentials.
This belongs in the Go tab of Agent activity logging: GCP export setup, which shows only WithOtelToCloud at line 280, and in Programmatic traces export, which sits on a Go-badged page but has Python examples only.
- Add the
functioncallmodifierplugin to the prebuilt plugins list - Document the Go callback list order and stopping rule, and how it differs from Python
- Document the
telemetryoptions for custom processors, providers, resources, credentials and projects
Activity