adk: ExitTool fails on AgenticMessage graphs (SendToolGenAction looks up *schema.Message state)
Describe the bug
adk.ExitTool (and transfer_to_agent) call SendToolGenAction, which always does:
compose.ProcessState(ctx, func(ctx context.Context, st *State) error {
st.setToolGenAction(key, action)
return nil
})State is typedState[*schema.Message].
NewTypedChatModelAgent[*schema.AgenticMessage] / Deep / Supervisor store typedState[*schema.AgenticMessage] (agenticState) as the compose graph local state.
ExitTool.InvokableRun then fails with:
get state from context fail: cannot find state with type: *adk.typedState[*github.com/cloudwego/eino/schema.Message] in states chain, current state type: *adk.typedState[*github.com/cloudwego/eino/schema.AgenticMessage]The final_result payload is fine. The graph state type is wrong.
The same package already dual-dispatches elsewhere (processTypedState, typedPopToolGenAction[M]). SendToolGenAction was not updated when AgenticMessage graphs were added.
This is still present on v0.9.14, latest release v0.9.20, and current main. Bumping the eino version does not fix it.
To Reproduce
- Create
NewTypedChatModelAgent[*schema.AgenticMessage]withExit: &adk.ExitTool{}. - Have the model emit a function call:
exit/{"final_result":"..."}. - Run the agent.
Minimal shape:
agent, _ := adk.NewTypedChatModelAgent(ctx, &adk.TypedChatModelAgentConfig[*schema.AgenticMessage]{
Name: "AgenticExitAgent",
Model: mockThatCallsExit,
Exit: &adk.ExitTool{},
})
iter := agent.Run(ctx, &adk.TypedAgentInput[*schema.AgenticMessage]{
Messages: []*schema.AgenticMessage{schema.UserAgenticMessage("exit")},
})Expected behavior
SendToolGenAction writes AgentAction into whichever ChatModelAgent graph state is actually in context (*schema.AgenticMessage or *schema.Message). ExitTool returns final_result and the event has Action.Exit == true.
Version:
- github.com/cloudwego/eino v0.9.14 (reproduced)
- also checked v0.9.20 and main:
SendToolGenActionstill only uses*State
Environment:
go1.27.1
darwin/arm64Additional context
Related but not duplicates:
- #1055 Agentic path missing behavior vs Message path (
EmitInternalEvents) - #874 EXIT event from middlewares/callbacks (different API)
transfer_to_agent uses the same SendToolGenAction and has the same type mismatch on AgenticMessage graphs.
zh: ExitTool 在 AgenticMessage 图上会因 SendToolGenAction 只查找 *typedState[*schema.Message] 而失败。Deep/Supervisor 实际状态是 *typedState[*schema.AgenticMessage]。
Source: cloudwego/eino