Commit Graph

60 Commits

Author SHA1 Message Date
molebox 5d7aef26a7 feat: add fx research agent 2026-08-24 17:08:17 +02:00
molebox ceba203690 feat: add opt-in agent runtime controls 2026-08-19 18:43:38 +02:00
Jude Gao 1835669fb9 Merge pull request #166 from huang-julien/fix/provide_type_augment
fix(agent-eval): provide type augmentation for agent-eval/eval
2026-08-19 11:14:24 -04:00
Julien Huang 974cda2689 fix(agent-eval): provide type augmentation for agent-eval/eval 2026-08-19 11:07:25 -04:00
Jude Gao 29fc098a89 Merge branch 'main' into fix-177 2026-08-19 10:59:05 -04:00
owenkephart 88c3c4ee00 test: require definitions for registered agents 2026-08-11 23:07:50 +00:00
owenkephart cc57b91910 feat: support registered custom agents 2026-08-11 23:07:50 +00:00
Steve Dodier-Lazaro 93e3131c58 Adjust comments 2026-07-29 16:02:00 +02:00
Steve Dodier-Lazaro 3be067057d Fix silent binary-file corruption when collecting results
Collected project trees were not faithful copies. Two independent paths
decoded every file as UTF-8, replacing each invalid byte with U+FFFD:

- captureGeneratedFiles read the agent's diff via sandbox.readFile, which
  hands back command stdout -- a string the sandbox API decodes as UTF-8.
- readFixtureFiles read fixtures with 'utf-8', corrupting every binary
  asset a fixture ships when copyFiles: 'all' is used.

Both failures are silent: no exception, no warning, and text-only projects
never show them. Binary files were destroyed and inflated ~1.8x.

Sandbox gains readFileBuffer(path), routed through `base64` so the existing
transport round-trips losslessly, and copyFiles: 'all' now uses copyFileSync
instead of read-then-write -- bytes never enter the heap, so a whole fixture
tree is no longer buffered in memory.

BREAKING: generatedFiles is now Record<string, Buffer> on AgentRunResult and
EvalRunData; readFixtureFiles returns Map<string, Buffer>.

Closes #176

Co-Authored-By: Claude <noreply@anthropic.com>
2026-07-29 12:20:58 +02:00
Jude Gao e45907c90b Accept RegExp needles in toContainText 2026-07-17 15:36:30 -04:00
Jude Gao 4f8732ccdd Add deterministic transcript matcher expect(transcript).toContainText() 2026-07-16 20:41:24 -04:00
molebox d6e9c86c76 agent-eval: route OpenCode explicit model overrides through the AI Gateway
An explicit --model like anthropic/claude-sonnet-5 was passed to the
OpenCode CLI verbatim, which reads the first segment as its provider id.
The generated opencode.json only configures the vercel (AI Gateway)
provider, so every explicit-model run using a canonical gateway id died
at session start with "Unexpected server error" and a null
observedModel.

- resolveOpenCodeModel (host-side): prefix vercel/ unless the caller
  already targets vercel/... or a configured extraProviders key.
- Threaded to the runner via runnerExtra -> input.extra.cliModel,
  mirroring codex's host-computed model (the judge path ships extra but
  not agentOptions, so the resolution must happen host-side).
- normalizeObservedModel (runner-side): un-apply exactly that prefix on
  the observation, so observedModel === requestedModel holds for
  canonical gateway ids and a gateway substitution still surfaces as a
  clean gateway id. Native-default observations are untouched, and the
  documented vercel/-prefixed form still passes through verbatim.
- README: the OpenCode model format section now documents both forms
  (it previously stated unprefixed ids fail with provider-not-found).
2026-07-06 12:17:19 +02:00
Jude Gao b35873ca4a [agent-eval] Incremental eval staleness: status / run + content-aware fingerprints
Adopting a changed or new eval shouldn't force re-running every model. This adds a
small, explicit workflow and fixes the fingerprinting that made it impossible.

