Add research tool for web-based research via scout agent

New tool that spawns a scout agent to perform web research and return
a structured research brief. The scout agent uses webdriver to browse
the web and returns a decision-ready report.

Changes:
- Added 'research' tool definition (12 core tools total)
- Added research tool dispatch in tool_dispatch.rs
- Created tools/research.rs implementation:
  - Spawns 'g3 --agent scout <query>' as subprocess
  - Captures stdout and extracts last line (report file path)
  - Reads and returns the report file contents
- Added exclude_research flag to ToolConfig
- Scout agent (agent_name == 'scout') does NOT have access to research
  tool to prevent infinite recursion
- Updated system prompts to describe when to use research tool
- Added scout.md agent prompt with research brief output contract

The research tool is preferred for complex research tasks (APIs, SDKs,
libraries, approaches, bugs). WebDriver can still be used directly for
simple lookups or fine-grained control.
This commit is contained in:
Dhanji R. Prasanna
2026-01-09 15:59:19 +11:00
parent de50726eeb
commit 33e5705fc3
7 changed files with 284 additions and 19 deletions

View File

@@ -114,6 +114,14 @@ If you create temporary files for verification or investigation, place these in
When you need to look up documentation, search for resources, find data online, or simply search the web to complete your task, you have access to WebDriver browser automation tools.
**Preferred: Use the `research` tool for complex research tasks:**
- For researching APIs, SDKs, libraries, approaches, bugs, or any topic requiring web research
- The `research` tool spawns a specialized research agent that browses the web and returns a concise, decision-ready report
- Simply call `research` with a specific query describing what you need to know
- The tool returns a structured brief with options, trade-offs, and recommendations
**Alternative: Use WebDriver directly for simple lookups or when you need fine-grained control:**
**How to use WebDriver for research:**
1. Call `webdriver_start` to begin a browser session (runs Chrome headless by default - no visible window)
2. Use `webdriver_navigate` to go to URLs (search engines, documentation sites, etc.)
@@ -220,6 +228,11 @@ Short description for providers without native calling specs:
- \"context\": 3 (show surrounding lines),
- \"json_style\": \"stream\" (for large results)
- **research**: Perform web-based research and return a structured report
- Format: {\"tool\": \"research\", \"args\": {\"query\": \"your research question\"}}
- Example: {\"tool\": \"research\", \"args\": {\"query\": \"Best Rust HTTP client libraries for async/await\"}}
- Use for researching APIs, SDKs, libraries, approaches, bugs, or any topic requiring web research
# Instructions
1. Analyze the request and break down into smaller tasks if appropriate