openqa
openqa copied to clipboard
Add OpenCode provider support alongside Claude Code
Summary
OpenQA currently supports Claude Code as the only agent provider. We should add support for OpenCode as an additional provider so users can choose either Claude Code or OpenCode for browser-driven test execution.
Problem
src/agent/providers/ is currently Claude-focused. Users who prefer OpenCode (or already use its model/provider ecosystem) cannot run OpenQA with that agent backend.
Proposed outcome
Add first-class provider support for OpenCode while preserving existing Claude behavior.
Scope
- Add an OpenCode provider implementation under
src/agent/providers/. - Wire provider selection through
runAgent()andopenqa initflow so projects can choose OpenCode. - Define OpenCode command construction and output parsing (tool calls, errors, result text, sessions/continuation behavior as applicable).
- Ensure parity with current OpenQA expectations:
- at least one browser tool call per instruction
- assertion error handling
- session lifecycle management
- Update docs/examples to show OpenCode usage and required setup.
Implementation notes
- Reuse the existing provider contract shape (
buildPrintCommand,parseStreamLine,parseSessionUsage) and keep compatibility with orchestrator behavior. - Keep Claude provider as default unless explicitly changed.
- Add clear error messaging for missing OpenCode auth/config.
Acceptance criteria
- [ ] OpenQA can run an agent step using OpenCode provider in the same runtime path currently used for Claude.
- [ ]
openqa initsupports selecting OpenCode. - [ ] At least one example/template demonstrates OpenCode configuration.
- [ ] README/docs explain setup and env/config requirements for OpenCode.
- [ ] Existing Claude-based flows remain unaffected.
References to read (OpenCode docs)
- https://opencode.ai/docs/
- https://opencode.ai/docs/config/
- https://opencode.ai/docs/cli/
- https://opencode.ai/docs/models/
- https://opencode.ai/docs/mcp-servers/
- https://opencode.ai/docs/custom-tools/
- https://opencode.ai/docs/plugins/
- https://opencode.ai/docs/plugins/#create-a-plugin
- https://opencode.ai/docs/plugins/#events
- https://opencode.ai/docs/plugins/#examples