- Goal: build a cited research brief from the open web using Browserbase Search API for discovery, Fetch API for fast page retrieval, and Stagehand browser sessions only when needed.
- Search-first: runs several targeted web searches and deduplicates candidate URLs.
- Fetch-first: retrieves raw page content without launching a browser, parses HTML locally, and scores usable sources.
- Browser fallback: escalates JS-heavy, blocked, very thin, or oversized pages to a Stagehand session with AI-powered extraction.
- Plan-first research: creates an explicit research plan before searching, including assumptions, evidence requirements, source-quality rules, and risky-source hints.
- AutoBrowse-inspired learning loop: writes traces, evaluates quality, improves
strategy.md, and runs another pass with one concrete hypothesis per iteration. - Claim-level evidence: extracts claim candidates from every usable source, not just page summaries.
- Live web enrichment: records search snapshots, retrieval timestamps, content hashes, excerpt hashes, and source snippets so live-web runs are auditable after pages drift.
- Universal-verifier stage: creates a rubric before retrieval, then separately scores research process and final report outcome after synthesis.
- FARA/WebTailBench-style benchmark mode: runs a TSV/JSON/JSONL task suite, preserves precomputed rubrics when present, and emits JSONL plus aggregate metrics.
- Synthesis: uses Stagehand through Browserbase Model Gateway to produce a structured brief with source IDs, claim map, confidence notes, contradictions, gaps, and follow-up questions.
- Search API: perform web searches and get structured result metadata without a browser session. Docs -> https://docs.browserbase.com/reference/api/web-search
- Fetch API: fetch a page through Browserbase infrastructure and receive content, headers, status, content type, and encoding. Docs -> https://docs.browserbase.com/reference/api/fetch-a-page
- Stagehand: AI browser automation framework with
act,observe, andextractprimitives. Docs -> https://docs.browserbase.com/introduction/stagehand - Model Gateway: route Stagehand model calls through your Browserbase API key. Docs -> https://docs.browserbase.com/platform/model-gateway/overview
- AutoBrowse: self-improving browser automation pattern that evaluates a run, reads traces, updates strategy, and repeats. Skill -> https://skills.sh/browserbase/skills/autobrowse
- Universal Verifier: process/outcome verification pattern using a pre-generated rubric and conservative scoring. Paper -> https://arxiv.org/html/2604.06240v1
- FARA/WebTailBench: benchmark/evaluation infrastructure for browser agents and Universal Verifier scoring. Repo -> https://github.com/microsoft/fara
- cd typescript/deep-research-agent
- npm install
- cp .env.example .env
- Add BROWSERBASE_API_KEY to .env
- npm start -- "What changed in browser automation platforms in 2026?"
This template also includes a lightweight dashboard for running research topics and inspecting results.
npm run webOpen http://localhost:3000 in your browser.
Set BENCH_TASKS_FILE to run a FARA/WebTailBench-style task suite instead of one topic:
BENCH_TASKS_FILE=./benchmark.example.tsv BENCH_TASK_LIMIT=1 npm run benchSupported task formats:
- WebTailBench-style TSV with
id,task_summary,benchmark,init_url, and optionalprecomputed_rubric. - JSON array or
{ "tasks": [...] }. - JSONL with one task object per line.
Recognized task fields:
id,task_id, orsubdirquestion,task_summary,confirmed_task, orinstructioncategory,benchmark, orsplitinit_urlorwebsiteprecomputed_rubricorprecomputedRubric
Benchmark outputs:
bench-output/bench-results-<timestamp>.jsonlbench-output/bench-summary-<timestamp>.json- one normal research workspace per task
- Creates a per-run workspace under
research-workspace/<topic>-<timestamp>/. - Builds
plan.mdwith assumptions, report sections, required evidence, search queries, and source-quality rules. - Builds
rubric.mdbefore retrieval, separating process criteria from outcome criteria. - Writes an initial
strategy.mdwith a fast path, source quality rules, fallback rules, and stop criteria. - Builds query variants from the current strategy.
- Calls
bb.search.web()for each query. - Deduplicates candidate URLs and prioritizes strategy-selected browser fallback URLs.
- Calls
bb.fetchAPI.create()for each candidate. - Parses usable HTML with Cheerio and extracts title, metadata, headings, links, word count, excerpts, quality signals, risk flags, and claim candidates.
- Falls back to a Stagehand browser session for pages that need JavaScript, are blocked, are too thin, or return unusable content.
- Runs a hot-path quality evaluation covering source count, domain diversity, claim count, missing angles, and risk flags.
- Writes JSON and Markdown traces for the iteration.
- Enriches accepted and rejected sources with live-web metadata: search snapshot, retrieval method, timestamps, status/content type, hashes, snippets, and fallback reasons.
- Reads the trace with a Strategy Planner and updates
strategy.mdfor the next iteration. - Synthesizes the top diverse sources into a report.
- Verifies the process and outcome against
rubric.md, classifies controllable vs uncontrollable failures, and writes final Markdown/JSON under both the run workspace andoutput/.
Most research templates are one of three shapes: search-and-summarize, multi-agent fanout, or browser-only exploration. This template is built around a different loop:
- It treats Browserbase Search and Fetch as the cheap, high-throughput research substrate, then spends full browser sessions only when diagnostics justify it.
- It adapts the AutoBrowse trace loop to research, so each pass records what failed and improves one strategy hypothesis.
- It preserves claim candidates, reliability signals, and prompt-injection risk flags before synthesis.
- It generates a verifier rubric before seeing results, avoiding post-hoc grading bias.
- It can import benchmark
precomputed_rubricdata, matching the reproducibility direction used by FARA/WebTailBench. - It separately scores the research process and final report outcome, then classifies repairable vs access-related failures.
- It enforces source diversity with
MAX_SOURCES_PER_DOMAIN, reducing the common failure mode where one domain dominates the report. - It upgrades traceability into live web enrichment by preserving the retrieval context, snippets, and hashes behind each source.
- It produces auditable artifacts:
plan.md,rubric.md,strategy.md, per-iteration traces,verification.md, final Markdown, and final JSON. - It can stop early on quality thresholds or keep iterating for higher confidence.
This template adapts the AutoBrowse loop from site automation to research:
- Inner loop: Search, Fetch, browser fallback, source scoring, and trace writing.
- Outer loop: read the trace, identify the failure mode, form one improvement hypothesis, update strategy, and repeat.
- Strategy memory:
strategy.mdpreserves what worked, browser fallback URLs, source quality rules, and recovery heuristics. - Durable evidence: every iteration writes
traces/iteration-N.jsonandtraces/iteration-N.md. - Final report: the report cites source IDs and includes contradictions, gaps, source quality notes, and follow-up questions.
- Console progress for search, fetch, fallback, and synthesis steps.
research-workspace/<topic>-<timestamp>/plan.mdwith the initial research plan.research-workspace/<topic>-<timestamp>/rubric.mdwith process and outcome verification criteria.research-workspace/<topic>-<timestamp>/strategy.mdwith the evolving strategy.research-workspace/<topic>-<timestamp>/traces/iteration-N.jsonand.mdfiles.research-workspace/<topic>-<timestamp>/verification.mdwith pass/fail, process score, outcome score, unsupported claims, weak citations, and repair actions.- A Markdown report with methodology, executive summary, key findings, claim map, contradictions, gaps, follow-up questions, and source list.
- A JSON file containing the topic, generated queries, scored sources, live-web enrichment metadata, and structured report object.
RESEARCH_MODEL: Stagehand model routed through Model Gateway. Default:google/gemini-2.5-flash.RESEARCH_ITERATIONS: evaluate -> trace -> improve cycles. Default:2.NUM_QUERIES: number of generated query variants to run. Default:4.RESULTS_PER_QUERY: Search API results per query. Default:5.MAX_FETCHES: maximum candidate URLs to fetch. Default:10.MAX_BROWSER_FALLBACKS: maximum pages to inspect with a full browser when Fetch is insufficient. Default:2.MAX_SOURCES: maximum sources included in the final synthesis. Default:8.MAX_SOURCES_PER_DOMAIN: source diversity guardrail. Default:2.CLAIMS_PER_SOURCE: maximum claim candidates kept from each source. Default:5.MIN_QUALITY_SCORE: quality score needed for early stopping. Default:75.MIN_DISTINCT_DOMAINS: minimum distinct domains for high-confidence synthesis. Default:3.USE_RESEARCH_PLANNER: set tofalseto skip the initial Model Gateway planning pass. Default:true.USE_STRATEGY_PLANNER: set tofalseto skip AutoBrowse-style trace reading and use deterministic query expansion. Default:true.USE_BROWSER_SYNTHESIS: set tofalseto skip Stagehand synthesis and emit a deterministic evidence brief. Default:true.USE_VERIFIER: set tofalseto skip rubric generation and process/outcome verification. Default:true.STOP_EARLY_ON_QUALITY: set totrueto stop once the quality threshold is met. Default:false.VERIFICATION_PASS_SCORE: conservative verifier pass threshold. Default:80.USE_PROXIES: set totrueto enable Browserbase proxy support for Fetch requests and browser sessions. Default:false.OUT_DIR: output directory. Default:output.RESEARCH_WORKSPACE: trace and strategy workspace. Default:research-workspace.BENCH_TASKS_FILE: optional TSV/JSON/JSONL task file. When set, the template runs benchmark mode.BENCH_TASK_FORMAT:auto,tsv,json, orjsonl. Default:auto.BENCH_TASK_LIMIT: maximum benchmark tasks to run. Default:25.BENCH_OUTPUT_DIR: directory for benchmark JSONL and summary files. Default:bench-output.BENCH_SUCCESS_CRITERION:outcome,process, orboth. Default:outcome.
This template includes a static Vercel web UI in public/index.html and serverless functions in api/.
- Import this GitHub repo in Vercel.
- Add
BROWSERBASE_API_KEYin Project Settings -> Environment Variables. - For a lower-cost first deploy, set these Vercel environment variables:
RESEARCH_ITERATIONS=1NUM_QUERIES=2RESULTS_PER_QUERY=3MAX_FETCHES=4MAX_BROWSER_FALLBACKS=1USE_RESEARCH_PLANNER=falseUSE_STRATEGY_PLANNER=falseUSE_BROWSER_SYNTHESIS=falseUSE_VERIFIER=false
The Vercel deployment exposes /api/health and /health for health checks. Generated artifacts are written to /tmp while running on Vercel because serverless function filesystems are ephemeral.
- Missing API key: verify
.envcontainsBROWSERBASE_API_KEY. - Search query length: Search API queries must be 1 to 200 characters. This template trims generated queries.
- Search result volume: Search API supports 1 to 25 results per query. This template clamps
RESULTS_PER_QUERY. - Live web drift: traces and live-web enrichment make runs auditable, but exact page replay still requires external archiving if you need full raw-page snapshots.
- Fetch API does not execute JavaScript. Thin app-shell pages should fall back to Stagehand.
- Fetch API has a 1 MB content limit and 10 second timeout. Use browser sessions for large or slow pages.
- More iterations cost more because each improvement pass may use Search, Fetch, browser fallback, and Model Gateway calls.
- Keep
MAX_BROWSER_FALLBACKSlow at first. The template is designed to spend browser sessions only after Fetch produces useful diagnostics. - Prompt injection can appear inside web pages. This template flags suspicious text and instructs synthesis to treat page content as evidence, never instructions.
- If you open
public/index.htmldirectly from disk, startnpm run webfirst so the page can call the local API athttp://localhost:3000. - Source diversity is a guardrail, not a guarantee. For regulated or high-stakes use, add domain allowlists and human review.
- Synthesis quality depends on source quality. Tune query variants, source scoring, and domain filters for production workflows.
- Competitive research: gather recent pages, source snippets, and a quick cited brief.
- Due diligence: collect public web evidence before escalating to authenticated or paid sources.
- Monitoring: schedule recurring research over a topic and compare source changes over time.
- Agent pipelines: let Search and Fetch do cheap triage before spending browser and model budget.
- Browser Sessions: use Playwright or Stagehand when a page requires JavaScript, interaction, downloads, or authenticated browsing.
- Stagehand
observe: inspect available page actions before deciding whether to click or extract. - Contexts: persist login state for authenticated research sources.
- Proxies: get geography-specific results or improve access to protected pages.
- Browser Settings: use advanced stealth, ad blocking, and captcha solving for difficult browser fallback targets.
- Functions: deploy this research agent as an API endpoint or scheduled job on Browserbase infrastructure.
- Browserbase Skills and CLI: useful if you want coding agents to run search, fetch, browser, and deployment workflows consistently.
- AutoBrowse: use the full skill when you need to train reliable browser workflows for specific sites, then graduate those workflows into reusable skills.
- Fetch API blog: https://www.browserbase.com/blog/fetch-api
- Fetch API reference: https://docs.browserbase.com/reference/api/fetch-a-page
- Search API reference: https://docs.browserbase.com/reference/api/web-search
- Stagehand docs: https://docs.browserbase.com/introduction/stagehand
- Model Gateway: https://docs.browserbase.com/platform/model-gateway/overview
- AutoBrowse skill: https://skills.sh/browserbase/skills/autobrowse
- Browserbase Skills repo: https://github.com/browserbase/skills/tree/main/skills/autobrowse
- FARA repo: https://github.com/microsoft/fara
- WebTailBench dataset: https://huggingface.co/datasets/microsoft/WebTailBench
- CUAVerifierBench dataset: https://huggingface.co/datasets/microsoft/CUAVerifierBench
- Functions: https://docs.browserbase.com/features/functions
- Contexts: https://docs.browserbase.com/features/contexts
- Proxies: https://docs.browserbase.com/features/proxies
- Skills: https://docs.browserbase.com/integrations/skills/introduction
- Templates: https://github.com/browserbase/templates