Skip to content

feat: make Serper base URL configurable via AGENT_SERPER_DEV_BASE_URL - #6290

Open
ivashhchenko wants to merge 1 commit into
Mintplex-Labs:masterfrom
ivashhchenko:feat/serper-base-url
Open

feat: make Serper base URL configurable via AGENT_SERPER_DEV_BASE_URL#6290
ivashhchenko wants to merge 1 commit into
Mintplex-Labs:masterfrom
ivashhchenko:feat/serper-base-url

Conversation

@ivashhchenko

Copy link
Copy Markdown

The Serper endpoint is hardcoded in the web-browsing agent plugin:

const { response, error } = await fetch(
  "https://google.serper.dev/search",

Anyone who needs that request to go elsewhere has to patch the file and carry the patch across upgrades. It comes up in a few ordinary situations: an egress proxy on a locked-down network, a regional endpoint for latency or data residency, and pointing the agent at a local mock during development so tests do not make live calls.

Approach

This follows the convention already in the codebase. updateENV.js registers AgentSearXNGApiUrl → AGENT_SEARXNG_API_URL, a provider URL sitting next to its key — so Serper gets the same treatment:

AgentSerperApiKey: {
  envKey: "AGENT_SERPER_DEV_KEY",
  checks: [],
},
AgentSerperApiUrl: {
  envKey: "AGENT_SERPER_DEV_BASE_URL",
  checks: [],
},

and the plugin reads it with the current URL as the default:

const serperBaseUrl = (
  process.env.AGENT_SERPER_DEV_BASE_URL || "https://google.serper.dev"
).replace(/\/+$/, "");

Files

  • server/utils/agents/aibitat/plugins/web-browsing.js — use the variable
  • server/utils/helpers/updateENV.js — register it
  • server/.env.example, docker/.env.example — document it next to the key

Ten added lines, no new dependency. Trailing slashes are stripped so https://host, https://host/ and https://host/// all behave the same, and an unset or empty value resolves to the current endpoint — behaviour is unchanged unless the variable is set.

Happy to add a field to the Web Search admin screen in a follow-up if you would like it configurable from the UI rather than only through the environment.

The Serper endpoint is hardcoded in the web-browsing agent plugin, so
routing it through a proxy or a regional endpoint means patching the file.

Follows the existing convention: AgentSearXNGApiUrl already registers a
provider URL alongside its key in updateENV.js. Defaults to the current
URL, so existing installs are unaffected.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.

2 participants