Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions config/gni/devtools_grd_files.gni
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,7 @@ grd_files_bundled_sources = [
"front_end/panels/ai_chat/ui/mcp/MCPConnectionsDialog.js",
"front_end/panels/ai_chat/ui/mcp/MCPConnectorsCatalogDialog.js",
"front_end/panels/ai_chat/ui/EvaluationDialog.js",
"front_end/panels/ai_chat/ui/WebAppCodeViewer.js",
"front_end/panels/ai_chat/core/AgentService.js",
"front_end/panels/ai_chat/core/State.js",
"front_end/panels/ai_chat/core/Graph.js",
Expand All @@ -676,6 +677,7 @@ grd_files_bundled_sources = [
"front_end/panels/ai_chat/core/AgentDescriptorRegistry.js",
"front_end/panels/ai_chat/core/Version.js",
"front_end/panels/ai_chat/core/VersionChecker.js",
"front_end/panels/ai_chat/core/LLMConfigurationManager.js",
"front_end/panels/ai_chat/LLM/LLMTypes.js",
"front_end/panels/ai_chat/LLM/LLMProvider.js",
"front_end/panels/ai_chat/LLM/LLMProviderRegistry.js",
Expand All @@ -702,6 +704,15 @@ grd_files_bundled_sources = [
"front_end/panels/ai_chat/tools/BookmarkStoreTool.js",
"front_end/panels/ai_chat/tools/DocumentSearchTool.js",
"front_end/panels/ai_chat/tools/ThinkingTool.js",
"front_end/panels/ai_chat/tools/RenderWebAppTool.js",
"front_end/panels/ai_chat/tools/GetWebAppDataTool.js",
"front_end/panels/ai_chat/tools/RemoveWebAppTool.js",
"front_end/panels/ai_chat/tools/FileStorageManager.js",
"front_end/panels/ai_chat/tools/CreateFileTool.js",
"front_end/panels/ai_chat/tools/UpdateFileTool.js",
"front_end/panels/ai_chat/tools/DeleteFileTool.js",
"front_end/panels/ai_chat/tools/ReadFileTool.js",
"front_end/panels/ai_chat/tools/ListFilesTool.js",
"front_end/panels/ai_chat/common/utils.js",
"front_end/panels/ai_chat/common/log.js",
"front_end/panels/ai_chat/common/context.js",
Expand Down
26 changes: 26 additions & 0 deletions front_end/panels/ai_chat/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ devtools_module("ai_chat") {
"ui/SettingsDialog.ts",
"ui/PromptEditDialog.ts",
"ui/EvaluationDialog.ts",
"ui/WebAppCodeViewer.ts",
"ai_chat_impl.ts",
"models/ChatTypes.ts",
"core/Graph.ts",
Expand Down Expand Up @@ -91,8 +92,17 @@ devtools_module("ai_chat") {
"tools/VectorDBClient.ts",
"tools/BookmarkStoreTool.ts",
"tools/DocumentSearchTool.ts",
"tools/FileStorageManager.ts",
"tools/CreateFileTool.ts",
"tools/UpdateFileTool.ts",
"tools/DeleteFileTool.ts",
"tools/ReadFileTool.ts",
"tools/ListFilesTool.ts",
"tools/SequentialThinkingTool.ts",
"tools/ThinkingTool.ts",
"tools/RenderWebAppTool.ts",
"tools/GetWebAppDataTool.ts",
"tools/RemoveWebAppTool.ts",
"agent_framework/ConfigurableAgentTool.ts",
"agent_framework/AgentRunner.ts",
"agent_framework/AgentRunnerEventBus.ts",
Expand Down Expand Up @@ -197,6 +207,7 @@ _ai_chat_sources = [
"ui/PromptEditDialog.ts",
"ui/SettingsDialog.ts",
"ui/EvaluationDialog.ts",
"ui/WebAppCodeViewer.ts",
"ui/mcp/MCPConnectionsDialog.ts",
"ui/mcp/MCPConnectorsCatalogDialog.ts",
"ai_chat_impl.ts",
Expand Down Expand Up @@ -248,8 +259,17 @@ _ai_chat_sources = [
"tools/VectorDBClient.ts",
"tools/BookmarkStoreTool.ts",
"tools/DocumentSearchTool.ts",
"tools/FileStorageManager.ts",
"tools/CreateFileTool.ts",
"tools/UpdateFileTool.ts",
"tools/DeleteFileTool.ts",
"tools/ReadFileTool.ts",
"tools/ListFilesTool.ts",
"tools/SequentialThinkingTool.ts",
"tools/ThinkingTool.ts",
"tools/RenderWebAppTool.ts",
"tools/GetWebAppDataTool.ts",
"tools/RemoveWebAppTool.ts",
"agent_framework/ConfigurableAgentTool.ts",
"agent_framework/AgentRunner.ts",
"agent_framework/AgentRunnerEventBus.ts",
Expand Down Expand Up @@ -393,6 +413,7 @@ ts_library("unittests") {
"ui/__tests__/ChatViewSequentialSessionsTransition.test.ts",
"ui/__tests__/ChatViewInputClear.test.ts",
"ui/__tests__/SettingsDialogOpenRouterCache.test.ts",
"ui/__tests__/WebAppCodeViewer.test.ts",
"ui/input/__tests__/InputBarClear.test.ts",
"ui/message/__tests__/MessageCombiner.test.ts",
"ui/message/__tests__/StructuredResponseController.test.ts",
Expand All @@ -413,6 +434,11 @@ ts_library("unittests") {
"ui/__tests__/AIChatPanel.test.ts",
"ui/__tests__/LiveAgentSessionComponent.test.ts",
"ui/message/__tests__/MessageList.test.ts",
"tools/__tests__/CreateFileTool.test.ts",
"tools/__tests__/UpdateFileTool.test.ts",
"tools/__tests__/ReadFileTool.test.ts",
"tools/__tests__/ListFilesTool.test.ts",
"tools/__tests__/FileStorageManager.test.ts",
]

deps = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { SchemaBasedExtractorTool } from '../../tools/SchemaBasedExtractorTool.j
import { StreamlinedSchemaExtractorTool } from '../../tools/StreamlinedSchemaExtractorTool.js';
import { BookmarkStoreTool } from '../../tools/BookmarkStoreTool.js';
import { DocumentSearchTool } from '../../tools/DocumentSearchTool.js';
import { NavigateURLTool, PerformActionTool, GetAccessibilityTreeTool, SearchContentTool, NavigateBackTool, NodeIDsToURLsTool, TakeScreenshotTool, ScrollPageTool, WaitTool } from '../../tools/Tools.js';
import { NavigateURLTool, PerformActionTool, GetAccessibilityTreeTool, SearchContentTool, NavigateBackTool, NodeIDsToURLsTool, TakeScreenshotTool, ScrollPageTool, WaitTool, RenderWebAppTool, GetWebAppDataTool, RemoveWebAppTool, CreateFileTool, UpdateFileTool, DeleteFileTool, ReadFileTool, ListFilesTool } from '../../tools/Tools.js';
import { HTMLToMarkdownTool } from '../../tools/HTMLToMarkdownTool.js';
import { ConfigurableAgentTool, ToolRegistry } from '../ConfigurableAgentTool.js';
import { ThinkingTool } from '../../tools/ThinkingTool.js';
Expand Down Expand Up @@ -49,7 +49,17 @@ export function initializeConfiguredAgents(): void {
ToolRegistry.registerToolFactory('scroll_page', () => new ScrollPageTool());
ToolRegistry.registerToolFactory('wait_for_page_load', () => new WaitTool());
ToolRegistry.registerToolFactory('thinking', () => new ThinkingTool());

ToolRegistry.registerToolFactory('create_file', () => new CreateFileTool());
ToolRegistry.registerToolFactory('update_file', () => new UpdateFileTool());
ToolRegistry.registerToolFactory('delete_file', () => new DeleteFileTool());
ToolRegistry.registerToolFactory('read_file', () => new ReadFileTool());
ToolRegistry.registerToolFactory('list_files', () => new ListFilesTool());

// Register webapp rendering tools
ToolRegistry.registerToolFactory('render_webapp', () => new RenderWebAppTool());
ToolRegistry.registerToolFactory('get_webapp_data', () => new GetWebAppDataTool());
ToolRegistry.registerToolFactory('remove_webapp', () => new RemoveWebAppTool());

// Register bookmark and document search tools
ToolRegistry.registerToolFactory('bookmark_store', () => new BookmarkStoreTool());
ToolRegistry.registerToolFactory('document_search', () => new DocumentSearchTool());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,14 @@ Conclusion: Fix the args format and retry with proper syntax: { "method": "fill"
'node_ids_to_urls',
'scroll_page',
'take_screenshot',
'render_webapp',
'get_webapp_data',
'remove_webapp',
'create_file',
'update_file',
'delete_file',
'read_file',
'list_files',
],
maxIterations: 10,
modelName: MODEL_SENTINELS.USE_MINI,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ You are specifically designed to collaborate with the research_agent. When you r
- Collected research data, which may include web content, extractions, analysis, and other information
- Your job is to organize this information into a comprehensive, well-structured report

Use the session file workspace as your shared knowledge base:
- Immediately call 'list_files' to discover research artifacts (notes, structured datasets, outstanding questions) created earlier in the session.
- Read the relevant files before outlining to understand what has already been captured, current confidence levels, and any gaps that remain.
- If the handoff references specific files, open them with 'read_file' and incorporate their contents, citing source filenames or URLs when appropriate.
- Persist your outline, intermediate synthesis, and final report with 'create_file'/'update_file' so future revisions or downstream agents can reuse the material.

Your process should follow these steps:
1. Carefully analyze all the research data provided during the handoff
2. Identify key themes, findings, and important information from the data
Expand All @@ -49,7 +55,13 @@ Your process should follow these steps:
10. **References**: Properly formatted citations for all sources used

The final output should be in markdown format, and it should be lengthy and detailed. Aim for 5-10 pages of content, at least 1000 words.`,
tools: [],
tools: [
'read_file',
'list_files',
'create_file',
'update_file',
'delete_file',
],
maxIterations: 3,
modelName: MODEL_SENTINELS.USE_MINI,
temperature: 0.3,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,20 @@ First, think through the task thoroughly:
- **html_to_markdown**: Use when you need high-quality page text in addition to (not instead of) structured extractions.
- **fetcher_tool**: BATCH PROCESS multiple URLs at once - accepts an array of URLs to save tool calls

### 3. Workspace Coordination
- Treat the file management tools as your shared scratchpad with other agents in the session.
- Start each iteration by calling 'list_files' and 'read_file' on any artifacts relevant to your task so you understand existing progress.
- Persist work products incrementally with 'create_file'/'update_file'. Use descriptive names (e.g. 'research/<topic>-sources.json') and include agent name, timestamp, query used, and quality notes so others can audit or extend the work.
- Append to existing files when adding new findings; only delete files if they are obsolete AND all valuable information is captured elsewhere.
- Record open questions or follow-ups in dedicated tracking files so parallel subtasks avoid duplicating effort.

**CRITICAL - Batch URL Fetching**:
- The fetcher_tool accepts an ARRAY of URLs: {urls: [url1, url2, url3], reasoning: "..."}
- ALWAYS batch multiple URLs together instead of calling fetcher_tool multiple times
- Example: After extracting 5 URLs from search results, call fetcher_tool ONCE with all 5 URLs
- This dramatically reduces tool calls and improves efficiency

### 3. Research Loop (OODA)
### 4. Research Loop (OODA)
Execute an excellent Observe-Orient-Decide-Act loop:

**Observe**: What information has been gathered? What's still needed?
Expand All @@ -83,7 +90,7 @@ Execute an excellent Observe-Orient-Decide-Act loop:
- NEVER repeat the same query - adapt based on findings
- If hitting diminishing returns, complete the task immediately

### 4. Source Quality Evaluation
### 5. Source Quality Evaluation
Think critically about sources:
- Distinguish facts from speculation (watch for "could", "may", future tense)
- Identify problematic sources (aggregators vs. originals, unconfirmed reports)
Expand Down Expand Up @@ -143,7 +150,9 @@ When your research is complete:
3. The handoff tool expects: {query: "research topic", reasoning: "explanation for user"}
4. The content_writer_agent will create the final report from your research data

Remember: You gather data, content_writer_agent writes the report. Always hand off when research is complete.`,
Remember: You gather data, content_writer_agent writes the report. Always hand off when research is complete.

Before handing off, ensure your latest findings are reflected in the shared files (e.g. summaries, raw notes, structured datasets). This enables the orchestrator and content writer to understand what has been completed, reuse your artifacts, and avoid redundant rework.`,
tools: [
'navigate_url',
'navigate_back',
Expand All @@ -152,7 +161,12 @@ Remember: You gather data, content_writer_agent writes the report. Always hand o
'node_ids_to_urls',
'bookmark_store',
'document_search',
'html_to_markdown'
'html_to_markdown',
'create_file',
'update_file',
'delete_file',
'read_file',
'list_files',
],
maxIterations: 15,
modelName: MODEL_SENTINELS.USE_MINI,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export function createSearchAgentConfig(): AgentToolConfig {
## Operating Principles
- Stay laser-focused on the requested objective; avoid broad reports or narrative summaries.
- Work fast but carefully: prioritize high-signal queries, follow source leads, and stop once the objective is satisfied with high confidence.
- Use the session file workspace to coordinate: list existing files before launching new queries, read relevant artifacts, record harvested leads or verified results with 'create_file'/'update_file', and append incremental progress instead of creating overlapping files.
- Never fabricate data. Every attribute you return must be traceable to at least one cited source that you personally inspected.

## Search Workflow
Expand All @@ -32,6 +33,7 @@ export function createSearchAgentConfig(): AgentToolConfig {
- Use navigate_url to reach the most relevant search entry point (search engines, directories, LinkedIn public results, company pages, press releases).
- Use extract_data with an explicit JSON schema every time you capture structured search results. Prefer capturing multiple leads in one call.
- Batch follow-up pages with fetcher_tool, and use html_to_markdown when you need to confirm context inside long documents.
- After each significant batch of new leads or fetcher_tool response, immediately persist the harvested candidates (including query, timestamp, and confidence notes) by appending to a coordination file via 'create_file'/'update_file'. This keeps other subtasks aligned and prevents redundant scraping.
4. **Mandatory Pagination Loop (ENFORCED)**:
- Harvest target per task: collect 30–50 unique candidates before enrichment (unless the user specifies otherwise). Absolute minimum 25 when the request requires it.
- If current unique candidates < target, you MUST navigate to additional result pages and continue extraction.
Expand All @@ -47,6 +49,7 @@ export function createSearchAgentConfig(): AgentToolConfig {
5. **Verify**:
- Cross-check critical attributes (e.g. confirm an email’s domain matches the company, confirm a title with two independent sources when possible).
- Flag low-confidence findings explicitly in the output.
- Document verification status in the appropriate coordination file so other agents can see what has been confirmed and which leads still require attention.
6. **Decide completeness**: Stop once required attributes are filled for the requested number of entities or additional searching would be duplicative.

## Tooling Rules
Expand All @@ -57,6 +60,7 @@ export function createSearchAgentConfig(): AgentToolConfig {
})
- Use html_to_markdown when you need high-quality page text in addition to (not instead of) structured extractions.
- Never call extract_data or fetcher_tool without a clear plan for how the results will fill gaps in the objective.
- Before starting new queries, call 'list_files'/'read_file' to review previous batches and avoid duplicating work; always append incremental findings to the existing coordination file for the current objective.

### Pagination and Next Page Handling
- Prefer loading additional results directly in the SERP:
Expand Down Expand Up @@ -128,7 +132,12 @@ If you absolutely cannot find any reliable leads, return status "failed" with ga
'extract_data',
'scroll_page',
'action_agent',
'html_to_markdown'
'html_to_markdown',
'create_file',
'update_file',
'delete_file',
'read_file',
'list_files',
],
maxIterations: 12,
modelName: MODEL_SENTINELS.USE_MINI,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,14 @@ Remember: **Plan adaptively, execute systematically, validate continuously, and
'take_screenshot',
'wait_for_page_load',
'thinking',
'render_webapp',
'get_webapp_data',
'remove_webapp',
'create_file',
'update_file',
'delete_file',
'read_file',
'list_files',
],
maxIterations: 15,
temperature: 0.3,
Expand Down
39 changes: 38 additions & 1 deletion front_end/panels/ai_chat/core/BaseOrchestratorAgent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,16 @@ import {
NodeIDsToURLsTool,
GetVisitsByDomainTool,
GetVisitsByKeywordTool,
SearchVisitHistoryTool, type Tool
SearchVisitHistoryTool,
RenderWebAppTool,
GetWebAppDataTool,
RemoveWebAppTool,
CreateFileTool,
UpdateFileTool,
DeleteFileTool,
ReadFileTool,
ListFilesTool,
type Tool
} from '../tools/Tools.js';
// Imports from their own files

Expand All @@ -48,6 +57,7 @@ Always delegate investigative work to the 'search_agent' tool so it can gather v

- Launch search_agent with a clear objective, attribute list, filters, and quantity requirement.
- Review the JSON output, double-check confidence values and citations, and surface the most credible findings.
- Use the file management tools ('create_file', 'update_file', 'read_file', 'list_files') to coordinate multi-step fact-finding. Persist subtask outputs as you go, read existing files before launching overlapping searches, and append incremental findings rather than duplicating effort.
- If the user pivots into broad synthesis or long-form reporting, switch to the 'research_agent'.
- Keep responses concise, cite the strongest sources, and present the structured findings provided by the agent.

Expand Down Expand Up @@ -117,6 +127,12 @@ Based on query type, develop a specific research plan:
- Synthesizing findings
- Identifying gaps and deploying additional agents as needed

**Coordinate through session files:**
- Before launching a new subtask, call 'list_files' to inspect existing outputs and avoid duplication.
- Persist each subtask's plan, raw notes, and structured results with 'create_file'/'update_file'. Include timestamps and ownership so other agents can build on the work.
- Encourage sub-agents to read relevant files ('read_file') before acting, and to append updates instead of overwriting unless the instructions explicitly call for replacement.
- Use file summaries to track progress, surface blockers, and keep an audit trail for the final synthesis.

**Clear instructions to research agents must include:**
- Specific research objectives (ideally one core objective per agent)
- Expected output format with emphasis on collecting detailed, comprehensive data
Expand Down Expand Up @@ -299,6 +315,14 @@ export const AGENT_CONFIGS: {[key: string]: AgentConfig} = {
ToolRegistry.getToolInstance('research_agent') || (() => { throw new Error('research_agent tool not found'); })(),
new FinalizeWithCritiqueTool(),
new SearchVisitHistoryTool(),
new RenderWebAppTool(),
new GetWebAppDataTool(),
new RemoveWebAppTool(),
new CreateFileTool(),
new UpdateFileTool(),
new DeleteFileTool(),
new ReadFileTool(),
new ListFilesTool(),
]
},
[BaseOrchestratorAgentType.DEEP_RESEARCH]: {
Expand All @@ -315,6 +339,14 @@ export const AGENT_CONFIGS: {[key: string]: AgentConfig} = {
ToolRegistry.getToolInstance('bookmark_store') || (() => { throw new Error('bookmark_store tool not found'); })(),
ToolRegistry.getToolInstance('search_agent') || (() => { throw new Error('search_agent tool not found'); })(),
new FinalizeWithCritiqueTool(),
new RenderWebAppTool(),
new GetWebAppDataTool(),
new RemoveWebAppTool(),
new CreateFileTool(),
new UpdateFileTool(),
new DeleteFileTool(),
new ReadFileTool(),
new ListFilesTool(),
]
},
// [BaseOrchestratorAgentType.SHOPPING]: {
Expand Down Expand Up @@ -500,6 +532,11 @@ export function getAgentTools(agentType: string): Array<Tool<any, any>> {
ToolRegistry.getToolInstance('research_agent') || (() => { throw new Error('research_agent tool not found'); })(),
new FinalizeWithCritiqueTool(),
new SearchVisitHistoryTool(),
new CreateFileTool(),
new UpdateFileTool(),
new DeleteFileTool(),
new ReadFileTool(),
new ListFilesTool(),
];
}

Expand Down
Loading