[ADK] observability callback reports empty input for Chain/Lambda nodes (reactRunInput unexported fields dropped by json.Marshal)
Problem
When using adk.NewChatModelAgent with tools enabled, the observability callback reports an empty {} as the input of the internal Chain node and its Lambda node, while their output is reported correctly. As a result the tracing platform cannot show what was actually fed into these two nodes.
The neighboring nodes in the very same chain (Init, ReAct, ChatModel) report their input correctly, so the trace looks inconsistent:
| observation | type | input (reported) | input Go type |
|---|---|---|---|
| SolvifyDeepAgent | SPAN (Chain) | {} |
reactRunInput |
| Lambda | SPAN | {} |
reactRunInput |
| Init | SPAN | 7547 B | *reactInput |
| ReAct | SPAN | 7547 B | *reactInput |
| ChatModel | GENERATION | 7534 B | []Message |
Root cause
adk/chatmodel.go defines the chain input type with unexported fields:
type reactRunInput struct {
input *AgentInput
instruction string
}The callback serializes observation input/output through the standard library — eino-ext/callbacks/langfuse/v2/handler.go:
serialized, err := json.Marshal(value)encoding/json silently skips unexported fields, so reactRunInput is always marshaled to {}.
The neighboring types do not have this problem precisely because their fields are exported — adk/react.go:
type reactInput struct {
Messages []Message
}Messages is exported, which is why Init / ReAct show a non-empty input in the same trace.
Minimal reproduction
package main
import (
"encoding/json"
"fmt"
)
type AgentInput struct {
Messages []string
}
type reactRunInput struct {
input *AgentInput
instruction string
}
type reactInput struct {
Messages []string
}
func main() {
a, _ := json.Marshal(reactRunInput{
input: &AgentInput{Messages: []string{"hi"}},
instruction: "you are helpful",
})
b, _ := json.Marshal(reactInput{Messages: []string{"hi"}})
fmt.Printf("reactRunInput -> %s (len=%d)\n", a, len(a))
fmt.Printf("reactInput -> %s (len=%d)\n", b, len(b))
}Output:
reactRunInput -> {} (len=2)
reactInput -> {"Messages":["hi"]} (len=23)Environment
github.com/cloudwego/eino v0.9.14github.com/cloudwego/eino-ext/callbacks/langfuse/v2 v2.0.2adk.NewChatModelAgentwithToolsConfigset (i.e.buildMessageReActRunFuncis used)
Suggested fix
Add a MarshalJSON method to reactRunInput. This does not change field visibility, does not touch runtime behavior (the struct is still constructed and read by field name internally), and only affects how the value is serialized by callbacks:
func (r reactRunInput) MarshalJSON() ([]byte, error) {
return json.Marshal(struct {
Input *AgentInput `json:"input"`
Instruction string `json:"instruction"`
}{
Input: r.input,
Instruction: r.instruction,
})
}Related
- #603 — "langfuse 上报的 trace 信息缺失", closed by PR #954 (v2 OTLP callback). Same symptom class, but the behavior is still present on
mainfor these two nodes. - #1006 — same root cause class (unexported fields dropped during serialization), but on the checkpoint path.
Source: cloudwego/eino