Skip to content

feat: add web_search.google_cse_base_url setting - #525

Open
Specstreamai wants to merge 1 commit into
CraftOS-dev:devfrom
Specstreamai:feat/web-search-cse-base-url
Open

Specstreamai wants to merge 1 commit into
CraftOS-dev:devfrom
Specstreamai:feat/web-search-cse-base-url

Conversation

@Specstreamai

Copy link
Copy Markdown

What

  • New optional setting web_search.google_cse_base_url, read by get_web_search_cse_base_url() in app/config.py next to get_web_search_cse_id().
  • When it's set, google_cse_search builds the customsearch client with client_options={"api_endpoint": ...}, so requests go to <base_url>/customsearch/v1 with the same key, cx and q. Empty keeps Google's endpoint.
  • Added the empty default in settings.json, _get_default_settings() and the settings manager defaults, and a line in both copies of the AGENT.md settings schema.

Why

Google's overview page says "Existing Custom Search JSON API customers have until January 1, 2027 to transition to an alternative solution" (https://developers.google.com/custom-search/v1/overview). After that, anyone with a Google key and CSE ID gets a failed Google call on every search and quietly lands on the DuckDuckGo fallback, with nothing in settings to point the Google path elsewhere.

The client is built with developerKey, and the library only looks up default credentials when there is no developer key (googleapiclient/discovery.py, if scopes and not developerKey), so the only thing that reaches a configured host is the same key that Google gets today.

How to test

  • python -m pytest tests/test_web_search_cse_base_url.py -q: 2 passed. It runs the real web_search action with the real discovery client and a recording http, and checks the request URI starts with https://customsearch.googleapis.com/customsearch/v1? when the setting is empty and with https://cse.example.com/customsearch/v1? when it's set, with the result coming from that response and not the DuckDuckGo fallback.
  • python -m pytest tests/test_action_set_loading.py -q: 11 passed. I didn't run the rest of the suite.
  • ruff format --check and ruff check clean on the changed files, and python -m compileall -q app agent_core agents decorators skills passes.

Screenshots / Logs

Not UI-facing.

I run a search API that answers in the Custom Search JSON format, which is how I ran into the date.

Google ends the Custom Search JSON API for existing customers on January 1, 2027, and the Google path had no way to point at another host, so it would fail and drop to DuckDuckGo. Empty keeps Google's endpoint.

Signed-off-by: Tarek Etman <tarek@specstream.ai>
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