Commit 13c845e
authored
feat(evals): add Cursor agent bench harness (integrations/cursor-sdk) (#2812)
## What
Adds `--harness cursor` to evals, backed by a new private
`@browserbasehq/stagehand-integrations-cursor-sdk` package, plus a
minimal `packages/integrations/cursor` facade example (mcp.json +
README, fx-package shape). The Cursor agent is CLI-only (`agent`, legacy
`cursor-agent`; no npm SDK).
- `packages/integrations/cursor-sdk` — `runCursorSession`: spawns `agent
-p --output-format stream-json` with a project-local `.cursor/mcp.json`
pointing at the stagehand facade stdio server, parses the stream into
tool-call/result/usage events, abort → child kill, redaction,
status/stopReason normalization.
- `packages/evals/framework/cursorToolAdapter.ts` — `via:"mcp"` mounts
only (stagehand_facade first, playwright_mcp, chrome_devtools_mcp;
browse_cli/code surfaces rejected).
- `packages/evals/framework/harnesses/cursorAdapter.ts` — events →
`NormalizedToolCall[]`.
- Registered via `defineExternalHarness` on the shared external-runner
skeleton.
## Testing
- Full unit gate green (evals + cursor-sdk 8 + all other suites).
- Connected smoke **not yet run**: the `agent` CLI is not installed on
the dev machine (`curl https://cursor.com/install -fsS | bash`). Command
when available: `evals run b:webvoyager --harness cursor --tool
stagehand_facade -l 1 -t 1 -e browserbase`.
Stacked on the fx PR; top of the harness stack. Implemented with Codex
(gpt-5.6) under supervision.
<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Adds a registered Cursor agent CLI harness so evals can run with
`--harness cursor` over MCP-only mounts, without launching a browser or
modifying files. The Cursor CLI reports no token usage, so token metrics
are zero.
- Supported tool surfaces: `stagehand_facade` (default),
`playwright_mcp`, `chrome_devtools_mcp`; other surfaces (e.g.,
`browse_cli`, code mounts) are rejected.
- Registration: `cursor` is in the bench harness registry with default
model `cursor/auto`; wired into CI, `turbo`, and `vitest` with unit
tests for registry, runner, adapter, and SDK.
- Process/workspace: writes a temp `.cursor/mcp.json` for active MCP
servers, inherits env, and cleans up. Override the binary with
`EVAL_CURSOR_AGENT_PATH`; toggle sandbox via
`EVAL_CURSOR_SANDBOX=enabled|disabled`; cap completed tool steps via
`EVAL_CURSOR_MAX_STEPS` or `AGENT_EVAL_MAX_STEPS` (default 50).
- CLI invocation: runs `agent -p --output-format stream-json --force
--trust --approve-mcps`; API keys are never passed on the command line,
and stream output is sanitized for secrets.
- Metrics: `cursor_input_tokens`, `cursor_output_tokens`,
`cursor_total_tokens` (always zero), `cursor_duration_ms`,
`cursor_tool_steps`.
- Trajectory mapping: assistant text becomes reasoning;
started/completed `tool_call` pairs become steps, and started calls
without a completed envelope (abort/kill mid-call) fail closed; MCP
images become evidence with a final-observation fallback; step
observations attach by MCP tool ordinal. Results are parsed strictly
first, then leniently for fenced/prose JSON.
- New private package `@browserbasehq/stagehand-integrations-cursor-sdk`
adds the process runner and parsers; `packages/integrations/cursor`
provides an `mcp.json` template and AGENTS.md guidance.
- Run locally: install the Cursor CLI (`curl https://cursor.com/install
-fsS | bash`), set `CURSOR_API_KEY`, then e.g. `evals run b:webvoyager
--harness cursor --tool stagehand_facade -l 1 -t 1 -e browserbase`.
<sup>Written for commit c20d28b.
Summary will update on new commits.</sup>
<a
href="https://cubic.dev/pr/browserbase/stagehand/pull/2812?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="Review in cubic"
src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->1 parent daec8d6 commit 13c845e
25 files changed
Lines changed: 2043 additions & 12 deletions
File tree
- .github/workflows
- packages
- evals
- framework
- harnesses
- tests/framework
- integrations
- cursor-sdk
- src
- tests
- cursor
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
266 | 266 | | |
267 | 267 | | |
268 | 268 | | |
| 269 | + | |
269 | 270 | | |
270 | 271 | | |
271 | 272 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
| 24 | + | |
23 | 25 | | |
24 | 26 | | |
25 | 27 | | |
| |||
336 | 338 | | |
337 | 339 | | |
338 | 340 | | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
339 | 349 | | |
340 | 350 | | |
341 | 351 | | |
| |||
345 | 355 | | |
346 | 356 | | |
347 | 357 | | |
| 358 | + | |
348 | 359 | | |
349 | 360 | | |
350 | 361 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
0 commit comments