Spaces:
Running
A newer version of the Gradio SDK is available:
6.0.2
Web Search Tool Assessment
Executive Summary
The application has two separate web search implementations with different readiness levels:
WebSearchTool(src/tools/web_search.py) - Partially Ready β οΈ- Functional but NOT compliant with
SearchToolprotocol - NOT integrated into main search handler
- Only used in magentic orchestrator's retrieval agent
- Functional but NOT compliant with
web_search_adapter(src/tools/web_search_adapter.py) - Functional β- Used by tool executor for WebSearchAgent tasks
- Relies on legacy
folder/tools/web_search.pyimplementation
Detailed Analysis
1. WebSearchTool (src/tools/web_search.py)
Current Implementation
- Location:
src/tools/web_search.py - Provider: DuckDuckGo (no API key required)
- Status: β οΈ Partially Ready
Issues Identified
β Protocol Non-Compliance:
# Missing required 'name' property
class WebSearchTool:
# Should have: @property def name(self) -> str: return "web"
# Wrong return type - should return list[Evidence], not SearchResult
async def search(self, query: str, max_results: int = 10) -> SearchResult:
# Returns SearchResult instead of list[Evidence]
Comparison with other tools:
PubMedToolhas@property def name(self) -> str: return "pubmed"PubMedTool.search()returnslist[Evidence]WebSearchToolreturnsSearchResult(containsevidencelist inside)
β Not Integrated:
- NOT included in
SearchHandlerinitialization insrc/app.py:search_handler = SearchHandler( tools=[PubMedTool(), ClinicalTrialsTool(), EuropePMCTool()], # WebSearchTool() is missing! )
β Current Usage:
- Used in
src/agents/retrieval_agent.py(magentic orchestrator):from src.tools.web_search import WebSearchTool _web_search = WebSearchTool()
Fix Required
To make WebSearchTool compliant and usable:
Add
nameproperty:@property def name(self) -> str: return "web"Fix return type:
async def search(self, query: str, max_results: int = 10) -> list[Evidence]: # ... existing code ... return evidence # Return list[Evidence] directly, not SearchResultRegister in SearchHandler:
from src.tools.web_search import WebSearchTool search_handler = SearchHandler( tools=[ PubMedTool(), ClinicalTrialsTool(), EuropePMCTool(), WebSearchTool() # Add this ], )
2. web_search_adapter (src/tools/web_search_adapter.py)
Current Implementation
- Location:
src/tools/web_search_adapter.py - Status: β Functional
- Provider: Uses legacy
folder/tools/web_search.py(Serper/SearchXNG)
Usage
Used by
src/tools/tool_executor.pyforWebSearchAgenttasks:if task.agent == "WebSearchAgent": result_text = await web_search(task.query)Used by
src/orchestrator/planner_agent.pyfor background context
Dependencies
- Requires
folder/tools/web_search.py(legacy implementation) - Supports Serper API (requires
SERPER_API_KEY) - Supports SearchXNG API (requires
SEARCHXNG_HOST)
Limitations
- Returns formatted string (not
Evidenceobjects) - Not integrated with
SearchHandler(different execution path) - Depends on legacy folder structure
Integration Status
SearchHandler Integration
Current State: β NOT Integrated
The main SearchHandler in src/app.py only includes:
PubMedTool()ClinicalTrialsTool()EuropePMCTool()
WebSearchTool is missing from the main search flow.
Tool Executor Integration
Current State: β Integrated
web_search_adapter is used via tool_executor.py:
- Executes when
AgentTask.agent == "WebSearchAgent" - Used in iterative/deep research flows
- Returns formatted text (not Evidence objects)
Magentic Orchestrator Integration
Current State: β Integrated
WebSearchTool is used in retrieval_agent.py:
- Direct instantiation:
_web_search = WebSearchTool() - Used via
search_web()function - Updates workflow state with evidence
Can It Be Used?
WebSearchTool (src/tools/web_search.py)
Status: β οΈ Can be used, but with limitations
Can be used:
- β In magentic orchestrator (already working)
- β As standalone tool (functional)
Cannot be used:
- β In
SearchHandler(protocol non-compliance) - β In parallel search flows (not registered)
To make fully usable:
- Fix protocol compliance (add
name, fix return type) - Register in
SearchHandler - Test integration
web_search_adapter
Status: β Can be used
Can be used:
- β
Via
tool_executorfor WebSearchAgent tasks - β In planner agent for background context
- β In iterative/deep research flows
Limitations:
- Returns string format (not Evidence objects)
- Requires legacy folder dependencies
- Different execution path than SearchHandler
Recommendations
Priority 1: Fix WebSearchTool Protocol Compliance
Make WebSearchTool fully compliant with SearchTool protocol:
- Add
nameproperty - Change return type from
SearchResulttolist[Evidence] - Update all callers if needed
Priority 2: Integrate into SearchHandler
Add WebSearchTool to main search flow:
from src.tools.web_search import WebSearchTool
search_handler = SearchHandler(
tools=[
PubMedTool(),
ClinicalTrialsTool(),
EuropePMCTool(),
WebSearchTool() # Add web search
],
)
Priority 3: Consolidate Implementations
Consider consolidating the two implementations:
- Keep
WebSearchToolas the main implementation - Deprecate or migrate
web_search_adapterusage - Remove dependency on
folder/tools/web_search.py
Priority 4: Testing
Add tests for:
- Protocol compliance
- SearchHandler integration
- Error handling
- Rate limiting (if needed)
Summary Table
| Component | Status | Protocol Compliant | Integrated | Can Be Used |
|---|---|---|---|---|
WebSearchTool |
β οΈ Partial | β No | β No | β οΈ Limited |
web_search_adapter |
β Functional | N/A | β Yes (tool_executor) | β Yes |
Conclusion
The web search functionality exists in two forms:
WebSearchToolis functional but needs protocol fixes to be fully integratedweb_search_adapteris working but uses a different execution path
Recommendation: Fix WebSearchTool protocol compliance and integrate it into SearchHandler for unified search capabilities across all orchestrators.