Skip to content

feat(chat): add web_search convenience tool (#2306)#2575

Merged
mrveiss merged 3 commits intoDev_new_guifrom
fix/issue-2306-web-search
Mar 27, 2026
Merged

feat(chat): add web_search convenience tool (#2306)#2575
mrveiss merged 3 commits intoDev_new_guifrom
fix/issue-2306-web-search

Conversation

@mrveiss
Copy link
Copy Markdown
Owner

@mrveiss mrveiss commented Mar 27, 2026

Summary

  • Adds web_search tool to the chat agent's tool dispatcher so small models (Mistral 7B) can search the web with a single tool call instead of orchestrating a multi-step browser flow
  • Primary search path reuses existing search_web_embedded from playwright_service.py; falls back to DuckDuckGo HTML via browser VM
  • Updates system prompt to document the new tool and direct agents to prefer it over manual browser navigation

Changes

File Change
chat_workflow/tool_handler.py New _handle_web_search_tool, _execute_web_search, _web_search_via_playwright, _web_search_via_browser_vm methods; dispatch routing; known tools list
chat_workflow/manager.py Added web_search to #2310 tools reminder
resources/prompts/chat/system_prompt_simple.md Tool documentation, examples, usage guidance

Test plan

  • Send "find restaurants near Kekava, Latvia" to chat agent — verify web_search tool is called (not hallucinated names)
  • Verify structured results returned when Playwright service is available
  • Verify DuckDuckGo HTML fallback works when Playwright is unavailable
  • Verify empty query returns descriptive error
  • Verify web_search appears in known tools list on invalid tool error
  • Verify Feature: Auto-inject available tools reminder after repeated invalid tool calls #2310 tools reminder includes web_search

Closes #2306

The chat agent previously had no simple web search capability — small
models had to orchestrate a multi-step browser flow (navigate → fill →
click → get_text) which they couldn't do reliably. This adds a single
`web_search` tool that accepts a query and returns results.

Implementation:
- New `_handle_web_search_tool` dispatch in tool_handler.py
- Primary path: reuse existing `search_web_embedded` from playwright_service
- Fallback path: DuckDuckGo HTML via browser VM `send_to_browser_vm`
- Added `web_search` to known tools list (error messages + #2310 reminder)
- Updated system_prompt_simple.md with tool documentation and examples
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 27, 2026

⚠️ SSOT Configuration Compliance: Violations Found

Metric Count
Total Violations 2
SSOT Violations (high priority) 1
Other Violations 1

⚠️ 1 values have SSOT config equivalents!

These should be replaced with SSOT config imports:

Python:

from src.config.ssot_config import config
# Use: config.vm.main, config.port.backend, config.backend_url

TypeScript:

import config from '@/config/ssot-config'
// Use: config.vm.main, config.port.backend, config.backendUrl

📖 See SSOT_CONFIG_GUIDE.md for documentation.

mrveiss added 2 commits March 27, 2026 20:21
…2306)

Code review feedback: when DuckDuckGo results exceed 3000 chars, append
"... [results truncated]" so the LLM knows it received partial data.
…rowser tools (#2593, #2594)

#2593: system_prompt.md was missing browser tools and web_search documentation
that system_prompt_simple.md already had. Added matching sections.

#2594: ToolRegistry.get_available_tools() only listed legacy tools. Added
web_search (#2306) and browser tools (#1368) to match the chat workflow's
ToolHandlerMixin dispatch capabilities.
@mrveiss mrveiss merged commit 53a19c2 into Dev_new_gui Mar 27, 2026
4 of 5 checks passed
@mrveiss mrveiss deleted the fix/issue-2306-web-search branch March 27, 2026 19:19
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.

1 participant