Feat: implement AI-driven ReAct agent#27
Merged
Conversation
…ery execution routes
…pport - Add max_iterations field to QueryPrompt schema (default 3, hard cap 10) - Pass max_iterations through route -> run_query_generator -> AgentState - Enforce hard limit via min(user_value, 10) in should_continue() - Extend GENERATE_PROMPT to allow aggregate() pipelines as a tool - Add maxIterations slider (1-10) above Generate button in UI with info tooltip - Forward maxIterations from frontend to backend via API call - Update geminiService.test.ts to satisfy new 2-arg minimum signature
Fix 1 - Add auth guard to /query/evaluate-write (OBO token + Bearer check) Fix 2 - Cap evaluate_write_service tool-call loop at MAX_TOOL_ROUNDS=5 Fix 3 - Replace write-method substring heuristic with AST parsing in agent service Fix 4 - Move inline imports to file-level in query.py Fix 5 - Add Pydantic Field(ge=1, le=10) server-side cap on max_iterations Fix 6 - Improve connection_string error logs with account ID context Fix 7 - Replace fragile regex collection extraction with AST-based helper Update tests: fix evaluate_write auth header + exchange_token_obo mock, fix log_write_operation patch path to routes.query.* after import hoisting
|
🎉 This PR is included in version 2.9.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
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.
This pull request introduces a powerful, self-correcting ReAct (Reasoning and Acting) agent to the Query Generator page. By leveraging
langgraph, this agent autonomously generates, executes, and evaluates MongoDB queries in a sandbox, significantly improving the accuracy and reliability of AI-generated queries.Key Features & Changes
1. LangGraph ReAct Agent Integration
react_agent_serviceutilizing a cyclic state graph (langgraph). The agent iteratively transitions betweengenerate_query,execute_query_in_sandbox, andevaluate_querynodes until a valid, accurate query is produced.2. Gated Write Operations & Safety
evaluate_write_servicecan verify the result of the manual execution against the user's initial intent.3. Secure Write Audit Logging
/query/executeendpoint.write_audit_logPostgreSQL table, ensuring audit parity with the Data Explorer.