Skip to content

fix(agent): preserve max rounds semantics in Go - #8

Merged
ethan7zhanghx merged 1 commit into
feat/querit-search-toolfrom
agent/fix-go-agent-max-rounds-parity
Jul 29, 2026
Merged

ethan7zhanghx merged 1 commit into
feat/querit-search-toolfrom
agent/fix-go-agent-max-rounds-parity

Conversation

@ethan7zhanghx

Copy link
Copy Markdown

Summary

Align the Go Agent max_rounds behavior with the Python implementation so a configured tool round can execute the tool and still produce a final model answer.

Root cause

Python executes range(max_rounds + 1): with max_rounds=1, the model can request one tool call, consume its result, and make a second model call for the final answer.

The Go implementation passed max_rounds directly to Eino MaxStep. Eino counts both model and tool graph nodes, so MaxStep=1 stopped after the initial model tool call without executing the tool or returning final content.

Fix

  • convert Python rounds to Eino graph steps with 2*max_rounds + 1
  • document the model → tool → final-model step mapping
  • add mapping regression coverage
  • add a behavioral regression test proving max_rounds=1 executes one tool and a second model turn receives the tool result

Validation

  • gofmt
  • git diff --check
  • ./build.sh --test ./internal/agent/component/...
  • rebuilt ragflow_server and the Go E2E image
  • Go /health: HTTP 200
  • live UI Agent E2E with unchanged max_rounds=1:
    • before fix: DeepSeek emitted querit_search, but no tool result/final UI answer
    • after fix: Querit executed and DeepSeek returned two OpenAI source links in the UI

Evidence

  • 009-go-agent-max-rounds-bug-no-response.png
  • 014-go-agent-querit-final-answer-pass.png
  • PR08-LIVE-E2E.log

No credentials are included in the evidence.

@ethan7zhanghx
ethan7zhanghx merged commit c4ac6f5 into feat/querit-search-tool Jul 29, 2026
ethan7zhanghx added a commit that referenced this pull request Jul 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant