Skip to content

Add deep research agent template#90

Open
shriyatheunicorn wants to merge 8 commits into
devfrom
add-deep-research-agent-template
Open

Add deep research agent template#90
shriyatheunicorn wants to merge 8 commits into
devfrom
add-deep-research-agent-template

Conversation

@shriyatheunicorn
Copy link
Copy Markdown

@shriyatheunicorn shriyatheunicorn commented May 6, 2026

Summary

  • Add a new typescript/deep-research-agent template for bb research engine
  • Include CLI, local dashboard server, Vercel API handlers, environment example, and README
  • Adjust the dashboard API fallback for local template usage instead of the previous hosted app URL
  • Add the new template to the root README template index

Verification

  • npm run check
  • Parsed the inline dashboard script with Node
  • node scripts/check-readme-template-index.mjs

Replaces #89 so the branch name does not include the codex/ prefix.


Note

Medium Risk
Adds a sizable new TypeScript template that runs multi-step live-web research via Browserbase Search/Fetch and Stagehand, plus exposes new local and Vercel HTTP endpoints; risk is mainly around runtime behavior, cost/limits, and serverless execution constraints rather than existing code changes.

Overview
Adds a new typescript/deep-research-agent template that turns a topic into an auditable, cited research brief using Browserbase Search + Fetch first and Stagehand browser-session fallback, with optional planning/strategy iterations and a verifier step.

Includes a lightweight dashboard UI (public/index.html) with a local server (src/local-web.ts) and Vercel-ready handlers (index.ts, api/health.ts, api/research.ts, vercel.json) that accept a topic, run the pipeline, and return a structured JSON response plus artifact paths.

Updates the root README.md templates table to list deep-research-agent, and adds template packaging/config files (package.json, .env.example, .gitignore, benchmark.example.tsv).

Reviewed by Cursor Bugbot for commit fba2b10. Bugbot is set up for automated code reviews on this repo. Configure here.

Comment thread typescript/deep-research-agent/src/research.ts
Comment thread typescript/deep-research-agent/index.ts Outdated
Copy link
Copy Markdown
Author

bugbot run verbose=true

@cursor
Copy link
Copy Markdown

cursor Bot commented May 7, 2026

Bugbot request id: serverGenReqId_99a1e2b6-44c5-4517-8468-61436b1da0dc

Comment thread typescript/deep-research-agent/package.json Outdated
Comment thread typescript/deep-research-agent/src/research.ts Outdated
Comment thread typescript/deep-research-agent/index.ts Outdated
}

if (url.pathname === "/research" || url.pathname === "/api/research") {
return options.handleResearch(request, response);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing await bypasses error handler in try-catch

Medium Severity

The return options.handleResearch(request, response) inside the try-catch of handleDashboardRequest is missing await. In an async function, return promise without await causes the catch block to never intercept async rejections from that promise. If the research handler throws asynchronously outside its own inner try-catch (e.g., a stream error during readBody in local-web.ts), the outer safety-net catch is silently bypassed, resulting in an unhandled promise rejection and a hanging HTTP response that never completes.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 6c6204e. Configure here.

Comment thread typescript/deep-research-agent/public/index.html
return sendJson(response, 400, { error: "Enter a research topic." });
}

activeRun = true;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Race condition in concurrent run guard

Low Severity

The activeRun guard is checked before await readBody(request) but only set to true after it. During that await, the event loop can process another incoming request that also passes the activeRun check, allowing multiple concurrent research runs — exactly what the guard is designed to prevent (a classic TOCTOU race).

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 72a8f92. Configure here.

summary:
overallScore >= input.rubric.passThreshold
? "Verification passed the conservative rubric."
: "Verification did not pass; review repair actions before using the report.",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verification summary contradicts pass field

Medium Severity

The summary message is determined solely by overallScore >= passThreshold, but the pass field additionally requires missingCriteria.length === 0. When the score clears the threshold but missingCriteria is non-empty, pass is false while summary says "Verification passed the conservative rubric." — a direct contradiction that is surfaced in both the dashboard UI overview panel and the written verification.md artifact.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit c7da4fe. Configure here.

throw new Error("No page found in Browserbase session");
}

await page.goto(candidate.url, { waitUntil: "domcontentloaded", timeoutMs: 45000 });
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Playwright goto timeout option silently ignored

Low Severity

The browser-fallback navigation call passes { timeoutMs: 45000 } to Playwright's page.goto(), but the Playwright API expects { timeout: number }, not timeoutMs. The unrecognized property is silently discarded at runtime, so the intended 45-second timeout for slow or JS-heavy pages is never applied and the default 30-second Playwright timeout is used instead. Every other page.goto call in this file correctly omits a custom timeout, making this the only place where the wrong key name appears.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit c7da4fe. Configure here.

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

There are 5 total unresolved issues (including 4 from previous reviews).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit fba2b10. Configure here.

return options.handleResearch(request, response);
}

return sendJson(response, 404, { error: "Not found." });
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dashboard logo fails to load via local server

Low Severity

handleDashboardRequest only routes /, /index.html, health, and research paths — it has no static file handler. The dashboard HTML references <img src="browserbase-logo.svg">, so the browser requests /browserbase-logo.svg which hits the 404 fallback and returns a JSON error instead of the SVG. The logo is broken in both npm run web and the Vercel index.ts handler.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit fba2b10. Configure here.

@shriyatheunicorn shriyatheunicorn force-pushed the add-deep-research-agent-template branch from fba2b10 to c7da4fe Compare May 12, 2026 18:48
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.

2 participants