feat: add assertions schema to EvalCriteria for code-based grading - #4088
Open
melmennaoui wants to merge 1 commit into
Open
feat: add assertions schema to EvalCriteria for code-based grading#4088melmennaoui wants to merge 1 commit into
melmennaoui wants to merge 1 commit into
Conversation
Add code-based assertion support to the evaluation criteria schema: - Assertion struct (Name, Type, Value) for declarative grading checks supporting types: contains, not_contains, equals, starts_with, ends_with, regex, cost_threshold, tool_called - Verify field on EvalCriteria for post-agent shell script verification - AssertionsCheck and VerifyCheck types on EvalResultChecks - AssertionResult type for per-assertion outcomes - Deep-clone support in cloneEvalCriteria and cloneEvalResultChecks - Tests for JSON unmarshaling of the new fields Closes #4082
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.
Summary
Add code-based assertion support to the evaluation criteria schema, enabling declarative grading checks that run against agent output without requiring an LLM judge.
Changes
pkg/session/session.goAssertionstruct —Name,Type,Valuefields for declarative checks. Supported types:contains,not_contains,equals,starts_with,ends_with,regex,cost_threshold,tool_called.Assertionsfield onEvalCriteria— optional list of code-based assertions.Verifyfield onEvalCriteria— optional shell script for post-agent outcome verification.AssertionsCheck— result type with passed/total counts and per-assertion results.AssertionResult— individual assertion outcome (name, type, passed, reason).VerifyCheck— verify script result (passed, exit_code, output).EvalResultChecks.pkg/session/branch.gocloneEvalCriteriato deep-clone theAssertionsslice.cloneEvalResultChecksto deep-cloneAssertionsCheckandVerifyCheck.pkg/session/session_test.goExample eval JSON
{ "evals": { "relevance": ["The agent created the file"], "assertions": [ {"name": "mentions file", "type": "contains", "value": "hello.txt"}, {"name": "used write tool", "type": "tool_called", "value": "write_file"}, {"name": "cost under budget", "type": "cost_threshold", "value": "0.50"} ], "verify": "test -f /workspace/hello.txt" } }Closes #4082