const agent = stagehand.agent();
await agent.execute("Sign me up for a library card");
软件始终是确定且可重复的,但AI智能体却难以复现工作流程。Stagehand完美融合了两者的优势:智能与确定性。
Stagehand中的Web智能体完全可定制。您可以使用任何LLM/VLM/计算机服务提供商,设置系统提示词,添加自定义工具等。
// For Computer Use Agent (CUA) models
const agent = stagehand.agent({
provider: "openai",
model: "computer-use-preview",
instructions: "You are a helpful assistant that can use a web browser.",
options: {
apiKey: process.env.OPENAI_API_KEY,
},
});
// You can define additional options like max_steps and auto_screenshot
await agent.execute({
instruction="Sign me up for a library card",
max_steps=20,
})
指定LLM服务提供商。
当前支持:
- OpenAI:
openai
- Anthropic:
anthropic
指定LLM模型。
当前支持:
- OpenAI:
computer-use-preview
- Anthropic:
claude-sonnet-4-20250514 和 claude-3-7-sonnet-latest
LLM提供商的配置选项。当前支持OpenAI和Anthropic SDK客户端选项。
指定LLM模型。
当前支持:
- OpenAI:
computer-use-preview
- Anthropic:
claude-sonnet-4-20250514 和 claude-3-7-sonnet-latest
指定LLM服务提供商。
当前支持:
- OpenAI:
openai
- Anthropic:
anthropic
LLM提供商的配置选项。当前支持OpenAI和Anthropic SDK客户端选项。
表示智能体是否完全完成任务(即使success为true也可能为false)
metadata
Record<string, unknown> | dict
关于本次执行的可选附加数据