#1644·adk-go

agenttool: child state updates do not reach the parent session

Author: ktsoatorCreated Sep 25, 2026Updated Sep 25, 2026
Labelsbug

Describe the Bug

An agent called through agenttool can read the parent's state, but its state updates do not reach the parent. I reproduced this with both OutputKey and a callback calling ctx.State().Set(...).

Steps to Reproduce

  1. Give the child agent an OutputKey of child_result.
  2. Call it through agenttool and let it return "done".
  3. Read child_result from the parent tool context.

Expected Behavior

The child's state delta reaches the parent, as in Python's AgentTool.

Observed Behavior

The tool returns {"result": "done"}, but child_result is missing from the parent's state and event StateDelta.

The Go event loop reads child events without forwarding their state deltas. Is this isolation intentional in Go, or should these updates be forwarded?

Environment Details

  • ADK: main at 0a1ae8b
  • OS: macOS, arm64
  • Go: 1.26.6

Model Information

testutil.MockModel; no live model or credentials needed.

Minimal Reproduction Code

Append this test to tool/agenttool/agent_tool_test.go. It uses the existing imports and createToolContext helper.

go
func TestAgentToolPropagatesOutputKey(t *testing.T) {
	child, err := llmagent.New(llmagent.Config{
		Name:      "child",
		OutputKey: "child_result",
		Model: &testutil.MockModel{Responses: []*genai.Content{
			genai.NewContentFromText("done", "model"),
		}},
	})
	if err != nil {
		t.Fatal(err)
	}
	ctx := createToolContext(t, child)
	wrapped := agenttool.New(child, nil).(toolinternal.FunctionTool)
	result, err := wrapped.Run(ctx, map[string]any{"request": "run"})
	if err != nil {
		t.Fatal(err)
	}
	if result["result"] != "done" {
		t.Fatal("child did not return its result")
	}
	value, err := ctx.State().Get("child_result")
	if err != nil || value != "done" {
		t.Fatal("child completed, but child_result is missing from parent state")
	}
}

Run:

bash
go test -race ./tool/agenttool -run '^TestAgentToolPropagatesOutputKey$' -count=1

The test fails with child completed, but child_result is missing from parent state.