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
28 changes: 14 additions & 14 deletions docs/basics/agent.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -30,28 +30,28 @@ There are two ways to create agents in Stagehand:

### Computer Use Agents

Use computer use agents with specialized models from OpenAI or Anthropic:
Use computer use agents with specialized models from OpenAI, Anthropic, or Google:

<CodeGroup>
```typescript TypeScript
const agent = stagehand.agent({
provider: "anthropic",
model: "claude-sonnet-4-20250514",
provider: "google",
model: "gemini-2.5-computer-use-preview-10-2025",
instructions: "You are a helpful assistant that can use a web browser.",
options: {
apiKey: process.env.ANTHROPIC_API_KEY,
apiKey: process.env.GOOGLE_API_KEY,
},
});
await agent.execute("apply for a job at Browserbase")
```

```python Python
agent = stagehand.agent({
"provider": "anthropic",
"model": "claude-sonnet-4-20250514",
"provider": "google",
"model": "gemini-2.5-computer-use-preview-10-2025",
"instructions": "You are a helpful assistant that can use a web browser.",
"options": {
"apiKey": os.getenv("ANTHROPIC_API_KEY"),
"apiKey": os.getenv("GOOGLE_API_KEY"),
},
})
await agent.execute("apply for a job at Browserbase")
Expand All @@ -77,14 +77,14 @@ Agents can be enhanced with external tools and services through MCP (Model Conte
<CodeGroup>
```typescript TypeScript (Pass URL)
const agent = stagehand.agent({
provider: "openai",
model: "computer-use-preview",
provider: "google",
model: "gemini-2.5-computer-use-preview-10-2025",
integrations: [
`https://mcp.exa.ai/mcp?exaApiKey=${process.env.EXA_API_KEY}`,
],
instructions: `You have access to web search through Exa. Use it to find current information before browsing.`,
options: {
apiKey: process.env.OPENAI_API_KEY,
apiKey: process.env.GOOGLE_API_KEY,
},
});

Expand All @@ -99,12 +99,12 @@ const supabaseClient = await connectToMCPServer(
);

const agent = stagehand.agent({
provider: "openai",
model: "computer-use-preview",
provider: "google",
model: "gemini-2.5-computer-use-preview-10-2025",
integrations: [supabaseClient],
instructions: `You can interact with Supabase databases. Use these tools to store and retrieve data.`,
options: {
apiKey: process.env.OPENAI_API_KEY,
apiKey: process.env.GOOGLE_API_KEY,
},
});

Expand All @@ -123,7 +123,7 @@ Stagehand uses a 1024x768 viewport by default (the optimal size for Computer Use

## Available Models

Use specialized computer use models (e.g., `computer-use-preview` from OpenAI or `claude-sonnet-4-20250514` from Anthropic)
Use specialized computer use models (e.g., `gemini-2.5-computer-use-preview-10-2025` from Google or `claude-sonnet-4-20250514` from Anthropic)

<Card title="Available Models" icon="robot" href="/configuration/models">
Check out the guide on how to use different models with Stagehand.
Expand Down
9 changes: 6 additions & 3 deletions docs/references/agent.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const agent = stagehand.agent(config: AgentConfig): AgentInstance
**AgentConfig Interface:**
```typescript
interface AgentConfig {
provider?: AgentProviderType; // "openai" | "anthropic"
provider?: AgentProviderType; // "openai" | "anthropic" | "google"
model?: string;
instructions?: string;
options?: Record<string, unknown>;
Expand Down Expand Up @@ -59,15 +59,18 @@ agent = stagehand.agent({
<ParamField path="provider" type="AgentProviderType" optional>
AI provider for agent functionality.

**Options:** `"anthropic"`, `"openai"`
**Options:** `"anthropic"`, `"openai"`, `"google"`
</ParamField>

<ParamField path="model" type="string" optional>
Specific model for agent execution.

**Anthropic:** `"claude-sonnet-4-20250514"`, `"claude-3-5-sonnet-20241022"`

**OpenAI:** `"computer-use-preview"`, `"gpt-4o"`

**Google:** `"gemini-2.5-computer-use-preview-10-2025"`

</ParamField>

<ParamField path="instructions" type="string" optional>
Expand Down