-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[STG-1045] Add logging at all 4 levels: agent.execute, agent.act/observe/extract, CLICK/HOVER/SCROLL, and CDP #1283
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
pirate
wants to merge
18
commits into
main
Choose a base branch
from
flow-logs
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
- Add SessionFileLogger class that writes to session-specific directories
- Read BROWSERBASE_CONFIG_DIR from env (defaults to ./.browserbase)
- Create session directory structure: {configDir}/sessions/{sessionId}/
- Create convenience symlink: {configDir}/sessions/latest
- Write to 5 separate log files:
- session.json (sanitized V3Options with secrets masked)
- agent_events.log (TASK level - agent.execute)
- stagehand_events.log (STEP level - act/observe/extract)
- understudy_events.log (ACTION level - CLICK/HOVER/etc)
- cdp_events.log (CDP MSG level)
- All filesystem operations are async, non-blocking, and fail silently
- Logs still also written to stdout via v3Logger for backwards compatibility
- Add .browserbase/ to .gitignore
- Update flowLoggingJourney example to show session log directory
Co-authored-by: Nick Sweeting <pirate@users.noreply.github.com>
…nt ids, cleanup code
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
why
Clarify where the execution flow goes when stagehand runs by showing more detailed logs.
what changed
Adds a log line printed at the beginning and end of each layer's execution:
Log lines are written to
./.browserbase/sessions/{sessionId}/{agent,stagehand,understudy,cdp}.logat runtime, and can be followed in a single unified screen by doing:tail -f ./.browserbase/sessions/latest/*.logtest plan
Test by running
pnpm tsx packages/core/examples/flowLoggingJourney.ts & tail -f ./.browserbase/sessions/latest/*(make sureOPENAI_API_KEYis in env).