feat: SerpApi real-time web search for regulatory queries
From the PR description
Summary
Integrates SerpApi real-time web search into Mike so Sakana Fugu Ultra can access live data for regulatory lookups, LATAM timeline checks, and current pathway information.
Files changed
- backend/src/lib/serpSearch.ts (new): SerpApi module - isSerpEnabled, needsWebSearch (40+ LATAM regulatory keywords), buildSearchQuery, serpSearch (12s timeout), formatSearchContext. Graceful degradation when key absent.
- backend/src/lib/llm/index.ts (modified): streamChatWithTools detects regulatory keywords in last user message, fires SerpApi, prepends context block to system prompt before calling Fugu. Non-fatal.
- backend/.env.example (modified): Added SERPAPI_KEY documentation block.
Railway setup
Settings → Variables → add SERPAPI_KEY (value from serpapi.com/dashboard). Redeploy.
Verify
Send a query with a regulatory term (e.g., "CONIS timeline Panama"). Railway logs should show:
[serpSearch] Injected 5 results for: "..."
Without SERPAPI_KEY set: Mike works identically to before, zero errors.
Our analysis
Add SerpApi real-time web search to Mike's chat pipeline — read the full analysis →
Think the analysis missed something the PR description covers?
Commits in this PR (4)
| SHA | Subject | Author | Date | |
|---|---|---|---|---|
181702db | feat: add SerpApi real-time web search for regulatory queries | Julio G. Martinez-Clark | 2026-06-30 | ↗ GitHub |
commit bodyThis file integrates SerpApi for web search functionality, enabling real-time context for regulatory pathway validation and device classification. It includes methods for checking API key availability, performing searches, and formatting results. | ||||
84399b45 | Integrate real-time web search context in chat completions | Julio G. Martinez-Clark | 2026-06-30 | ↗ GitHub |
Enhanced streamChatWithTools to include real-time regulatory search context when SERPAPI_KEY is set. This allows Fugu to access current regulatory information during chat completions. | ||||
be665b77 | Update .env.example with SerpApi instructions | Julio G. Martinez-Clark | 2026-06-30 | ↗ GitHub |
Added comments for SerpApi configuration and usage. | ||||
b2630dc0 | refactor: enable web search for all queries, not only regulatory keywords | Julio G. Martinez-Clark | 2026-06-30 | ↗ GitHub |
Capture this PR into my fork
Download a Markdown prompt that tells Claude how to port every
commit in this PR into your working tree. Run it via
claude -p < capture-pull-2.md from
inside the repo you want the changes in.