-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Description
Before submitting an issue, please:
- Check the documentation for relevant information
- Search existing issues to avoid duplicates
The following paragraph in documentation appear to be wrong and should be removed
Using different instructions generate different cache keys. There is no shared cache between both instructions.
Parameterized Agent Workflows
Use variables to make cached workflows reusable with different inputs:
async function executeLogin(username: string, password: string) {
const stagehand = new Stagehand({
env: "BROWSERBASE",
cacheDir: "cache/login"
});
await stagehand.init();
const page = stagehand.context.pages()[0];
await page.goto("https://example.com/login");
const agent = stagehand.agent({
model: "anthropic/claude-sonnet-4-20250514"
});
// Variables work with caching
const result = await agent.execute({
instruction: `Fill in username with "${username}" and password with "${password}", then click submit`,
maxSteps: 5
});
await stagehand.close();
return result.success;
}
// First user: Caches the workflow
await executeLogin("user1@example.com", "password123");
// Second user: Reuses cached workflow structure
await executeLogin("user2@example.com", "differentpass");Metadata
Metadata
Assignees
Labels
No labels