- Fingerprint split: results store a content-only hash alongside the combined
  (content+config) one. A real eval change is never masked; a benign config change
  (timeout bump, pinning a judge) is carried forward by `refingerprint` instead of
  re-running. Existing `fingerprint` values are byte-identical.
- `agent-eval status` — read-only: new vs changed evals, per experiment. `--check`
  exits non-zero on any new/changed eval; `--json` emits per-experiment new/changed.
- `agent-eval run <experiments...>` — run the named experiments' new/changed evals.
- Bare `agent-eval` shows status, then lets you multi-select what to run. Removes
  `run-all` and `--dry`. No in-framework accept/keep — staleness acceptance is the
  consumer's policy (filter `status --json` in CI).

Stacked on #164.
2026-06-30 13:07:13 -04:00
Jude Gao 2905905a27 [agent-eval] Pin the agentic judge to a fixed agent and model 2026-06-29 23:45:45 -04:00
Jude Gao 7021c4b914 agent-eval: agentic LLM-judge matcher for EVAL.ts
Judge the final state or the transcript from inside EVAL.ts, reusing the
SAME agent + sandbox as codegen (no fresh sandbox, no copied evidence):

  import { environment, transcript } from '@vercel/agent-eval/eval';
  await expect(environment).toSatisfyCriterion('uses Server Components');
  await expect(transcript).toSatisfyCriterion('used DevTools, not guesswork');
  await expect(environment).toScoreAtLeast('code quality', 0.8);

- eval-helper.mjs: shipped in-sandbox (aliased to @vercel/agent-eval/eval +
  vitest setup file); each assertion re-invokes __agent_eval__/run.mjs with a
  judge prompt and parses the verdict. You give only the criterion.
- orchestrator/shared: ship the helper, materialize the raw transcript to a
  file (read by path, never dumped into a prompt), record judge-config (same
  model), pass auth env to validation, gitignore __agent_eval__/.
- Failures are attributable: '[judge:environment] FAIL (score): reason'.

