Web Search Tool for Timmy #20

Open
opened 2026-03-20 22:26:02 +00:00 by replit · 0 comments
Owner

What & Why

Timmy's knowledge is frozen at his training cutoff. A web search tool lets him answer questions about current events, verify facts, look up documentation, and fetch real-world data. Dramatically increases the range and accuracy of jobs Timmy can handle.

Done looks like

  • Timmy has access to a web search tool during job execution (Claude tool use / function calling)
  • When Timmy decides to search, Workshop shows a 'Searching: [query]' indicator near the work agent
  • Search results (top 3-5 snippets) injected into Timmy's context; Timmy cites sources in response
  • Tool calls tracked: each search logged (query, source URLs) with the job record
  • Search usage adds small cost increment (passed through to visitor)
  • SEARCH_PROVIDER env var selects backend (default: Brave Search API; fallback: no-op stub)

Out of scope

  • Full web page content fetching (snippets only)
  • Image search
  • Cached or deduplicated search results

Tasks

  1. Search provider integration — Implement webSearch(query) service using Brave Search API (or stub); return top 5 title+snippet+url results as structured JSON.
  2. Tool use in agent — Register web_search as a Claude tool in the work model call; handle tool invocation in the agent loop.
  3. Tool activity broadcast — When a search tool call is made, emit tool_use WebSocket event for the Workshop to show the 'Searching: [query]' indicator.
  4. Citation rendering — Parse and render source URLs in job result; display as a collapsible 'Sources' section.
  5. Cost tracking — Add search call count to job cost ledger; include in pricing estimate and final cost breakdown.

Relevant files

  • artifacts/api-server/src/lib/agent.ts
  • artifacts/api-server/src/lib/pricing.ts
  • artifacts/api-server/src/routes/jobs.ts
  • artifacts/api-server/src/routes/events.ts
  • the-matrix/js/ui.js
  • the-matrix/js/websocket.js
## What & Why Timmy's knowledge is frozen at his training cutoff. A web search tool lets him answer questions about current events, verify facts, look up documentation, and fetch real-world data. Dramatically increases the range and accuracy of jobs Timmy can handle. ## Done looks like - Timmy has access to a web search tool during job execution (Claude tool use / function calling) - When Timmy decides to search, Workshop shows a 'Searching: [query]' indicator near the work agent - Search results (top 3-5 snippets) injected into Timmy's context; Timmy cites sources in response - Tool calls tracked: each search logged (query, source URLs) with the job record - Search usage adds small cost increment (passed through to visitor) - `SEARCH_PROVIDER` env var selects backend (default: Brave Search API; fallback: no-op stub) ## Out of scope - Full web page content fetching (snippets only) - Image search - Cached or deduplicated search results ## Tasks 1. **Search provider integration** — Implement `webSearch(query)` service using Brave Search API (or stub); return top 5 title+snippet+url results as structured JSON. 2. **Tool use in agent** — Register `web_search` as a Claude tool in the work model call; handle tool invocation in the agent loop. 3. **Tool activity broadcast** — When a search tool call is made, emit `tool_use` WebSocket event for the Workshop to show the 'Searching: [query]' indicator. 4. **Citation rendering** — Parse and render source URLs in job result; display as a collapsible 'Sources' section. 5. **Cost tracking** — Add search call count to job cost ledger; include in pricing estimate and final cost breakdown. ## Relevant files - `artifacts/api-server/src/lib/agent.ts` - `artifacts/api-server/src/lib/pricing.ts` - `artifacts/api-server/src/routes/jobs.ts` - `artifacts/api-server/src/routes/events.ts` - `the-matrix/js/ui.js` - `the-matrix/js/websocket.js`
replit added the aibackendworkshopfrontend labels 2026-03-20 22:26:02 +00:00
gemini was assigned by Rockachopa 2026-03-22 23:37:39 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: replit/timmy-tower#20