Skip to content

improve react module#27

Merged
assagman merged 2 commits intomainfrom
improve/react-module
Dec 19, 2025
Merged

improve react module#27
assagman merged 2 commits intomainfrom
improve/react-module

Conversation

@assagman
Copy link
Owner

  • Reworked ReAct loop to use a bounded trajectory renderer + context-overflow retry (internal/module/react.go, internal/module/react_trajectory.go, internal/module/react_context.go)
  • Encoded tool observations as size-bounded JSON envelopes with deterministic truncation + stable hashes (internal/module/react_tool_result.go)
  • Added termination policies (repeated tool calls, stagnation, repeated errors) and captured final candidates (internal/module/react_termination.go)
  • Added extractor fallback to synthesize signature-valid outputs when loop can’t (structured-mode supported) (internal/module/react.go:239-260, :702-829)
  • Added Prediction.Metadata and helpers; ReAct now records iterations/termination/extraction diagnostics there (internal/core/prediction.go, internal/module/react.go:239-260)
  • Ensured Program deep-copies prediction diagnostics + metadata (internal/module/program.go:723-755)
  • Expanded ReAct test coverage for truncation, termination, overflow recovery, extraction, implicit finish (internal/module/react_test.go)
  • Updated docs to describe ReAct guarantees, bounded trajectories, and termination behavior (QUICKSTART.md, ARCHITECTURE.md, REFERENCE.md)

Refactor ReAct around a trajectory/termination model to keep tool results and
prompt size bounded, detect context overflow, and fall back to a post-loop
extractor when the loop can’t produce signature-valid outputs. Add flexible
Prediction.Metadata for iteration counts/termination diagnostics and update
docs/examples to describe the new guarantees and tuning knobs.

Signed-off-by: assagman <ahmetsercansagman@gmail.com>
Signed-off-by: assagman <ahmetsercansagman@gmail.com>
@assagman assagman self-assigned this Dec 19, 2025
@assagman assagman added bug Something isn't working enhancement New feature or request labels Dec 19, 2025
@assagman assagman merged commit 512ee05 into main Dec 19, 2025
4 checks passed
@assagman assagman deleted the improve/react-module branch December 19, 2025 08:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant