Skip to content

Commit a99aa48

Browse files
authored
Add current date and page url to agent context (#1102)
# why To improve context # what changed Added current page and url to the system prompt # test plan
1 parent 889cb6c commit a99aa48

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

.changeset/upset-ghosts-shout.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@browserbasehq/stagehand": patch
3+
---
4+
5+
Add current page and date context to agent

lib/handlers/stagehandAgentHandler.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,8 @@ STRATEGY:
237237
- Prefer ariaTree to understand the page before acting; use screenshot for quick confirmation.
238238
- Keep actions atomic and verify outcomes before proceeding.
239239
240-
For each action, provide clear reasoning about why you're taking that step.`;
240+
For each action, provide clear reasoning about why you're taking that step.
241+
Today's date is ${new Date().toLocaleDateString()}. You're currently on the website: ${this.stagehand.page.url}.`;
241242
}
242243

243244
private createTools() {

0 commit comments

Comments
 (0)