-
fix(agent): collect CodeExec artifacts from ReAct tool responses (#16609)
发布于
2026-07-05 12:53:43 +00:00 Summary
The Go backend Agent component was not returning artifacts produced by
the CodeExec tool. While the Python agent collects the "_ARTIFACTS"
envelope from tool responses and appends artifact markdown to the final
content, the Go agent only returned the assistant text, so generated
images were missing from the chat output.Changes
- Wire
react.WithMessageFuture()inrunEinoReActAgentand store the
resultingMessageFuturein the invocation context. - After the ReAct loop finishes, drain the future and extract
_ARTIFACTSentries from every tool response message. - Support reading the tool payload from both
msg.Contentand
msg.UserInputMultiContentto match eino's tool contract. - De-duplicate artifacts by URL and render images as
!and other files
as download links. - Add
agent_artifact_test.gowith a regression test that simulates a
CodeExec-style tool response carrying an image artifact and verifies it
is collected and formatted.
Verification
go test ./internal/agent/component/... -run TestAgent_ReActAgent_CollectsArtifactsFromCodeExecToolpasses.go test ./internal/agent/component/... -count=1compiles; the only
failure is an unrelated DNS-pinning timeout test
(TestInvoke_ProxyDNSPin).gofmtclean for modified files.
Related
Fixes the behavior shown in the screenshot where the Go agent ignored
the CodeExec-generated PNG artifact.下载附件
- Wire