SWE-AF icon indicating copy to clipboard operation
SWE-AF copied to clipboard

Optional web search: Keenable as a keyless opt-in next to Exa

Open KGKallasmaa opened this issue 2 weeks ago • 0 comments

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 optional KEENABLE_API_KEY.
  • Wiring: when the flag is set, opencode gets a remote MCP server named keenable. It points at https://api.keenable.ai/mcp-public with no key, or https://api.keenable.ai/mcp with the key as X-API-Key. The server exposes search_web_pages and fetch_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() in swe_af/tools/web_search.py and websearchEnabled() in go/internal/tools/websearch.go would also return true when the Keenable flag is set. The coder guardrail would name the Keenable tools alongside websearch/webfetch. Both ports stay byte-identical.
  • Tests: tests/test_web_search_guardrail.py and the Go test get the new env cases.
  • Docs: one block each in .env.example and the README.

Question before I write it

Where would you want the MCP entry to live? I see two options:

  1. A disabled-by-default entry in the image's opencode.json.
  2. 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 check passes

Happy to send the PR once you're fine with the approach

KGKallasmaa avatar Nov 14 '26 08:11 KGKallasmaa