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
5 changes: 5 additions & 0 deletions .changeset/upset-ghosts-shout.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@browserbasehq/stagehand": patch
---

Add current page and date context to agent
3 changes: 2 additions & 1 deletion lib/handlers/stagehandAgentHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,8 @@ STRATEGY:
- Prefer ariaTree to understand the page before acting; use screenshot for quick confirmation.
- Keep actions atomic and verify outcomes before proceeding.

For each action, provide clear reasoning about why you're taking that step.`;
For each action, provide clear reasoning about why you're taking that step.
Today's date is ${new Date().toLocaleDateString()}. You're currently on the website: ${this.stagehand.page.url}.`;
Copy link
Contributor

Choose a reason for hiding this comment

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

style: The date format will vary by system locale - consider using toLocaleDateString('en-US') or toISOString().split('T')[0] for consistency

Prompt To Fix With AI
This is a comment left during a code review.
Path: lib/handlers/stagehandAgentHandler.ts
Line: 241:241

Comment:
style: The date format will vary by system locale - consider using `toLocaleDateString('en-US')` or `toISOString().split('T')[0]` for consistency

How can I resolve this? If you propose a fix, please make it concise.

}

private createTools() {
Expand Down