feat(cli): add –only-errors to
cloud sessions logs(#2373)What
Adds
--only-errors(and--failed-requests) tobrowse cloud sessions logs.By default the command returns the full CDP firehose (~hundreds of events, unchanged).
--only-errorsruns a deterministic reducer that returns just the high-signal error records:
- console errors / warnings / asserts
- uncaught exceptions (with app-frame-trimmed stacks)
- HTTP 4xx/5xx responses
- net-level load failures (CORS / DNS / connection)
deduped, no LLM.
browse cloud sessions logs <id> --only-errors browse cloud sessions logs <id> --only-errors --failed-requestsWhy
Agents debugging Browserbase sessions (build/verification agents for AI app builders) want the runtime errors, not the raw firehose. Today they pull ~hundreds of CDP events and grep.
--only-errorsreturns the handful that matter in one call — far fewer tokens/tool-calls in the agent loop, and language-agnostic (shell out from any agent).Scope / notes
- Default behavior unchanged (raw firehose) — opt-in only, so no breaking change.
- Reducer lives in
packages/cli/src/lib/cloud/reduce-logs.ts(pure, unit-testable).- Catches console / exception / 4xx-5xx / net-failure classes. Does
not catch an HTTP 200 response carrying an error body (that needs response-body capture at ingest — follow-up).
🤖 Generated with Claude Code
Summary by cubic
Add –only-errors to cloud sessions logs to return only high-signal errors, with an optional –failed-requests to narrow to failed network calls. Default output is unchanged.
- New Features
--only-errors: returns console errors/warnings/asserts, uncaught exceptions (trimmed stacks), HTTP 4xx/5xx, and network load failures; deduped.--failed-requests: with--only-errors, returns only failed/error-status network requests.- Deterministic reducer added in
packages/cli/src/lib/cloud/reduce-logs.ts(pure and unit-testable).Written for commit 88c785f9524e2120ab3d04f2939481a078720bbd. Summary will update on new commits.
Co-authored-by: Claude Opus 4.8 noreply@anthropic.com
版权所有:中国计算机学会技术支持:开源发展技术委员会
京ICP备13000930号-9
京公网安备 11010802047560号
The AI Browser Automation Framework
Read the Docs
If you're looking for the Python implementation, you can find it here
What is Stagehand?
Stagehand is a browser automation framework used to control web browsers with natural language and code. By combining the power of AI with the precision of code, Stagehand makes web automation flexible, maintainable, and actually reliable.
Why Stagehand?
Most existing browser automation tools either require you to write low-level code in a framework like Selenium, Playwright, or Puppeteer, or use high-level agents that can be unpredictable in production. By letting developers choose what to write in code vs. natural language (and bridging the gap between the two) Stagehand is the natural choice for browser automations in production.
Choose when to write code vs. natural language: use AI when you want to navigate unfamiliar pages, and use code when you know exactly what you want to do.
Go from AI-driven to repeatable workflows: Stagehand lets you preview AI actions before running them, and also helps you easily cache repeatable actions to save time and tokens.
Write once, run forever: Stagehand’s auto-caching combined with self-healing remembers previous actions, runs without LLM inference, and knows when to involve AI whenever the website changes and your automation breaks.
Getting Started
Start with Stagehand with one line of code, or check out our Quickstart Guide for more information:
Example
Here’s how to build a sample browser automation with Stagehand:
Documentation
Visit docs.stagehand.dev to view the full documentation.
Build and Run from Source
Stagehand is best when you have an API key for an LLM provider and Browserbase credentials. To add these to your project, run:
Installing from a branch
To install Stagehand directly from a GitHub branch, install the core package subdirectory:
Or set it in your project’s
package.json:Contributing
At a high level, we’re focused on improving reliability, extensibility, speed, and cost in that order of priority. If you’re interested in contributing, bug fixes and small improvements are the best way to get started. For more involved features, we strongly recommend reaching out to Miguel Gonzalez or Paul Klein in our Discord community before starting to ensure that your contribution aligns with our goals.
Acknowledgements
We’d like to thank the following people for their major contributions to Stagehand:
License
Licensed under the MIT License.
Copyright 2025 Browserbase, Inc.