Verified: unit tests + real e2e (Vercel sandbox + Claude via gateway) — judge
confirms true criteria (eval passes) and rejects a false one (eval fails).
2026-06-29 14:28:25 -04:00
molebox cedf84b4bc Use native default when model is omitted 2026-06-01 18:48:13 +02:00
molebox aa66c4d35b Add native default model policy 2026-06-01 17:01:36 +02:00
Allen Zhou c52126f198 Keep agent config validation strict 2026-05-05 15:58:10 -07:00
Allen Zhou 07614ec3b7 Add response-only harness support 2026-05-05 15:37:24 -07:00
Jude Gao 660ea3ea20 [CLI] Remove auto-retry of non-model failures (#118) 2026-04-24 21:52:45 -04:00
Jude Gao 481637dd6e Auto-retry non-model failures with configurable retry rounds (#110) 2026-04-14 23:26:27 -04:00
Allen Zhou 097490384c asserting agent behavior 2026-02-20 13:59:49 -08:00
Jude Gao 065afc909f Revert "[Classifier] Add "eval" failure type for flawed eval tests (#79)" (#82)
This reverts commit 683e681b7d.
2026-02-17 17:10:37 -08:00
Jude Gao 683e681b7d [Classifier] Add "eval" failure type for flawed eval tests (#79) 2026-02-17 16:28:03 -08:00
Jude Gao be7ca1560e [Agents] Add Cursor CLI agent with direct API support (#73)
* [Agents] Add Cursor CLI agent with direct API support

Add Cursor CLI as a new agent to the eval framework, enabling testing against Cursor models using direct API access via `CURSOR_API_KEY`. The implementation follows the established pattern from existing agents (Claude Code, Codex, Gemini) and integrates seamlessly with the sandbox infrastructure.

Cursor CLI uses a different interaction model than other agents. Unlike the `agent chat` subcommand syntax, the correct invocation is to pass the prompt as the first positional argument, then use the `--print` flag to enable non-interactive mode (required for scripts and headless execution). The `--force` flag is added to automatically approve all CLI operations without waiting for user confirmation. This combination ensures the agent completes successfully in sandboxed environments without hanging on interactive prompts.

The agent installation uses Cursor's official shell-based installation method (`curl https://cursor.com/install -fsSL | bash`), which handles proper setup of the CLI environment. Once installed, prompts are executed as `agent "<prompt>" --print --force`, capturing both stdout and stderr as output. The implementation includes transcript extraction that filters for JSON-formatted events when available, falling back to raw text output if no structured format is detected. This matches the approach used by other agents but adapts to Cursor's plain-text output characteristics.

The agent uses `composer-1.5` as the default model and integrates with all eval framework features including file capture, script validation, and test execution. Integration tests verify both basic eval execution and result output structure matching. The agent is fully typed in the framework's type system and added to the configuration schema alongside other direct-API agents.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>

* Fix missing --model and --output-format flags, update env var docs

- Pass --model to Cursor CLI so user-configured model is actually used
- Add --output-format stream-json for structured JSONL transcripts
- Update changeset to reflect correct default model (composer-1.5)
- Add GEMINI_API_KEY and CURSOR_API_KEY to README env var table

---------

Co-authored-by: Claude Haiku 4.5 <noreply@anthropic.com>
2026-02-12 15:08:22 -05:00
Jude Gao 8f198d4d18 [Agents] Add Gemini CLI agent with direct API and stream-json transcript support (#71) 2026-02-12 14:15:34 -05:00
Paolo Ricciuti fc91cfb7e2 Merge pull request #64 from vercel-labs/save-changed-files
fix: use git to get changes files
2026-02-11 21:56:10 +01:00
copilot-swe-agent[bot] 1b07100d3c docs: remove "When to use" section from copyFiles docs
Co-authored-by: paoloricciuti <26281609+paoloricciuti@users.noreply.github.com>
2026-02-11 20:54:53 +00:00
copilot-swe-agent[bot] 08505b5cc1 docs: document copyFiles configuration option
Co-authored-by: paoloricciuti <26281609+paoloricciuti@users.noreply.github.com>
2026-02-11 20:49:57 +00:00
Jude Gao cf50218fe2 Make failure classifier optional (#65) 2026-02-11 15:22:13 -05:00
Jude Gao 2b953ea015 Overhaul README with run-all, fingerprinting, classification, and housekeeping (#46)
Rewrites the README to document all features added in v0.3.0:
default run-all behavior, --smoke/--force flags, content fingerprinting
and result reuse, AI failure classification, auto-retry, and
housekeeping. Fixes outdated result file paths and summary.json format.
2026-02-08 00:40:57 -05:00
Jude Gao b841c01306 Add failure classification and auto-retry support (#40)
New classifier.ts module classifies failed evals as model, infra, or
timeout. Rule-based fast path catches ~80% of cases (timeout errors,
missing transcripts, rate limits, tiny transcripts with API errors).
Falls back to AI classification via gateway(anthropic/claude-sonnet-4-5)
with sandboxed read-only tools. Gracefully degrades to rule-based only
when AI_GATEWAY_API_KEY is not set.

shouldRetry() returns true when all failures are non-model, enabling
auto-retry of infra-failed evals.

summary.json now supports classification and valid fields. Results
marked valid: false are excluded from fingerprint reuse.
2026-02-08 00:17:03 -05:00
Allen Zhou 08499abc1b fix playground ts error 2026-02-06 17:52:30 -08:00
Allen Zhou af3df35ecc Merge pull request #20 from vercel-labs/copilot/update-readme-experimentconfig
Document ExperimentConfig model arrays and editPrompt usage
2026-02-06 14:03:09 -08:00
Allen Zhou bffe684d97 docs 2026-02-06 13:53:46 -08:00
Allen Zhou c7fa6a15fa Apply suggestion from @allenzhou101 2026-02-06 13:41:17 -08:00
copilot-swe-agent[bot] 10dbc8fc3a docs: clarify ExperimentConfig options
Co-authored-by: paoloricciuti <26281609+paoloricciuti@users.noreply.github.com>
2026-02-06 20:09:57 +00:00
Allen Zhou 27bfad6346 docs 2026-02-05 14:43:49 -08:00
Jude Gao be0ea788b4 Add CONTRIBUTING.md (#15) 2026-02-05 12:57:53 -05:00
Jude Gao 474991cb5a Remove AI SDK harness agent (#11) 2026-02-05 12:10:09 -05:00
Jude Gao 59826e7b9a [Agents] Add AI SDK Harness for evaluating any AI Gateway model (#8) 2026-02-03 19:10:44 -05:00
Jude Gao 4b2040f190 chore: change default timeout from 5 minutes to 10 minutes 2026-02-03 15:49:12 -05:00
Jude Gao 6844159ca7 [OpenCode] Fix model format and Docker file permissions for agent compatibility (#7)
OpenCode requires the vercel/ prefix in model strings (e.g., vercel/minimax/minimax-m2.1)
because the agent's opencode.json config sets up a vercel provider.

Also fixes Docker sandbox file permissions by adding chown after uploadFiles.
2026-02-03 15:14:30 -05:00
Jude Gao c22a5183d2 fix: use correct provider/model format for OpenCode models 2026-02-03 11:45:08 -05:00
Jude Gao f00bbe8b9b docs: add OpenCode model configuration section 2026-02-03 11:23:17 -05:00
Jude Gao c542f883aa feat: add OpenCode agent with Vercel AI Gateway support
Add OpenCode as a new agent option for running evals. OpenCode uses
Vercel AI Gateway for model access and supports non-interactive
execution via `opencode run` command.

- Add src/lib/agents/opencode.ts with full agent implementation
- Register agent in index.ts as 'vercel-ai-gateway/opencode'
- Add type to AgentType union in types.ts
- Add validation in config.ts schema
- Add integration tests for OpenCode sandbox execution
- Update README.md with OpenCode documentation
2026-02-03 11:01:26 -05:00
Jude Gao 9cf4477c1a feat: support EVAL.tsx for JSX-based test files
- Add EVAL.tsx to TEST_FILE_PATTERNS and EXCLUDED_FILES
- Update fixture validation to accept either EVAL.ts or EVAL.tsx
- Remove *.test.tsx and *.test.ts from TEST_FILE_PATTERNS
- Document EVAL.ts vs EVAL.tsx convention in README with examples
- Bump version to 0.0.2

This allows using React Testing Library and other JSX-based testing
approaches in eval fixtures.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-28 22:40:30 -05:00
Jude Gao f6727dcc3a chore: prepare for publish as @vercel/agent-eval
- Update package name from agent-eval to @vercel/agent-eval
- Fix version test to read dynamically from package.json
- Update integration tests to load from .env.local
- Update README with @vercel/agent-eval usage
- Clarify Vercel employee setup instructions
- Fix lint error in runner.test.ts

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-28 20:10:22 -05:00
Jude Gao 19b56cfac7 chore: move to vercel-labs/agent-eval as initial release
- Rename package from @judegao/eval to agent-eval
- Reset version to 0.0.1
- Update all imports, templates, and docs to use new package name
- Point repository and git remote to vercel-labs/agent-eval
- Fix duplicate evals keys in README config example
- Rewrite environment variables docs with summary table
- Add Vercel employees section for vc env pull workflow

Co-Authored-By: Claude (claude-fudge-eap-cc) <noreply@anthropic.com>
2026-01-28 19:38:48 -05:00
Jude Gao 673a860ea2 fix: v1.1.1 - use npx agent-eval instead of npm run eval
Remove the `eval` npm script from generated projects and update all
docs/tests to use `npx agent-eval` directly, eliminating the confusing
`--` separator needed with `npm run`. Also sync cli.ts version to 1.1.1
and fix stale integration test assertion for removed scripts field.
2026-01-27 23:59:59 -05:00