Skip to content

feat(eval): add OpenCode agent harness - #56

Closed
Rodriguespn wants to merge 2 commits into
mainfrom
pedrorodrigues/add-opencode-agent-support
Closed

feat(eval): add OpenCode agent harness#56
Rodriguespn wants to merge 2 commits into
mainfrom
pedrorodrigues/add-opencode-agent-support

Conversation

@Rodriguespn

@Rodriguespn Rodriguespn commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Adds opencode as an agent. opencode runs headless via opencode run <msg> --format json --dangerously-skip-permissions in the Docker sandbox.

Validation

version: opencode v1.15.7
scenarios:

  • Tools mode: investigate-db-001-table-row-counts
  • Local-stack mode: build-cli-001-bootstrap-app
Experiment Checks Stop reason Provider metadata
opencode-claude-sonnet-5 3/3 ✅ stop anthropic
opencode-gpt-5.4-mini 3/3 ✅ stop openai
opencode-gemini-flash 3/3 ✅ stop google

The results were the same for both scenarios

Note: Tested with the models above but we don't have to go with these three + Kimi K3

Ref AI-964, AI-967

@vercel

vercel Bot commented Jun 24, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
evals Ignored Ignored Preview Jul 24, 2026 6:23pm

Request Review

Comment thread experiments/opencode-kimi-k3.ts Outdated

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tried running Kimi K3 locally but ran out of credits. Will need to upgrade my account to try again

Comment thread apps/web/src/App.tsx
@Rodriguespn
Rodriguespn marked this pull request as ready for review July 24, 2026 01:04
@Rodriguespn
Rodriguespn requested a review from a team July 24, 2026 01:04
@Rodriguespn
Rodriguespn force-pushed the pedrorodrigues/add-opencode-agent-support branch from e9a0971 to a19a53a Compare July 24, 2026 15:01
@Rodriguespn Rodriguespn changed the title feat(eval): add OpenCode agent harness feat(eval): add OpenCode agent harness + Kimi K3 via the AI Gateway Jul 24, 2026
@Rodriguespn
Rodriguespn changed the base branch from main to explore/ai-gateway-vendor-provider July 24, 2026 15:02
@linear-code

linear-code Bot commented Jul 24, 2026

Copy link
Copy Markdown
AI-964 AI spike for OpenCode support in evals

Prototype OpenCode support in evals.

Context from the discussion: this seemed worth exploring ahead of launch, especially since OpenCode is open source. One possible tradeoff mentioned was substituting GPT-5.4-mini for a different harness if needed.

AI-967 Add Kimi K3 to public evals benchmark

Add the Kimi K3 model to the public evals benchmark. The intended path is via Vercel AI Gateway and through OpenCode.

Adds `opencode` (OpenCode CLI) as an eval agent on the agents framework: an
agents/opencode module (runner + parser + factory + registry definition) plus
experiments. Orchestration is unchanged; opencode's transcript is parsed into
the same surface scorers use. Runs in both modes, like Claude Code / Codex.

- runner.ts: install `opencode-ai`, then `opencode run <msg> --format json
  --dangerously-skip-permissions < /dev/null` (opencode blocks on stdin
  otherwise). Multi-provider: `provider/model` ids typed from the vendor SDKs
  (anthropic/openai/google); `apiKeyEnvVar` + `modelProvider` resolved from the
  prefix. MCP written to an OPENCODE_CONFIG file in scratch.
- parser.ts: the 1.15 JSONL schema (text / tool_use / reasoning / error /
  step_*), paired tool_call + tool_result by callID.
- engine.ts + types.ts: multi-provider CLIs carry an optional `modelProvider`;
  the engine prefers it over the per-agent-id mapping. `requireApiKey` uses the
  shared `requireEnv`.
- eval-metadata: `opencode` harness id; `google` model provider.
- Experiments: opencode-claude-sonnet-5, opencode-gpt-5.4-mini,
  opencode-gemini-flash. Adds @ai-sdk/google for the Gemini model-id types.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Rodriguespn
Rodriguespn force-pushed the pedrorodrigues/add-opencode-agent-support branch from cead22f to 6ec3fec Compare July 24, 2026 18:02
@Rodriguespn Rodriguespn changed the title feat(eval): add OpenCode agent harness + Kimi K3 via the AI Gateway feat(eval): add OpenCode agent harness Jul 24, 2026
@Rodriguespn
Rodriguespn changed the base branch from explore/ai-gateway-vendor-provider to main July 24, 2026 18:03
@Rodriguespn

Copy link
Copy Markdown
Contributor Author

Closing in favor of #126

mattrossman added a commit that referenced this pull request Jul 28, 2026
…way (#126)

Adds `opencode` as a CLI agent harness plus two experiments running Kimi
K3 through the [Vercel AI Gateway](https://vercel.com/ai-gateway):
`opencode-kimi-k3` and `opencode-kimi-k3-no-skills`. Consolidates parts
of #56, #120, and #124 per [this
thread](https://supabase.slack.com/archives/C0BAGJBL49E/p1784919389986449?thread_ts=1784890581.560609&cid=C0BAGJBL49E).
AI gateway is used only for OpenCode w/ the new experiments. Uses
OpenCode's [native `vercel`
provider](https://vercel.com/docs/ai-gateway/coding-agents/opencode), so
the only credential is `AI_GATEWAY_API_KEY` which is already configured
in repo secrets.

The CLI is pinned to 1.18.5 and must stay >= 1.17.0. Older versions
don't await the run event loop
([opencode#31389](anomalyco/opencode#31389)) and
intermittently exit mid-step with no final report, which was failing
about half of sandbox runs regardless of model.

Failures like that used to be invisible: results JSON just showed an
empty transcript with `stoppedReason: "error"`. Running with `--debug`
now prints opencode's actual errors, which is how this was diagnosed:

```
OpenCode error event: {"name":"UnknownError","data":{"message":"Unexpected server error. Check server logs for details.","ref":"err_1ffd1f34"}}
```

Incidental fix: eval refresh jobs now fail when the experiment writes no
result instead of green-skipping (surfaced by a missing
`AI_GATEWAY_API_KEY` in the workflow env, now also wired up).

To test locally, add `AI_GATEWAY_API_KEY` to `.env` (create one in the
[evals Vercel project](https://vercel.com/supabase/evals) under AI
Gateway → API keys), then:

```sh
pnpm eval -- --experiment opencode-kimi-k3 --eval investigate-db-001-table-row-counts
```

Closes AI-967, AI-964, AI-965

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@raulb
raulb deleted the pedrorodrigues/add-opencode-agent-support branch July 29, 2026 11:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant