refactor(ai): collapse ReAct into a single reason-act loop - #1533
Open
larry-zy wants to merge 1 commit into
Open
refactor(ai): collapse ReAct into a single reason-act loop#1533larry-zy wants to merge 1 commit into
larry-zy wants to merge 1 commit into
Conversation
Fold the two-stage reasonAct/observe pipeline into one bounded reason-act loop: each iteration is a single model call that either requests tools (results fed back as context) or answers directly — a tool-free response IS the final answer, so no separate observe stage is needed to decide when to stop. The last iteration drops tools and forces a final answer so the loop always terminates. - Remove the orchestrator/state/step/runLoop scaffolding and the fallback handler package; drive the loop directly from run(). - Flatten AgentSpec to a single prompt_file; derive the tool-less answer prompt from the same system prompt plus an answer directive. - Drop the agentObserve.txt prompt; keep agentReasonAct.txt. - Update agent.schema.json, config loader test, e2e test and fixtures to the flat single-stage config.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



What
Collapse the two-stage
reasonAct/observeReAct pipeline into one bounded reason-act loop.Each iteration is a single model call that either requests tools (whose results are fed back as context for the next iteration) or answers directly — a tool-free response is the final answer, so no separate
observereasoning step is needed to decide when to stop. The last allowed iteration drops the tools and forces a final answer, so the loop always terminates with a real reply rather than exhausting its budget in silence.Changes
fallbackhandler package; drive the loop directly fromrun().AgentSpecto a singleprompt_file; derive the tool-less answer prompt from the same system prompt plus an answer directive.agentObserve.txtprompt; keepagentReasonAct.txt.agent.schema.json, the config loader test, the e2e test and fixtures to the flat single-stage config.Scope
Backend only — all changes are under
ai/. No frontend (ui-vue3/) changes.Verification
go build ./...passes.