Skip to content

feat: Exa.ai web search as supplementary context in the answer pipeline#56

Draft
Copilot wants to merge 2 commits into
mainfrom
copilot/implement-web-search-features
Draft

feat: Exa.ai web search as supplementary context in the answer pipeline#56
Copilot wants to merge 2 commits into
mainfrom
copilot/implement-web-search-features

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 6, 2026

Adds opt-in web search via Exa.ai so the grounded-answer agent can draw on live web content when the knowledge base lacks coverage.

Changes

lib/exa-search.ts (new)

  • Wraps exa.searchAndContents() — neural search, useAutoprompt, up to 3 results × 1,500 chars each
  • Returns '' (safe no-op) when EXA_API_KEY is absent or the call fails

Reply pipeline (webhooks/reply + sandbox)

  • searchWeb() runs in parallel with MCP/embedding work — no serial latency added
  • webContext threaded into runGroundedAnswerAgent and injected into the prompt between live API data and KB sections
  • Sandbox early-return (no KB content → short-circuit) now gates on !retrievedContext.trim() && !webContext.trim(), allowing pure-web answers when the KB is empty

Dashboard

  • WelcomeDashboard gains a webSearchEnabled: boolean prop (both org pages pass !!process.env.EXA_API_KEY)
  • Renders a "🌐 Web Search On/Off" status chip alongside the existing stat chips

Config

  • EXA_API_KEY= added to env.example

Enabling

Set EXA_API_KEY in your environment. No DB migrations required — feature is entirely env-gated.

// lib/exa-search.ts
export async function searchWeb(query: string): Promise<string> {
  const apiKey = process.env.EXA_API_KEY;
  if (!apiKey) return ''; // silently disabled

  const exa = new Exa(apiKey);
  const result = await exa.searchAndContents(query, {
    numResults: 3,
    type: 'neural',
    useAutoprompt: true,
    text: { maxCharacters: 1500 },
  });
  // ...formatted citation blocks
}

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@vercel
Copy link
Copy Markdown

vercel Bot commented Mar 6, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
answerify Error Error Mar 6, 2026 3:24am

Co-authored-by: harshithpabbati <43822585+harshithpabbati@users.noreply.github.com>
Copilot AI changed the title [WIP] Implement web search functionality with exa.ai feat: Exa.ai web search as supplementary context in the answer pipeline Mar 6, 2026
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