Skip to content

Commit 227578a

Browse files
Contrib/1212 - Stagehand Agent param is instructions instead of systemPrompt (#1218)
from #1212 shoutout @bennycortese Stagehand agent no longer directly takes in instructions. It takes in a systemPrompt instead, I noticed this while running npx create-browser-app and seeing the error appear --------- Co-authored-by: Benny Cortese <bennycortese@gmail.com>
1 parent 6d21efa commit 227578a

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

packages/docs/v3/best-practices/agent-fallbacks.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ try {
3030

3131
const agent = stagehand.agent({
3232
model: "anthropic/claude-sonnet-4-20250514",
33-
instructions: "You are a helpful assistant that can use a web browser.",
33+
systemPrompt: "You are a helpful assistant that can use a web browser.",
3434
});
3535

3636
const result = await agent.execute({

packages/docs/v3/best-practices/mcp-integrations.mdx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const agent = stagehand.agent({
3333
integrations: [
3434
`https://mcp.exa.ai/mcp?exaApiKey=${process.env.EXA_API_KEY}`,
3535
],
36-
instructions: `You have access to web search through Exa. Use it to find current information before browsing.`,
36+
systemPrompt: `You have access to web search through Exa. Use it to find current information before browsing.`,
3737
options: {
3838
apiKey: process.env.OPENAI_API_KEY,
3939
},
@@ -68,7 +68,7 @@ const agent = stagehand.agent({
6868
provider: "openai",
6969
model: "computer-use-preview",
7070
integrations: [supabaseClient, notionClient],
71-
instructions: `You can interact with Supabase databases and Notion. Use these tools to store and retrieve data.`,
71+
systemPrompt: `You can interact with Supabase databases and Notion. Use these tools to store and retrieve data.`,
7272
options: {
7373
apiKey: process.env.OPENAI_API_KEY,
7474
},
@@ -91,7 +91,7 @@ const agent = stagehand.agent({
9191
`https://search-service.example.com/mcp?apiKey=${process.env.SEARCH_API_KEY}`,
9292
databaseClient
9393
],
94-
instructions: `You have access to external tools for search and data storage. Use these tools strategically to complete tasks efficiently.`
94+
systemPrompt: `You have access to external tools for search and data storage. Use these tools strategically to complete tasks efficiently.`
9595
});
9696
```
9797

@@ -144,7 +144,7 @@ Provide clear instructions about available tools:
144144
<Tabs>
145145
<Tab title="Good Instructions">
146146
```typescript
147-
instructions: `You have access to:
147+
systemPrompt: `You have access to:
148148
1. Web search tools - Use to find current information
149149
2. Database tools - Use to store/retrieve data
150150
3. Browser automation - Use for web interactions
@@ -156,7 +156,7 @@ Store important data for later reference.`
156156

157157
<Tab title="Poor Instructions">
158158
```typescript
159-
instructions: "You can search and save data."
159+
systemPrompt: "You can search and save data."
160160
```
161161
</Tab>
162162
</Tabs>
@@ -221,7 +221,7 @@ try {
221221
```typescript
222222
const agent = stagehand.agent({
223223
integrations: [`https://mcp.exa.ai/mcp?exaApiKey=${process.env.EXA_API_KEY}`],
224-
instructions: `First search for current information, then use the browser to complete tasks based on what you find.`
224+
systemPrompt: `First search for current information, then use the browser to complete tasks based on what you find.`
225225
});
226226

227227
await agent.execute("Find the best laptop deals for 2025 and navigate to purchase the top recommendation");
@@ -233,7 +233,7 @@ const supabaseClient = await connectToMCPServer(/* config */);
233233

234234
const agent = stagehand.agent({
235235
integrations: [supabaseClient],
236-
instructions: `Extract data from websites and store it using available database tools.`
236+
systemPrompt: `Extract data from websites and store it using available database tools.`
237237
});
238238

239239
await agent.execute("Extract all restaurant information from this directory and save it to the database");
@@ -246,7 +246,7 @@ const agent = stagehand.agent({
246246
`https://mcp.exa.ai/mcp?exaApiKey=${process.env.EXA_API_KEY}`,
247247
supabaseClient
248248
],
249-
instructions: `Use all available tools strategically: search for current info, browse websites, and store important data.`
249+
systemPrompt: `Use all available tools strategically: search for current info, browse websites, and store important data.`
250250
});
251251

252252
await agent.execute("Research competitor pricing, compare with our site, and store the analysis");

0 commit comments

Comments
 (0)