agentv 5.2.0-next.1 → 5.3.1-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -20
- package/dist/{artifact-writer-SN6UNL5G.js → artifact-writer-7NBCOAYC.js} +4 -4
- package/dist/{chunk-3X357HS4.js → chunk-ASIGJIOJ.js} +107 -31
- package/dist/chunk-ASIGJIOJ.js.map +1 -0
- package/dist/{chunk-3S6A2RKR.js → chunk-ELCJ23K4.js} +18879 -17538
- package/dist/chunk-ELCJ23K4.js.map +1 -0
- package/dist/{chunk-T4AD3H3Y.js → chunk-LKGARI3W.js} +399 -32
- package/dist/chunk-LKGARI3W.js.map +1 -0
- package/dist/{chunk-ALVZQUZP.js → chunk-LXBI3SPX.js} +142 -14
- package/dist/chunk-LXBI3SPX.js.map +1 -0
- package/dist/{chunk-46K2OET3.js → chunk-RKE7SSET.js} +2 -2
- package/dist/cli.js +5 -5
- package/dist/dashboard/assets/{index-DNgf3qJ2.js → index-CbEMiJSb.js} +1 -1
- package/dist/dashboard/assets/{index-r_jSJmlw.js → index-DTA6-l7q.js} +3 -3
- package/dist/dashboard/index.html +1 -1
- package/dist/{dist-DEPJOMCA.js → dist-NMXMI5SK.js} +25 -5
- package/dist/index.js +5 -5
- package/dist/{interactive-36ZNMQB2.js → interactive-BN527UV3.js} +5 -5
- package/dist/skills/agentv-bench/SKILL.md +15 -14
- package/dist/skills/agentv-bench/agents/analyzer.md +2 -2
- package/dist/skills/agentv-bench/agents/comparator.md +3 -3
- package/dist/skills/agentv-bench/agents/executor.md +1 -1
- package/dist/skills/agentv-bench/agents/grader.md +4 -2
- package/dist/skills/agentv-bench/references/autoresearch.md +9 -9
- package/dist/skills/agentv-bench/references/description-optimization.md +5 -6
- package/dist/skills/agentv-bench/references/environment-adaptation.md +6 -6
- package/dist/skills/agentv-bench/references/eval-yaml-spec.md +50 -56
- package/dist/skills/agentv-bench/references/schemas.md +44 -60
- package/dist/skills/agentv-bench/references/subagent-pipeline.md +20 -18
- package/dist/skills/agentv-eval-migrations/SKILL.md +13 -0
- package/dist/skills/agentv-eval-migrations/references/breaking-changes.md +138 -22
- package/dist/skills/agentv-eval-writer/SKILL.md +103 -63
- package/dist/skills/agentv-eval-writer/references/custom-evaluators.md +10 -5
- package/dist/skills/agentv-eval-writer/references/eval.schema.json +749 -2158
- package/dist/skills/agentv-eval-writer/references/rubric-evaluator.md +1 -1
- package/dist/{ts-eval-loader-OMG2JBHP-OP5RR7A3.js → ts-eval-loader-2RFVZHCT-7CZ3DCDD.js} +8 -4
- package/package.json +1 -1
- package/dist/chunk-3S6A2RKR.js.map +0 -1
- package/dist/chunk-3X357HS4.js.map +0 -1
- package/dist/chunk-ALVZQUZP.js.map +0 -1
- package/dist/chunk-T4AD3H3Y.js.map +0 -1
- /package/dist/{artifact-writer-SN6UNL5G.js.map → artifact-writer-7NBCOAYC.js.map} +0 -0
- /package/dist/{chunk-46K2OET3.js.map → chunk-RKE7SSET.js.map} +0 -0
- /package/dist/{dist-DEPJOMCA.js.map → dist-NMXMI5SK.js.map} +0 -0
- /package/dist/{interactive-36ZNMQB2.js.map → interactive-BN527UV3.js.map} +0 -0
- /package/dist/{ts-eval-loader-OMG2JBHP-OP5RR7A3.js.map → ts-eval-loader-2RFVZHCT-7CZ3DCDD.js.map} +0 -0
|
@@ -40,7 +40,7 @@ Use `@agentv/sdk` for TypeScript helper imports. Do not use `@agentv/eval` for n
|
|
|
40
40
|
|
|
41
41
|
- Put grading criteria in `assert`, not in test-level `criteria`. Plain assertion strings become an `llm-rubric` grader.
|
|
42
42
|
- Prefer plain assertion strings for semantic checks when the default rubric grader can judge them. Use `type: llm-rubric` for structured criteria, custom prompts, custom grader targets, or assertion-level transforms, and `type: script` when grading must execute code.
|
|
43
|
-
-
|
|
43
|
+
- Put reference answers in `tests[].vars.expected_output` or `default_test.vars.expected_output`, and consume them with an explicit assertion such as `type: llm-rubric` with `value: "Matches the reference answer: {{ expected_output }}"`. Do not write criteria, scoring instructions, or "the agent should..." rubric prose as the reference answer.
|
|
44
44
|
- For historical or repo-state evals, materialize the repo through a pinned `environment` setup recipe. Mentioning a SHA only in prompt prose is not enough because the agent needs an actual checkout to inspect.
|
|
45
45
|
|
|
46
46
|
## Evaluation Types
|
|
@@ -61,7 +61,12 @@ agentv convert evals.json
|
|
|
61
61
|
agentv eval evals.json
|
|
62
62
|
```
|
|
63
63
|
|
|
64
|
-
The converter maps
|
|
64
|
+
The converter maps Agent Skills prompt text into AgentV prompt/vars data,
|
|
65
|
+
promotes Agent Skills `expected_output` into explicit `llm-rubric` criteria or
|
|
66
|
+
`vars.expected_output` when it is true reference data, and maps Agent Skills
|
|
67
|
+
`assertions` to AgentV `assert` (`llm-rubric` checks). The generated YAML
|
|
68
|
+
includes TODO comments for AgentV features to add (environment setup, script
|
|
69
|
+
graders, rubrics, required gates).
|
|
65
70
|
|
|
66
71
|
After converting, enhance the YAML with AgentV-specific capabilities shown below.
|
|
67
72
|
|
|
@@ -103,12 +108,15 @@ prompts:
|
|
|
103
108
|
|
|
104
109
|
tests:
|
|
105
110
|
- id: multi-turn-context
|
|
106
|
-
|
|
111
|
+
vars:
|
|
112
|
+
expected_output: "Your name is Alice."
|
|
107
113
|
assert:
|
|
114
|
+
- type: llm-rubric
|
|
115
|
+
value: "Matches the reference answer: {{ expected_output }}"
|
|
108
116
|
- Correctly recalls the user's name from earlier in the conversation
|
|
109
117
|
```
|
|
110
118
|
|
|
111
|
-
**Guidelines:** preserve exact wording in `expected_output`; aim for 5–15 tests per transcript; pick exchanges that test different capabilities.
|
|
119
|
+
**Guidelines:** preserve exact wording in `vars.expected_output`; aim for 5–15 tests per transcript; pick exchanges that test different capabilities.
|
|
112
120
|
|
|
113
121
|
## Quick Start
|
|
114
122
|
|
|
@@ -123,8 +131,10 @@ tests:
|
|
|
123
131
|
- id: greeting
|
|
124
132
|
vars:
|
|
125
133
|
prompt: "Say hello"
|
|
126
|
-
|
|
134
|
+
expected_output: "Hello! How can I help you?"
|
|
127
135
|
assert:
|
|
136
|
+
- type: llm-rubric
|
|
137
|
+
value: "Matches the reference answer: {{ expected_output }}"
|
|
128
138
|
- Greeting is friendly and warm
|
|
129
139
|
- Offers to help
|
|
130
140
|
```
|
|
@@ -140,7 +150,7 @@ tests:
|
|
|
140
150
|
|-------|----------|-------------|
|
|
141
151
|
| `id` | yes | Unique identifier |
|
|
142
152
|
| `vars` | yes when the prompt needs row data | Prompt-template variables for this row |
|
|
143
|
-
| `expected_output` | no |
|
|
153
|
+
| `vars.expected_output` | no | Conventional reference-answer var consumed by explicit graders |
|
|
144
154
|
| `assert` | yes | Graders: deterministic checks, `llm-rubric` checks, script graders, or plain string rubric criteria |
|
|
145
155
|
| `execution` | no | Per-case grader/default overrides such as `skip_defaults`; target selection belongs in top-level `target` or CLI `--target` |
|
|
146
156
|
| `environment` | no | Per-case coding-agent testbed config (overrides suite-level) |
|
|
@@ -153,7 +163,7 @@ Use top-level `prompts` plus `tests[].vars` for the Promptfoo-compatible canonic
|
|
|
153
163
|
input shape. Shared data defaults belong in `default_test.vars`; per-test
|
|
154
164
|
`vars` override those defaults by key. AgentV renders every prompt with each
|
|
155
165
|
test's merged vars, then expands the run across prompts, targets, tests, and
|
|
156
|
-
repeat
|
|
166
|
+
repeat samples.
|
|
157
167
|
|
|
158
168
|
```yaml
|
|
159
169
|
description: Prompt matrix example
|
|
@@ -176,15 +186,19 @@ tests:
|
|
|
176
186
|
- id: password-reset
|
|
177
187
|
vars:
|
|
178
188
|
question: How do I reset my password?
|
|
179
|
-
|
|
189
|
+
expected_output: Password reset guidance
|
|
180
190
|
assert:
|
|
191
|
+
- type: llm-rubric
|
|
192
|
+
value: "Matches the reference answer: {{ expected_output }}"
|
|
181
193
|
- Gives correct password reset guidance
|
|
182
194
|
- id: admin-access
|
|
183
195
|
vars:
|
|
184
196
|
audience: admins
|
|
185
197
|
question: How do I revoke a user's access?
|
|
186
|
-
|
|
198
|
+
expected_output: Access revocation guidance
|
|
187
199
|
assert:
|
|
200
|
+
- type: llm-rubric
|
|
201
|
+
value: "Matches the reference answer: {{ expected_output }}"
|
|
188
202
|
- Gives safe access revocation guidance
|
|
189
203
|
```
|
|
190
204
|
|
|
@@ -204,7 +218,7 @@ then render those vars from the prompt template next to the input.
|
|
|
204
218
|
**Shorthand forms:**
|
|
205
219
|
- Prompt entries can be strings, message arrays, file references, or prompt objects.
|
|
206
220
|
- Put chat/system/user messages in `prompts`, not in `tests[].input`.
|
|
207
|
-
- `expected_output`
|
|
221
|
+
- `vars.expected_output` is a conventional reference-answer variable; explicit assertions decide how to grade it
|
|
208
222
|
- Use these canonical field names on disk; keep the wire format `snake_case`
|
|
209
223
|
|
|
210
224
|
**Message format:** `{role, content}` where role is `system`, `user`, `assistant`, or `tool`
|
|
@@ -356,12 +370,14 @@ tests:
|
|
|
356
370
|
verification guidance was added.
|
|
357
371
|
|
|
358
372
|
Decide what durable repo change should be made and explain why.
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
373
|
+
expected_output: |
|
|
374
|
+
The durable repo change is to update .agents/verification.md with the
|
|
375
|
+
reusable verification workflow lessons. AGENTS.md already routes this
|
|
376
|
+
class of work to .agents/verification.md, so no extra AGENTS.md edit is
|
|
377
|
+
needed unless that routing is missing.
|
|
364
378
|
assert:
|
|
379
|
+
- type: llm-rubric
|
|
380
|
+
value: "Matches the reference answer: {{ expected_output }}"
|
|
365
381
|
- The answer recommends updating .agents/verification.md rather than leaving the learning only in PR comments or private evidence.
|
|
366
382
|
- The answer uses the pinned ./agentv checkout to verify the AGENTS.md routing.
|
|
367
383
|
- The answer preserves the historical commit SHA as context.
|
|
@@ -387,9 +403,9 @@ tests:
|
|
|
387
403
|
value: "fix"
|
|
388
404
|
```
|
|
389
405
|
|
|
390
|
-
`expected_output` is passive reference data. It is available to graders
|
|
391
|
-
`{{expected_output}}` and the script stdin payload, but it does not
|
|
392
|
-
implicit LLM grading call by itself.
|
|
406
|
+
`vars.expected_output` is passive reference data. It is available to graders
|
|
407
|
+
through `{{ expected_output }}` and the script stdin payload, but it does not
|
|
408
|
+
create an implicit LLM grading call by itself.
|
|
393
409
|
|
|
394
410
|
**Common mistake:** putting rubric prose in `expected_output` instead of an
|
|
395
411
|
assertion:
|
|
@@ -402,7 +418,7 @@ tests:
|
|
|
402
418
|
- id: bad-example
|
|
403
419
|
vars:
|
|
404
420
|
prompt: "What is 2+2?"
|
|
405
|
-
|
|
421
|
+
expected_output: The assistant should explain why the answer is 4. # reference answer var, not a grader
|
|
406
422
|
```
|
|
407
423
|
|
|
408
424
|
Write this as:
|
|
@@ -415,8 +431,10 @@ tests:
|
|
|
415
431
|
- id: good-example
|
|
416
432
|
vars:
|
|
417
433
|
prompt: "What is 2+2?"
|
|
418
|
-
|
|
434
|
+
expected_output: "4"
|
|
419
435
|
assert:
|
|
436
|
+
- type: llm-rubric
|
|
437
|
+
value: "Matches the reference answer: {{ expected_output }}"
|
|
420
438
|
- The answer is 4 and explains the arithmetic briefly
|
|
421
439
|
```
|
|
422
440
|
|
|
@@ -438,7 +456,7 @@ assert:
|
|
|
438
456
|
weight: 5.0
|
|
439
457
|
```
|
|
440
458
|
|
|
441
|
-
If a required grader scores below its threshold, the overall
|
|
459
|
+
If a required grader scores below its threshold, the overall case status is forced to `fail`.
|
|
442
460
|
|
|
443
461
|
## Environment Setup/Teardown
|
|
444
462
|
|
|
@@ -523,9 +541,10 @@ Configure via the `assert` array. Multiple graders produce a weighted average sc
|
|
|
523
541
|
cwd: ./scripts # optional working directory
|
|
524
542
|
target: {} # optional: enable LLM target proxy (max_calls: 50)
|
|
525
543
|
```
|
|
526
|
-
Contract: stdin JSON -> stdout JSON `{score,
|
|
544
|
+
Contract: stdin JSON -> stdout JSON `{pass, score, reason, checks?: [{text, pass, score?, reason}]}`
|
|
527
545
|
Raw stdin uses snake_case and includes: `input`, `expected_output`, `output` (final answer string), `messages`, `trace`, `trace_summary`, `token_usage`, `cost_usd`, `duration_ms`, `start_time`, `end_time`, `file_changes`, `workspace_path`, `config`
|
|
528
546
|
SDK handlers receive the same payload in camelCase: `expectedOutput`, `traceSummary`, `tokenUsage`, `costUsd`, `durationMs`, `startTime`, `endTime`, `fileChanges`, `workspacePath`.
|
|
547
|
+
`checks` is an SDK/script convenience shape; public `grading.json` artifacts normalize checks into recursive `component_results`.
|
|
529
548
|
When an environment prepares a workspace directory, `workspace_path` is the absolute path to that directory (also available as `AGENTV_WORKSPACE_PATH` env var). Use this for functional grading (e.g., running `npm test` in the prepared workdir).
|
|
530
549
|
For deterministic workspace checks that fit normal Vitest `expect(...)` tests, prefer a plain verifier file and the built-in adapter:
|
|
531
550
|
```yaml
|
|
@@ -567,24 +586,35 @@ Variables: `{{criteria}}`, `{{input}}`, `{{expected_output}}`, `{{output}}`, `{{
|
|
|
567
586
|
type: llm-rubric
|
|
568
587
|
weight: 0.7
|
|
569
588
|
```
|
|
570
|
-
Use `assert-set` for Promptfoo-aligned assertion grouping. Without `threshold`, the set passes only when every nonzero-weight child assertion passes. With `threshold`, the weighted aggregate score determines the set
|
|
571
|
-
|
|
572
|
-
###
|
|
573
|
-
```yaml
|
|
574
|
-
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
589
|
+
Use `assert-set` for Promptfoo-aligned assertion grouping. Without `threshold`, the set passes only when every nonzero-weight child assertion passes. With `threshold`, the weighted aggregate score determines the set pass/fail result. Parent `config` is inherited by children, and child `config` keys override parent keys. Do not use `type: composite`; AgentV rejects it.
|
|
590
|
+
|
|
591
|
+
### Skill And Trajectory Assertions
|
|
592
|
+
```yaml
|
|
593
|
+
- type: skill-used
|
|
594
|
+
value: csv-analyzer
|
|
595
|
+
- type: not-skill-used
|
|
596
|
+
value:
|
|
597
|
+
pattern: "web-*"
|
|
598
|
+
max: 0
|
|
599
|
+
- type: trajectory:tool-used
|
|
600
|
+
value:
|
|
601
|
+
name: knowledgeSearch
|
|
602
|
+
min: 2
|
|
603
|
+
- type: trajectory:tool-sequence
|
|
604
|
+
value:
|
|
605
|
+
mode: exact
|
|
606
|
+
steps: [knowledgeSearch, documentRetrieve]
|
|
607
|
+
- type: trajectory:tool-args-match
|
|
608
|
+
value:
|
|
609
|
+
name: knowledgeSearch
|
|
610
|
+
args: { query: "search term" }
|
|
611
|
+
mode: partial
|
|
612
|
+
```
|
|
613
|
+
Use Promptfoo-compatible `skill-used`, `not-skill-used`, and `trajectory:*`
|
|
614
|
+
assertions for new eval YAML. Do not author `skill-trigger` or
|
|
615
|
+
`tool-trajectory`; AgentV rejects them with migration guidance. Per-tool
|
|
616
|
+
latency checks from old `tool-trajectory` YAML do not have a Promptfoo
|
|
617
|
+
trajectory equivalent yet; use a `script` assertion for that behavior.
|
|
588
618
|
|
|
589
619
|
### field-accuracy
|
|
590
620
|
```yaml
|
|
@@ -711,24 +741,24 @@ agentv eval assert <grader-name> --agent-output "..." --agent-input "..."
|
|
|
711
741
|
agentv import claude --session-id <uuid>
|
|
712
742
|
|
|
713
743
|
# Re-run only execution errors from a previous run
|
|
714
|
-
agentv eval <file.yaml> --retry-errors .agentv/results/
|
|
744
|
+
agentv eval <file.yaml> --retry-errors .agentv/results/<run_id>/.internal/index.jsonl
|
|
715
745
|
|
|
716
746
|
# Validate eval file
|
|
717
747
|
agentv validate <file.yaml>
|
|
718
748
|
|
|
719
749
|
# Compare completed runs
|
|
720
750
|
agentv results compare \
|
|
721
|
-
.agentv/results
|
|
722
|
-
.agentv/results
|
|
751
|
+
.agentv/results/<baseline-run-id>/.internal/index.jsonl \
|
|
752
|
+
.agentv/results/<candidate-run-id>/.internal/index.jsonl
|
|
723
753
|
agentv results combine \
|
|
724
|
-
.agentv/results
|
|
725
|
-
.agentv/results
|
|
726
|
-
.agentv/results
|
|
727
|
-
--output .agentv/results/
|
|
728
|
-
agentv results compare .agentv/results/
|
|
754
|
+
.agentv/results/<baseline-run-id> \
|
|
755
|
+
.agentv/results/<candidate-run-id> \
|
|
756
|
+
.agentv/results/<third-target-run-id> \
|
|
757
|
+
--output .agentv/results/combined
|
|
758
|
+
agentv results compare .agentv/results/combined/.internal/index.jsonl
|
|
729
759
|
agentv results compare \
|
|
730
|
-
.agentv/results
|
|
731
|
-
.agentv/results
|
|
760
|
+
.agentv/results/<baseline-run-id>/.internal/index.jsonl \
|
|
761
|
+
.agentv/results/<candidate-run-id>/.internal/index.jsonl \
|
|
732
762
|
--json
|
|
733
763
|
|
|
734
764
|
# Author assertions directly in the eval file
|
|
@@ -744,32 +774,36 @@ Use `@agentv/sdk` as the public lightweight SDK package for TypeScript/JavaScrip
|
|
|
744
774
|
|
|
745
775
|
### YAML-aligned eval authoring
|
|
746
776
|
```typescript
|
|
747
|
-
|
|
777
|
+
// evals/helper-suite.eval.ts
|
|
778
|
+
import { graders, type EvalConfig } from '@agentv/sdk';
|
|
748
779
|
|
|
749
|
-
|
|
780
|
+
const config: EvalConfig = {
|
|
750
781
|
name: 'helper-suite',
|
|
751
782
|
target: 'default',
|
|
752
|
-
//
|
|
783
|
+
// TypeScript config loading lowers this to evaluate_options.repeat.
|
|
753
784
|
repeat: {
|
|
754
785
|
count: 3,
|
|
755
786
|
strategy: 'pass_any',
|
|
756
787
|
earlyExit: false,
|
|
757
788
|
},
|
|
758
789
|
threshold: 0.8,
|
|
790
|
+
prompts: ['{{ task }}'],
|
|
759
791
|
tests: [
|
|
760
792
|
{
|
|
761
793
|
id: 'json-answer',
|
|
762
|
-
|
|
794
|
+
vars: { task: 'Return a JSON answer with a status field.' },
|
|
763
795
|
assert: [
|
|
764
796
|
graders.json({ name: 'valid-json', required: true }),
|
|
765
797
|
graders.regex(/"status"\s*:/, { name: 'status-key' }),
|
|
766
798
|
],
|
|
767
799
|
},
|
|
768
800
|
],
|
|
769
|
-
}
|
|
801
|
+
};
|
|
802
|
+
|
|
803
|
+
export default config;
|
|
770
804
|
```
|
|
771
805
|
|
|
772
|
-
The `graders` catalog returns ordinary `assert` entries such as `type: is-json`, `type: regex`, `type: llm-rubric`, and `type: script`. `defineEval()` lowers camelCase
|
|
806
|
+
The `graders` catalog returns ordinary `assert` entries such as `type: is-json`, `type: regex`, `type: llm-rubric`, and `type: script`. Explicit `*.eval.ts` and `*.eval.mts` files should default-export an `EvalConfig`; `defineEval(config)` is only an optional thin helper over that same shape. TypeScript config loading lowers camelCase fields such as `expectedOutput`, `inputFiles`, and `maxSteps` to canonical snake_case YAML/runtime keys.
|
|
773
807
|
|
|
774
808
|
If adapting Braintrust `scores` or DeepEval metrics, write small AgentV helper factories that return `graders.*` configs:
|
|
775
809
|
|
|
@@ -794,9 +828,11 @@ import { defineAssertion } from '@agentv/sdk';
|
|
|
794
828
|
|
|
795
829
|
export default defineAssertion(({ output, trace }) => {
|
|
796
830
|
const finalOutput = output ?? '';
|
|
831
|
+
const pass = finalOutput.length > 0 && (trace?.eventCount ?? 0) <= 10;
|
|
797
832
|
return {
|
|
798
|
-
pass
|
|
799
|
-
|
|
833
|
+
pass,
|
|
834
|
+
score: pass ? 1 : 0,
|
|
835
|
+
reason: 'Checks content exists and is efficient',
|
|
800
836
|
};
|
|
801
837
|
});
|
|
802
838
|
```
|
|
@@ -812,17 +848,21 @@ import { defineScriptGrader } from '@agentv/sdk';
|
|
|
812
848
|
|
|
813
849
|
export default defineScriptGrader(({ output, trace }) => {
|
|
814
850
|
const finalOutput = output ?? '';
|
|
851
|
+
const hasOutput = finalOutput.length > 0;
|
|
852
|
+
const efficient = (trace?.eventCount ?? 0) <= 5;
|
|
815
853
|
return {
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
854
|
+
pass: hasOutput && efficient,
|
|
855
|
+
score: hasOutput && efficient ? 1.0 : 0.5,
|
|
856
|
+
reason: 'Checks content exists and tool usage is bounded',
|
|
857
|
+
checks: [
|
|
858
|
+
{ text: 'Output is not empty', pass: hasOutput, reason: hasOutput ? 'Output text is present' : 'Output is empty' },
|
|
859
|
+
{ text: 'Efficient tool usage', pass: efficient, reason: efficient ? 'Trace event count is within limit' : 'Trace event count is too high' },
|
|
820
860
|
],
|
|
821
861
|
};
|
|
822
862
|
});
|
|
823
863
|
```
|
|
824
864
|
|
|
825
|
-
Use `defineScriptGrader()` when the custom component is a command-backed grader with explicit score control,
|
|
865
|
+
Use `defineScriptGrader()` when the custom component is a command-backed grader with explicit score control, check arrays, workspace commands, or LLM calls through a grader target. `defineScriptGrader()` scripts are referenced in YAML with `type: script` and `command: [bun, run, grader.ts]`. Plain Vitest workspace verifier files can use `command: [agentv, eval, graders/check.test.ts]`.
|
|
826
866
|
|
|
827
867
|
### Convention-Based Discovery
|
|
828
868
|
|
|
@@ -59,13 +59,15 @@ import {
|
|
|
59
59
|
createTargetClient,
|
|
60
60
|
defineScriptGrader,
|
|
61
61
|
defineEval,
|
|
62
|
+
type EvalConfig,
|
|
62
63
|
definePromptTemplate,
|
|
63
64
|
graders,
|
|
64
65
|
} from '@agentv/sdk';
|
|
65
66
|
```
|
|
66
67
|
|
|
67
68
|
- `defineScriptGrader(fn)` - Wraps evaluation function with stdin/stdout handling
|
|
68
|
-
- `
|
|
69
|
+
- `EvalConfig` - Public TypeScript eval authoring type for default-exported `*.eval.ts` and `*.eval.mts` files
|
|
70
|
+
- `defineEval(definition)` - Optional thin helper over the same `EvalConfig` shape
|
|
69
71
|
- `graders` - Helper catalog that returns ordinary AgentV `assert` entries
|
|
70
72
|
- `createTargetClient()` - Returns LLM proxy client (when `target: {}` configured)
|
|
71
73
|
- `.invoke({question, systemPrompt})` - Single LLM call
|
|
@@ -81,7 +83,7 @@ For Python, the repo-local helper example in `examples/features/sdk-python/` kee
|
|
|
81
83
|
Use helper factories for reusable Braintrust/DeepEval-inspired checks, but keep the result as AgentV `assert` entries:
|
|
82
84
|
|
|
83
85
|
```typescript
|
|
84
|
-
import {
|
|
86
|
+
import { graders, type EvalConfig } from '@agentv/sdk';
|
|
85
87
|
|
|
86
88
|
function ragFaithfulness() {
|
|
87
89
|
return graders.llmRubric(undefined, {
|
|
@@ -91,19 +93,22 @@ function ragFaithfulness() {
|
|
|
91
93
|
});
|
|
92
94
|
}
|
|
93
95
|
|
|
94
|
-
|
|
96
|
+
const config: EvalConfig = {
|
|
95
97
|
name: 'rag-suite',
|
|
98
|
+
prompts: ['{{ task }}'],
|
|
96
99
|
tests: [
|
|
97
100
|
{
|
|
98
101
|
id: 'grounded-answer',
|
|
99
|
-
|
|
102
|
+
vars: { task: 'Answer using the retrieved context.' },
|
|
100
103
|
assert: [
|
|
101
104
|
graders.contains('source', { name: 'mentions-source' }),
|
|
102
105
|
ragFaithfulness(),
|
|
103
106
|
],
|
|
104
107
|
},
|
|
105
108
|
],
|
|
106
|
-
}
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
export default config;
|
|
107
112
|
```
|
|
108
113
|
|
|
109
114
|
The helper lowers to ordinary YAML:
|