feat: GSAR Agent integration — Agent(gsar=GSARConfig(...))#19
Merged
Conversation
feat: GSAR Agent integration — Agent(gsar=GSARConfig(...)) See merge request saas-observ-eng/locus!103
2 tasks
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.
Wires the typed-grounding layer onto the agent loop. After the agent completes, a configured GSAR judge scores the final answer + tool-execution history; verdict surfaces on
AgentResultasgsar_judgment/gsar_score/gsar_decision.Single-pass v1 — promised by
gsar.py's docstring once the layer stabilised (proven 30/30 over 80 prior runs in #18). Full Algorithm-1 outer loop stays available vialocus.reasoning.gsar_evaluator.Usage
Surface
locus.agent.config.GSARConfig— judge, ρ, τ_proceed/τ_regenerate, weight_map, fail_on_low_score.AgentConfig.gsar,Agent(gsar=...)kwarg.AgentResult.gsar_judgment / gsar_score / gsar_decision.Agent._run_gsar_judgment— assembles evidence fromstate.tool_executions, runs judge, recomputes S, returns δ.Robustness
(None, None, None). Agent does not crash.StructuredOutputGSARJudgeover the primary model with a doc note that this is rarely the right production choice.Tests
tests/unit/test_agent_gsar.py(14 tests): config validation, fields stayNonewhen unset, proceed/replan/abstain decisions surface, evidence corpus assembly, judge-exception fallback, ρ override, custom thresholds.tests/integration/test_agent_gsar_live.py(2 tests,OPENAI_API_KEYgated): grounded answer with@tool→ non-replan; ungrounded answer → non-proceed + ≥1 non-grounded claim.Stability proven
30 iterations of the full GSAR live suite (8 evaluator + 2 new agent tests = 10 per run):
Drive-by
test_gsar_recovery_then_proceed_live_cycle: when the live judge accepts a contradicted-claim report on the first iteration, the loop goes straight to proceed without recovery. Now skips with a clear message instead of failing on a vacuously-truthful premise.Validation
hatch run lintclean.Test plan
tests/unit/test_agent_gsar.pycleanly.