Agent
See how to use agent() to create autonomous AI agents for multi-step browser workflows
Agent Creation
- TypeScript
- Python
Agent Configuration
AgentProviderType
AI provider for agent functionality.Options:
"anthropic", "openai"string
Specific model for agent execution.Anthropic:
"claude-sonnet-4-6", "claude-sonnet-4-5-20250929"OpenAI: "computer-use-preview", "gpt-4o"string
System instructions defining agent behavior.
Record<string, unknown>
Provider-specific configuration.Common:
apiKey, baseURL, organization(Client | string)[]
MCP (Model Context Protocol) integrations for external tools and services.Array of: MCP server URLs (strings) or connected Client objects
ToolSet
Custom tool definitions to extend agent capabilities.Format: Object with tool name keys and tool definition values
Execute Method
- TypeScript
- Python
Execute Parameters
string
required
High-level task description in natural language.
number
Maximum number of actions the agent can take.Default:
20boolean
Whether to take screenshots before each action.Default:
truenumber
Delay in milliseconds between actions.Default:
0string
Additional context or constraints for the agent.
Response
Returns:Promise<AgentResult>
AgentResult Interface:
- TypeScript
- Python
boolean
Whether the task was completed successfully.
string
Description of the execution result and status.
AgentAction[]
Array of individual actions taken during execution.
boolean
Whether the agent believes the task is fully complete.
Record<string, unknown>
Additional execution metadata and debugging information.
object
Token usage and performance metrics.

