SWE-AF
SWE-AF copied to clipboard
Optional web search: Keenable as a keyless opt-in next to Exa
I work with Keenable, so saying that up front.
Problem
Web search on the open runtime needs OPENCODE_ENABLE_EXA=1 plus an EXA_API_KEY. Without an Exa key, coding and review agents have no way to look up docs, library APIs or deprecations during a build. The Claude runtime isn't wired either (README, "Optional: web search").
Proposed Solution
Add Keenable as a second opt-in option. Exa and its env vars stay exactly as they are.
- Gate: a new env flag, for example
SWE_AF_ENABLE_KEENABLE=1, with an optionalKEENABLE_API_KEY. - Wiring: when the flag is set, opencode gets a remote MCP server named
keenable. It points athttps://api.keenable.ai/mcp-publicwith no key, orhttps://api.keenable.ai/mcpwith the key asX-API-Key. The server exposessearch_web_pagesandfetch_page_content. - Limits without a key: 1,000 requests per hour and 10 per second per IP (rate limits), so a deploy can turn on search without signing up for anything.
- Guardrail:
_websearch_enabled()inswe_af/tools/web_search.pyandwebsearchEnabled()ingo/internal/tools/websearch.gowould also return true when the Keenable flag is set. The coder guardrail would name the Keenable tools alongsidewebsearch/webfetch. Both ports stay byte-identical. - Tests:
tests/test_web_search_guardrail.pyand the Go test get the new env cases. - Docs: one block each in
.env.exampleand the README.
Question before I write it
Where would you want the MCP entry to live? I see two options:
- A disabled-by-default entry in the image's
opencode.json. - Config injected at run time only when the flag is set.
I'd lean towards (2) so nothing changes for existing deploys.
Acceptance Criteria
- [ ] Off by default; Exa behaviour unchanged
- [ ] Flag set → open runtime agents can call Keenable search and fetch, keyless or keyed
- [ ] Guardrail applies for either provider, Python and Go identical
- [ ]
make checkpasses
Happy to send the PR once you're fine with the approach