Runs an autonomous AI agent that can perform complex multi-step browser tasks.
POST
/
v1
/
sessions
/
{id}
/
agentExecute
JavaScript
import Stagehand from 'stagehand-sdk';const client = new Stagehand({ browserbaseAPIKey: process.env['BROWSERBASE_API_KEY'], // This is the default and can be omitted browserbaseProjectID: process.env['BROWSERBASE_PROJECT_ID'], // This is the default and can be omitted modelAPIKey: process.env['MODEL_API_KEY'], // This is the default and can be omitted});const response = await client.sessions.execute('c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123', { agentConfig: {}, executeOptions: { instruction: "Log in with username 'demo' and password 'test123', then navigate to settings", },});console.log(response.data);
import os
from stagehand import Stagehand
client = Stagehand(
browserbase_api_key=os.environ.get("BROWSERBASE_API_KEY"), # This is the default and can be omitted
browserbase_project_id=os.environ.get("BROWSERBASE_PROJECT_ID"), # This is the default and can be omitted
model_api_key=os.environ.get("MODEL_API_KEY"), # This is the default and can be omitted
)
for session in client.sessions.execute(
id="c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123",
agent_config={},
execute_options={
"instruction": "Log in with username 'demo' and password 'test123', then navigate to settings"
},
):
print(session)
package main
import (
"context"
"fmt"
"github.com/browserbase/stagehand-go"
"github.com/browserbase/stagehand-go/option"
)
func main() {
client := stagehand.NewClient(
option.WithBrowserbaseAPIKey("My Browserbase API Key"),
option.WithBrowserbaseProjectID("My Browserbase Project ID"),
option.WithModelAPIKey("My Model API Key"),
)
response, err := client.Sessions.Execute(
context.TODO(),
"c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123",
stagehand.SessionExecuteParams{
AgentConfig: stagehand.SessionExecuteParamsAgentConfig{},
ExecuteOptions: stagehand.SessionExecuteParamsExecuteOptions{
Instruction: "Log in with username 'demo' and password 'test123', then navigate to settings",
},
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Data)
}
package com.browserbase.api.example;
import com.browserbase.api.client.StagehandClient;
import com.browserbase.api.client.okhttp.StagehandOkHttpClient;
import com.browserbase.api.models.sessions.SessionExecuteParams;
import com.browserbase.api.models.sessions.SessionExecuteResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
StagehandClient client = StagehandOkHttpClient.fromEnv();
SessionExecuteParams params = SessionExecuteParams.builder()
.id("c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123")
.agentConfig(SessionExecuteParams.AgentConfig.builder().build())
.executeOptions(SessionExecuteParams.ExecuteOptions.builder()
.instruction("Log in with username 'demo' and password 'test123', then navigate to settings")
.build())
.build();
SessionExecuteResponse response = client.sessions().execute(params);
}
}
package com.browserbase.api.example
import com.browserbase.api.client.StagehandClient
import com.browserbase.api.client.okhttp.StagehandOkHttpClient
import com.browserbase.api.models.sessions.SessionExecuteParams
import com.browserbase.api.models.sessions.SessionExecuteResponse
fun main() {
val client: StagehandClient = StagehandOkHttpClient.fromEnv()
val params: SessionExecuteParams = SessionExecuteParams.builder()
.id("c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123")
.agentConfig(SessionExecuteParams.AgentConfig.builder().build())
.executeOptions(SessionExecuteParams.ExecuteOptions.builder()
.instruction("Log in with username 'demo' and password 'test123', then navigate to settings")
.build())
.build()
val response: SessionExecuteResponse = client.sessions().execute(params)
}
require "stagehand"
stagehand = Stagehand::Client.new(
browserbase_api_key: "My Browserbase API Key",
browserbase_project_id: "My Browserbase Project ID",
model_api_key: "My Model API Key"
)
response = stagehand.sessions.execute(
"c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123",
agent_config: {},
execute_options: {instruction: "Log in with username 'demo' and password 'test123', then navigate to settings"}
)
puts(response)
import Stagehand from 'stagehand-sdk';const client = new Stagehand({ browserbaseAPIKey: process.env['BROWSERBASE_API_KEY'], // This is the default and can be omitted browserbaseProjectID: process.env['BROWSERBASE_PROJECT_ID'], // This is the default and can be omitted modelAPIKey: process.env['MODEL_API_KEY'], // This is the default and can be omitted});const response = await client.sessions.execute('c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123', { agentConfig: {}, executeOptions: { instruction: "Log in with username 'demo' and password 'test123', then navigate to settings", },});console.log(response.data);
import os
from stagehand import Stagehand
client = Stagehand(
browserbase_api_key=os.environ.get("BROWSERBASE_API_KEY"), # This is the default and can be omitted
browserbase_project_id=os.environ.get("BROWSERBASE_PROJECT_ID"), # This is the default and can be omitted
model_api_key=os.environ.get("MODEL_API_KEY"), # This is the default and can be omitted
)
for session in client.sessions.execute(
id="c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123",
agent_config={},
execute_options={
"instruction": "Log in with username 'demo' and password 'test123', then navigate to settings"
},
):
print(session)
package main
import (
"context"
"fmt"
"github.com/browserbase/stagehand-go"
"github.com/browserbase/stagehand-go/option"
)
func main() {
client := stagehand.NewClient(
option.WithBrowserbaseAPIKey("My Browserbase API Key"),
option.WithBrowserbaseProjectID("My Browserbase Project ID"),
option.WithModelAPIKey("My Model API Key"),
)
response, err := client.Sessions.Execute(
context.TODO(),
"c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123",
stagehand.SessionExecuteParams{
AgentConfig: stagehand.SessionExecuteParamsAgentConfig{},
ExecuteOptions: stagehand.SessionExecuteParamsExecuteOptions{
Instruction: "Log in with username 'demo' and password 'test123', then navigate to settings",
},
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Data)
}
package com.browserbase.api.example;
import com.browserbase.api.client.StagehandClient;
import com.browserbase.api.client.okhttp.StagehandOkHttpClient;
import com.browserbase.api.models.sessions.SessionExecuteParams;
import com.browserbase.api.models.sessions.SessionExecuteResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
StagehandClient client = StagehandOkHttpClient.fromEnv();
SessionExecuteParams params = SessionExecuteParams.builder()
.id("c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123")
.agentConfig(SessionExecuteParams.AgentConfig.builder().build())
.executeOptions(SessionExecuteParams.ExecuteOptions.builder()
.instruction("Log in with username 'demo' and password 'test123', then navigate to settings")
.build())
.build();
SessionExecuteResponse response = client.sessions().execute(params);
}
}
package com.browserbase.api.example
import com.browserbase.api.client.StagehandClient
import com.browserbase.api.client.okhttp.StagehandOkHttpClient
import com.browserbase.api.models.sessions.SessionExecuteParams
import com.browserbase.api.models.sessions.SessionExecuteResponse
fun main() {
val client: StagehandClient = StagehandOkHttpClient.fromEnv()
val params: SessionExecuteParams = SessionExecuteParams.builder()
.id("c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123")
.agentConfig(SessionExecuteParams.AgentConfig.builder().build())
.executeOptions(SessionExecuteParams.ExecuteOptions.builder()
.instruction("Log in with username 'demo' and password 'test123', then navigate to settings")
.build())
.build()
val response: SessionExecuteResponse = client.sessions().execute(params)
}
require "stagehand"
stagehand = Stagehand::Client.new(
browserbase_api_key: "My Browserbase API Key",
browserbase_project_id: "My Browserbase Project ID",
model_api_key: "My Model API Key"
)
response = stagehand.sessions.execute(
"c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123",
agent_config: {},
execute_options: {instruction: "Log in with username 'demo' and password 'test123', then navigate to settings"}
)
puts(response)
{"docsConfig":{"theme":"maple","$schema":"https://mintlify.com/docs.json","name":"Stagehand","colors":{"primary":"#00C851","light":"#00C851","dark":"#00C851"},"logo":{"light":"https://mintcdn.com/stagehand/iZoJpVulsYk9lDMY/logo/light_logo.png?fit=max\u0026auto=format\u0026n=iZoJpVulsYk9lDMY\u0026q=85\u0026s=1562b274b6ffc39253bc8091cf8291d9","dark":"https://mintcdn.com/stagehand/u4M3vTBXE1a-6gkD/logo/dark_logo.png?fit=max\u0026auto=format\u0026n=u4M3vTBXE1a-6gkD\u0026q=85\u0026s=b0e7e87230f778f827debae5c8ddb2ab","href":"https://stagehand.dev"},"favicon":"https://mintcdn.com/stagehand/u4M3vTBXE1a-6gkD/images/favicon.svg?fit=max\u0026auto=format\u0026n=u4M3vTBXE1a-6gkD\u0026q=85\u0026s=c1925307fa5695f54570af3e6f31a603","api":{"openapi":"v3/openapi.json"},"navbar":{"links":[{"href":"https://discord.gg/stagehand","label":"Discord"},{"href":"mailto:support@browserbase.com","label":"Support"}]},"footer":{"socials":{"discord":"https://discord.gg/stagehand","x":"https://x.com/stagehanddev","github":"https://github.com/browserbase/stagehand","linkedin":"https://linkedin.com/company/browserbasehq"}},"seo":{"metatags":{"og:type":"website","og:site_name":"Stagehand Docs"},"indexing":"all"},"integrations":{"posthog":{"apiKey":"phc_hmwkFrlc9UVrdE1jyG8AEKoCQCSr8dScjsRpKoLBEiV","apiHost":"https://us.i.posthog.com"}},"contextual":{"options":["copy","chatgpt","claude","view"],"display":"header"},"styling":{"latex":false},"navigation":{"global":{"anchors":[{"anchor":"Discord","icon":"discord","href":"https://discord.gg/stagehand"},{"anchor":"GitHub","icon":"github","href":"https://github.com/browserbase/stagehand"},{"anchor":"Changelog","icon":"scroll","href":"https://github.com/browserbase/stagehand/releases"}]},"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"stagehand","hasAudioNarration":false,"actualSubdomain":"stagehand","customDomains":["docs.stagehand.dev"],"gitSource":{"type":"github","owner":"browserbase","repo":"stagehand","deployBranch":"docs-production","contentDirectory":"packages/docs","isPrivate":false,"mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6adfa131f461612355a9d86a","collectionId":"a8f25d5e-06b0-472f-864c-77e8c484ce0d","schemaVersion":"v3","latestBuiltDeploymentHistoryId":"6adfa131f461612355a9d86a"},"entitlements":{"AI_CHAT":{"status":"ENABLED"},"WEB_MCP":{"status":"ENABLED"},"NARRATION":{"status":"ENABLED"}},"buildId":"6adfa131f461612355a9d86a","clientVersion":"0.0.4071","searchFilterCounts":[{"language":"default","tag":"TypeScript","count":53},{"language":"default","tag":"API Reference","count":32},{"language":"default","tag":"Integrations","count":31},{"language":"default","tag":"Best Practices","count":11},{"language":"default","tag":"Reference","count":11},{"language":"default","tag":"Go","count":9},{"language":"default","tag":"Java","count":9},{"language":"default","tag":"Python","count":9},{"language":"default","tag":"Ruby","count":9},{"language":"default","tag":"Best practices","count":8}]},"assistantConfig":{},"basePath":"","hasChatPermissions":true,"hasWebMcpPermissions":true,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[],"page":{"pagePath":"v3/api-reference/python/execute-an-ai-agent","slug":"/v3/api-reference/python/execute-an-ai-agent","pageMetadata":{"title":"Execute an AI agent","description":"Runs an autonomous AI agent that can perform complex multi-step browser tasks.","deprecated":null,"version":null,"openapi":"/v3/openapi.json post /v1/sessions/{id}/agentExecute","href":"/v3/api-reference/python/execute-an-ai-agent","autogeneratedByOpenApi":true},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Runs an autonomous AI agent that can perform complex multi-step browser tasks.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){return _jsx(_Fragment,{})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Execute an AI agent","description":"Runs an autonomous AI agent that can perform complex multi-step browser tasks.","deprecated":null,"version":null,"openapi":"/v3/openapi.json post /v1/sessions/{id}/agentExecute","href":"/v3/api-reference/python/execute-an-ai-agent","autogeneratedByOpenApi":true}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[],"codeExamples":{}},"jsLinks":["/_mintlify/custom/stagehand/9925f322d52dece3/language-selector.js","/_mintlify/custom/stagehand/2000de99ab50d13e/scripts/sync-sdk-docs.js","/_mintlify/custom/stagehand/331973f287bf1fb3/scripts/runtimePaths.js","/_mintlify/custom/stagehand/de79ed803bd849f2/sdk-api-reference-labels.js"],"openApiReferenceData":{"operation":{"summary":"Execute an AI agent","description":"Runs an autonomous AI agent that can perform complex multi-step browser tasks.","operationId":"SessionAgentExecute","parameters":["8000a8ee-b976-4f82-8a81-84bc61a60a8c","4307d897-8aab-4a9a-9692-a58d30f1d502"],"requestBody":"58e67656-b2d4-4ffc-ad16-2c2ff409b8aa","responses":{"200":"5c366d3c-1092-429b-92cd-3e5e8e764591"},"x-codeSamples":[{"lang":"JavaScript","source":"import Stagehand from 'stagehand-sdk';\n\nconst client = new Stagehand({\n browserbaseAPIKey: process.env['BROWSERBASE_API_KEY'], // This is the default and can be omitted\n browserbaseProjectID: process.env['BROWSERBASE_PROJECT_ID'], // This is the default and can be omitted\n modelAPIKey: process.env['MODEL_API_KEY'], // This is the default and can be omitted\n});\n\nconst response = await client.sessions.execute('c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123', {\n agentConfig: {},\n executeOptions: {\n instruction: \"Log in with username 'demo' and password 'test123', then navigate to settings\",\n },\n});\n\nconsole.log(response.data);"},{"lang":"Python","source":"import os\nfrom stagehand import Stagehand\n\nclient = Stagehand(\n browserbase_api_key=os.environ.get(\"BROWSERBASE_API_KEY\"), # This is the default and can be omitted\n browserbase_project_id=os.environ.get(\"BROWSERBASE_PROJECT_ID\"), # This is the default and can be omitted\n model_api_key=os.environ.get(\"MODEL_API_KEY\"), # This is the default and can be omitted\n)\nfor session in client.sessions.execute(\n id=\"c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123\",\n agent_config={},\n execute_options={\n \"instruction\": \"Log in with username 'demo' and password 'test123', then navigate to settings\"\n },\n):\n print(session)"},{"lang":"Go","source":"package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/browserbase/stagehand-go\"\n\t\"github.com/browserbase/stagehand-go/option\"\n)\n\nfunc main() {\n\tclient := stagehand.NewClient(\n\t\toption.WithBrowserbaseAPIKey(\"My Browserbase API Key\"),\n\t\toption.WithBrowserbaseProjectID(\"My Browserbase Project ID\"),\n\t\toption.WithModelAPIKey(\"My Model API Key\"),\n\t)\n\tresponse, err := client.Sessions.Execute(\n\t\tcontext.TODO(),\n\t\t\"c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123\",\n\t\tstagehand.SessionExecuteParams{\n\t\t\tAgentConfig: stagehand.SessionExecuteParamsAgentConfig{},\n\t\t\tExecuteOptions: stagehand.SessionExecuteParamsExecuteOptions{\n\t\t\t\tInstruction: \"Log in with username 'demo' and password 'test123', then navigate to settings\",\n\t\t\t},\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", response.Data)\n}\n"},{"lang":"Java","source":"package com.browserbase.api.example;\n\nimport com.browserbase.api.client.StagehandClient;\nimport com.browserbase.api.client.okhttp.StagehandOkHttpClient;\nimport com.browserbase.api.models.sessions.SessionExecuteParams;\nimport com.browserbase.api.models.sessions.SessionExecuteResponse;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n StagehandClient client = StagehandOkHttpClient.fromEnv();\n\n SessionExecuteParams params = SessionExecuteParams.builder()\n .id(\"c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123\")\n .agentConfig(SessionExecuteParams.AgentConfig.builder().build())\n .executeOptions(SessionExecuteParams.ExecuteOptions.builder()\n .instruction(\"Log in with username 'demo' and password 'test123', then navigate to settings\")\n .build())\n .build();\n SessionExecuteResponse response = client.sessions().execute(params);\n }\n}"},{"lang":"Kotlin","source":"package com.browserbase.api.example\n\nimport com.browserbase.api.client.StagehandClient\nimport com.browserbase.api.client.okhttp.StagehandOkHttpClient\nimport com.browserbase.api.models.sessions.SessionExecuteParams\nimport com.browserbase.api.models.sessions.SessionExecuteResponse\n\nfun main() {\n val client: StagehandClient = StagehandOkHttpClient.fromEnv()\n\n val params: SessionExecuteParams = SessionExecuteParams.builder()\n .id(\"c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123\")\n .agentConfig(SessionExecuteParams.AgentConfig.builder().build())\n .executeOptions(SessionExecuteParams.ExecuteOptions.builder()\n .instruction(\"Log in with username 'demo' and password 'test123', then navigate to settings\")\n .build())\n .build()\n val response: SessionExecuteResponse = client.sessions().execute(params)\n}"},{"lang":"Ruby","source":"require \"stagehand\"\n\nstagehand = Stagehand::Client.new(\n browserbase_api_key: \"My Browserbase API Key\",\n browserbase_project_id: \"My Browserbase Project ID\",\n model_api_key: \"My Model API Key\"\n)\n\nresponse = stagehand.sessions.execute(\n \"c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123\",\n agent_config: {},\n execute_options: {instruction: \"Log in with username 'demo' and password 'test123', then navigate to settings\"}\n)\n\nputs(response)"},{"lang":"PHP","source":"\u003c?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\nuse Stagehand\\Client;\nuse Stagehand\\Core\\Exceptions\\APIException;\n\n$client = new Client(\n browserbaseAPIKey: getenv('BROWSERBASE_API_KEY') ?: 'My Browserbase API Key',\n browserbaseProjectID: getenv(\n 'BROWSERBASE_PROJECT_ID'\n ) ?: 'My Browserbase Project ID',\n modelAPIKey: getenv('MODEL_API_KEY') ?: 'My Model API Key',\n);\n\ntry {\n $response = $client->sessions->execute(\n 'c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123',\n agentConfig: [\n 'cua' => true,\n 'executionModel' => [\n 'auth' => [\n 'credentials' => [\n 'clientEmail' => 'client_email',\n 'privateKey' => 'private_key',\n 'authProviderX509CertURL' => 'https://example.com',\n 'authUri' => 'https://example.com',\n 'clientID' => 'client_id',\n 'clientX509CertURL' => 'https://example.com',\n 'privateKeyID' => 'private_key_id',\n 'projectID' => 'project_id',\n 'tokenUri' => 'https://example.com',\n 'type' => 'service_account',\n 'universeDomain' => 'universe_domain',\n ],\n 'type' => 'googleServiceAccount',\n 'projectID' => 'projectId',\n 'scopes' => 'string',\n 'universeDomain' => 'universeDomain',\n ],\n 'modelName' => 'openai/gpt-5.4-mini',\n 'provider' => 'vertex',\n 'providerOptions' => [\n 'vertex' => [\n 'location' => 'us-central1',\n 'project' => 'my-gcp-project',\n 'baseURL' => 'https://example.com',\n 'headers' => ['foo' => 'string'],\n ],\n ],\n 'apiKey' => 'sk-some-openai-api-key',\n 'baseURL' => 'https://api.openai.com/v1',\n 'headers' => ['foo' => 'string'],\n ],\n 'mode' => 'cua',\n 'model' => [\n 'auth' => [\n 'credentials' => [\n 'clientEmail' => 'client_email',\n 'privateKey' => 'private_key',\n 'authProviderX509CertURL' => 'https://example.com',\n 'authUri' => 'https://example.com',\n 'clientID' => 'client_id',\n 'clientX509CertURL' => 'https://example.com',\n 'privateKeyID' => 'private_key_id',\n 'projectID' => 'project_id',\n 'tokenUri' => 'https://example.com',\n 'type' => 'service_account',\n 'universeDomain' => 'universe_domain',\n ],\n 'type' => 'googleServiceAccount',\n 'projectID' => 'projectId',\n 'scopes' => 'string',\n 'universeDomain' => 'universeDomain',\n ],\n 'modelName' => 'openai/gpt-5.4-mini',\n 'provider' => 'vertex',\n 'providerOptions' => [\n 'vertex' => [\n 'location' => 'us-central1',\n 'project' => 'my-gcp-project',\n 'baseURL' => 'https://example.com',\n 'headers' => ['foo' => 'string'],\n ],\n ],\n 'apiKey' => 'sk-some-openai-api-key',\n 'baseURL' => 'https://api.openai.com/v1',\n 'headers' => ['foo' => 'string'],\n ],\n 'provider' => 'openai',\n 'systemPrompt' => 'systemPrompt',\n ],\n executeOptions: [\n 'instruction' => 'Log in with username \\'demo\\' and password \\'test123\\', then navigate to settings',\n 'highlightCursor' => true,\n 'maxSteps' => 20,\n 'toolTimeout' => 30000,\n 'useSearch' => true,\n 'variables' => ['foo' => 'string'],\n ],\n frameID: 'frameId',\n shouldCache: true,\n xStreamResponse: 'true',\n );\n\n var_dump($response);\n} catch (APIException $e) {\n echo $e->getMessage();\n}"},{"lang":"C#","source":"using System;\nusing System.Collections.Generic;\nusing Stagehand;\nusing Stagehand.Models.Sessions;\n\nStagehandClient client = new();\n\nSessionExecuteParams parameters = new()\n{\n ID = \"c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123\",\n AgentConfig = new()\n {\n Cua = true,\n ExecutionModel = new ExecutionModelVertexModelConfigObject()\n {\n Auth = new()\n {\n Credentials = new()\n {\n ClientEmail = \"client_email\",\n PrivateKey = \"private_key\",\n AuthProviderX509CertUrl = \"https://example.com\",\n AuthUri = \"https://example.com\",\n ClientID = \"client_id\",\n ClientX509CertUrl = \"https://example.com\",\n PrivateKeyID = \"private_key_id\",\n ProjectID = \"project_id\",\n TokenUri = \"https://example.com\",\n Type = ExecutionModelVertexModelConfigObjectAuthCredentialsType.ServiceAccount,\n UniverseDomain = \"universe_domain\",\n },\n ProjectID = \"projectId\",\n Scopes = \"string\",\n UniverseDomain = \"universeDomain\",\n },\n ModelName = \"openai/gpt-5.4-mini\",\n ProviderOptions = new(\n new ExecutionModelVertexModelConfigObjectProviderOptionsVertex()\n {\n Location = \"us-central1\",\n Project = \"my-gcp-project\",\n BaseUrl = \"https://example.com\",\n Headers = new Dictionary\u003cstring, string>()\n {\n { \"foo\", \"string\" }\n },\n }\n ),\n ApiKey = \"sk-some-openai-api-key\",\n BaseUrl = \"https://api.openai.com/v1\",\n Headers = new Dictionary\u003cstring, string>() { { \"foo\", \"string\" } },\n },\n Mode = Mode.Cua,\n Model = new AgentConfigModelVertexModelConfigObject()\n {\n Auth = new()\n {\n Credentials = new()\n {\n ClientEmail = \"client_email\",\n PrivateKey = \"private_key\",\n AuthProviderX509CertUrl = \"https://example.com\",\n AuthUri = \"https://example.com\",\n ClientID = \"client_id\",\n ClientX509CertUrl = \"https://example.com\",\n PrivateKeyID = \"private_key_id\",\n ProjectID = \"project_id\",\n TokenUri = \"https://example.com\",\n Type = AgentConfigModelVertexModelConfigObjectAuthCredentialsType.ServiceAccount,\n UniverseDomain = \"universe_domain\",\n },\n ProjectID = \"projectId\",\n Scopes = \"string\",\n UniverseDomain = \"universeDomain\",\n },\n ModelName = \"openai/gpt-5.4-mini\",\n ProviderOptions = new(\n new AgentConfigModelVertexModelConfigObjectProviderOptionsVertex(\n\n )\n {\n Location = \"us-central1\",\n Project = \"my-gcp-project\",\n BaseUrl = \"https://example.com\",\n Headers = new Dictionary\u003cstring, string>()\n {\n { \"foo\", \"string\" }\n },\n }\n ),\n ApiKey = \"sk-some-openai-api-key\",\n BaseUrl = \"https://api.openai.com/v1\",\n Headers = new Dictionary\u003cstring, string>() { { \"foo\", \"string\" } },\n },\n Provider = AgentConfigProvider.OpenAI,\n SystemPrompt = \"systemPrompt\",\n },\n ExecuteOptions = new()\n {\n Instruction = \"Log in with username 'demo' and password 'test123', then navigate to settings\",\n HighlightCursor = true,\n MaxSteps = 20,\n ToolTimeout = 30000,\n UseSearch = true,\n Variables = new Dictionary\u003cstring, ExecuteOptionsVariable>()\n {\n { \"foo\", \"string\" }\n },\n },\n};\n\nvar response = await client.Sessions.Execute(parameters);\n\nConsole.WriteLine(response);"}],"method":"post","type":"path","servers":["40da429c-9334-4c5a-9981-d59bc38e1245"],"security":["cc60a412-157a-4b6a-850a-a896e4b21ff4"],"path":"/v1/sessions/{id}/agentExecute","baseUrlOptions":["https://api.stagehand.browserbase.com"],"title":"Execute an AI agent","codeSamples":[{"lang":"JavaScript","source":"import Stagehand from 'stagehand-sdk';\n\nconst client = new Stagehand({\n browserbaseAPIKey: process.env['BROWSERBASE_API_KEY'], // This is the default and can be omitted\n browserbaseProjectID: process.env['BROWSERBASE_PROJECT_ID'], // This is the default and can be omitted\n modelAPIKey: process.env['MODEL_API_KEY'], // This is the default and can be omitted\n});\n\nconst response = await client.sessions.execute('c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123', {\n agentConfig: {},\n executeOptions: {\n instruction: \"Log in with username 'demo' and password 'test123', then navigate to settings\",\n },\n});\n\nconsole.log(response.data);"},{"lang":"Python","source":"import os\nfrom stagehand import Stagehand\n\nclient = Stagehand(\n browserbase_api_key=os.environ.get(\"BROWSERBASE_API_KEY\"), # This is the default and can be omitted\n browserbase_project_id=os.environ.get(\"BROWSERBASE_PROJECT_ID\"), # This is the default and can be omitted\n model_api_key=os.environ.get(\"MODEL_API_KEY\"), # This is the default and can be omitted\n)\nfor session in client.sessions.execute(\n id=\"c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123\",\n agent_config={},\n execute_options={\n \"instruction\": \"Log in with username 'demo' and password 'test123', then navigate to settings\"\n },\n):\n print(session)"},{"lang":"Go","source":"package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/browserbase/stagehand-go\"\n\t\"github.com/browserbase/stagehand-go/option\"\n)\n\nfunc main() {\n\tclient := stagehand.NewClient(\n\t\toption.WithBrowserbaseAPIKey(\"My Browserbase API Key\"),\n\t\toption.WithBrowserbaseProjectID(\"My Browserbase Project ID\"),\n\t\toption.WithModelAPIKey(\"My Model API Key\"),\n\t)\n\tresponse, err := client.Sessions.Execute(\n\t\tcontext.TODO(),\n\t\t\"c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123\",\n\t\tstagehand.SessionExecuteParams{\n\t\t\tAgentConfig: stagehand.SessionExecuteParamsAgentConfig{},\n\t\t\tExecuteOptions: stagehand.SessionExecuteParamsExecuteOptions{\n\t\t\t\tInstruction: \"Log in with username 'demo' and password 'test123', then navigate to settings\",\n\t\t\t},\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", response.Data)\n}\n"},{"lang":"Java","source":"package com.browserbase.api.example;\n\nimport com.browserbase.api.client.StagehandClient;\nimport com.browserbase.api.client.okhttp.StagehandOkHttpClient;\nimport com.browserbase.api.models.sessions.SessionExecuteParams;\nimport com.browserbase.api.models.sessions.SessionExecuteResponse;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n StagehandClient client = StagehandOkHttpClient.fromEnv();\n\n SessionExecuteParams params = SessionExecuteParams.builder()\n .id(\"c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123\")\n .agentConfig(SessionExecuteParams.AgentConfig.builder().build())\n .executeOptions(SessionExecuteParams.ExecuteOptions.builder()\n .instruction(\"Log in with username 'demo' and password 'test123', then navigate to settings\")\n .build())\n .build();\n SessionExecuteResponse response = client.sessions().execute(params);\n }\n}"},{"lang":"Kotlin","source":"package com.browserbase.api.example\n\nimport com.browserbase.api.client.StagehandClient\nimport com.browserbase.api.client.okhttp.StagehandOkHttpClient\nimport com.browserbase.api.models.sessions.SessionExecuteParams\nimport com.browserbase.api.models.sessions.SessionExecuteResponse\n\nfun main() {\n val client: StagehandClient = StagehandOkHttpClient.fromEnv()\n\n val params: SessionExecuteParams = SessionExecuteParams.builder()\n .id(\"c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123\")\n .agentConfig(SessionExecuteParams.AgentConfig.builder().build())\n .executeOptions(SessionExecuteParams.ExecuteOptions.builder()\n .instruction(\"Log in with username 'demo' and password 'test123', then navigate to settings\")\n .build())\n .build()\n val response: SessionExecuteResponse = client.sessions().execute(params)\n}"},{"lang":"Ruby","source":"require \"stagehand\"\n\nstagehand = Stagehand::Client.new(\n browserbase_api_key: \"My Browserbase API Key\",\n browserbase_project_id: \"My Browserbase Project ID\",\n model_api_key: \"My Model API Key\"\n)\n\nresponse = stagehand.sessions.execute(\n \"c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123\",\n agent_config: {},\n execute_options: {instruction: \"Log in with username 'demo' and password 'test123', then navigate to settings\"}\n)\n\nputs(response)"},{"lang":"PHP","source":"\u003c?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\nuse Stagehand\\Client;\nuse Stagehand\\Core\\Exceptions\\APIException;\n\n$client = new Client(\n browserbaseAPIKey: getenv('BROWSERBASE_API_KEY') ?: 'My Browserbase API Key',\n browserbaseProjectID: getenv(\n 'BROWSERBASE_PROJECT_ID'\n ) ?: 'My Browserbase Project ID',\n modelAPIKey: getenv('MODEL_API_KEY') ?: 'My Model API Key',\n);\n\ntry {\n $response = $client->sessions->execute(\n 'c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123',\n agentConfig: [\n 'cua' => true,\n 'executionModel' => [\n 'auth' => [\n 'credentials' => [\n 'clientEmail' => 'client_email',\n 'privateKey' => 'private_key',\n 'authProviderX509CertURL' => 'https://example.com',\n 'authUri' => 'https://example.com',\n 'clientID' => 'client_id',\n 'clientX509CertURL' => 'https://example.com',\n 'privateKeyID' => 'private_key_id',\n 'projectID' => 'project_id',\n 'tokenUri' => 'https://example.com',\n 'type' => 'service_account',\n 'universeDomain' => 'universe_domain',\n ],\n 'type' => 'googleServiceAccount',\n 'projectID' => 'projectId',\n 'scopes' => 'string',\n 'universeDomain' => 'universeDomain',\n ],\n 'modelName' => 'openai/gpt-5.4-mini',\n 'provider' => 'vertex',\n 'providerOptions' => [\n 'vertex' => [\n 'location' => 'us-central1',\n 'project' => 'my-gcp-project',\n 'baseURL' => 'https://example.com',\n 'headers' => ['foo' => 'string'],\n ],\n ],\n 'apiKey' => 'sk-some-openai-api-key',\n 'baseURL' => 'https://api.openai.com/v1',\n 'headers' => ['foo' => 'string'],\n ],\n 'mode' => 'cua',\n 'model' => [\n 'auth' => [\n 'credentials' => [\n 'clientEmail' => 'client_email',\n 'privateKey' => 'private_key',\n 'authProviderX509CertURL' => 'https://example.com',\n 'authUri' => 'https://example.com',\n 'clientID' => 'client_id',\n 'clientX509CertURL' => 'https://example.com',\n 'privateKeyID' => 'private_key_id',\n 'projectID' => 'project_id',\n 'tokenUri' => 'https://example.com',\n 'type' => 'service_account',\n 'universeDomain' => 'universe_domain',\n ],\n 'type' => 'googleServiceAccount',\n 'projectID' => 'projectId',\n 'scopes' => 'string',\n 'universeDomain' => 'universeDomain',\n ],\n 'modelName' => 'openai/gpt-5.4-mini',\n 'provider' => 'vertex',\n 'providerOptions' => [\n 'vertex' => [\n 'location' => 'us-central1',\n 'project' => 'my-gcp-project',\n 'baseURL' => 'https://example.com',\n 'headers' => ['foo' => 'string'],\n ],\n ],\n 'apiKey' => 'sk-some-openai-api-key',\n 'baseURL' => 'https://api.openai.com/v1',\n 'headers' => ['foo' => 'string'],\n ],\n 'provider' => 'openai',\n 'systemPrompt' => 'systemPrompt',\n ],\n executeOptions: [\n 'instruction' => 'Log in with username \\'demo\\' and password \\'test123\\', then navigate to settings',\n 'highlightCursor' => true,\n 'maxSteps' => 20,\n 'toolTimeout' => 30000,\n 'useSearch' => true,\n 'variables' => ['foo' => 'string'],\n ],\n frameID: 'frameId',\n shouldCache: true,\n xStreamResponse: 'true',\n );\n\n var_dump($response);\n} catch (APIException $e) {\n echo $e->getMessage();\n}"},{"lang":"C#","source":"using System;\nusing System.Collections.Generic;\nusing Stagehand;\nusing Stagehand.Models.Sessions;\n\nStagehandClient client = new();\n\nSessionExecuteParams parameters = new()\n{\n ID = \"c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123\",\n AgentConfig = new()\n {\n Cua = true,\n ExecutionModel = new ExecutionModelVertexModelConfigObject()\n {\n Auth = new()\n {\n Credentials = new()\n {\n ClientEmail = \"client_email\",\n PrivateKey = \"private_key\",\n AuthProviderX509CertUrl = \"https://example.com\",\n AuthUri = \"https://example.com\",\n ClientID = \"client_id\",\n ClientX509CertUrl = \"https://example.com\",\n PrivateKeyID = \"private_key_id\",\n ProjectID = \"project_id\",\n TokenUri = \"https://example.com\",\n Type = ExecutionModelVertexModelConfigObjectAuthCredentialsType.ServiceAccount,\n UniverseDomain = \"universe_domain\",\n },\n ProjectID = \"projectId\",\n Scopes = \"string\",\n UniverseDomain = \"universeDomain\",\n },\n ModelName = \"openai/gpt-5.4-mini\",\n ProviderOptions = new(\n new ExecutionModelVertexModelConfigObjectProviderOptionsVertex()\n {\n Location = \"us-central1\",\n Project = \"my-gcp-project\",\n BaseUrl = \"https://example.com\",\n Headers = new Dictionary\u003cstring, string>()\n {\n { \"foo\", \"string\" }\n },\n }\n ),\n ApiKey = \"sk-some-openai-api-key\",\n BaseUrl = \"https://api.openai.com/v1\",\n Headers = new Dictionary\u003cstring, string>() { { \"foo\", \"string\" } },\n },\n Mode = Mode.Cua,\n Model = new AgentConfigModelVertexModelConfigObject()\n {\n Auth = new()\n {\n Credentials = new()\n {\n ClientEmail = \"client_email\",\n PrivateKey = \"private_key\",\n AuthProviderX509CertUrl = \"https://example.com\",\n AuthUri = \"https://example.com\",\n ClientID = \"client_id\",\n ClientX509CertUrl = \"https://example.com\",\n PrivateKeyID = \"private_key_id\",\n ProjectID = \"project_id\",\n TokenUri = \"https://example.com\",\n Type = AgentConfigModelVertexModelConfigObjectAuthCredentialsType.ServiceAccount,\n UniverseDomain = \"universe_domain\",\n },\n ProjectID = \"projectId\",\n Scopes = \"string\",\n UniverseDomain = \"universeDomain\",\n },\n ModelName = \"openai/gpt-5.4-mini\",\n ProviderOptions = new(\n new AgentConfigModelVertexModelConfigObjectProviderOptionsVertex(\n\n )\n {\n Location = \"us-central1\",\n Project = \"my-gcp-project\",\n BaseUrl = \"https://example.com\",\n Headers = new Dictionary\u003cstring, string>()\n {\n { \"foo\", \"string\" }\n },\n }\n ),\n ApiKey = \"sk-some-openai-api-key\",\n BaseUrl = \"https://api.openai.com/v1\",\n Headers = new Dictionary\u003cstring, string>() { { \"foo\", \"string\" } },\n },\n Provider = AgentConfigProvider.OpenAI,\n SystemPrompt = \"systemPrompt\",\n },\n ExecuteOptions = new()\n {\n Instruction = \"Log in with username 'demo' and password 'test123', then navigate to settings\",\n HighlightCursor = true,\n MaxSteps = 20,\n ToolTimeout = 30000,\n UseSearch = true,\n Variables = new Dictionary\u003cstring, ExecuteOptionsVariable>()\n {\n { \"foo\", \"string\" }\n },\n },\n};\n\nvar response = await client.Sessions.Execute(parameters);\n\nConsole.WriteLine(response);"}],"requiredOnlyExamples":false,"requestExampleType":"codeSamples","responseExampleType":"generated"},"dependencies":{"parameters":{"8000a8ee-b976-4f82-8a81-84bc61a60a8c":{"schema":{"description":"Unique session identifier","example":"c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123","type":"string","isRequired":true,"uniqueKey":"","typeLabel":"string"},"in":"path","name":"id","required":true,"description":"Unique session identifier"},"4307d897-8aab-4a9a-9692-a58d30f1d502":{"schema":{"description":"Whether to stream the response via SSE","example":"true","type":"string","enum":["true","false"],"uniqueKey":"","typeLabel":"enum\u003cstring>"},"in":"header","name":"x-stream-response","description":"Whether to stream the response via SSE"}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"agentConfig":{"type":"object","properties":{"provider":{"description":"AI provider for the agent (legacy, use model: openai/gpt-5-nano instead)","example":"openai","type":"string","enum":["openai","anthropic","google","microsoft","bedrock"],"uniqueKey":"agentConfig.provider","typeLabel":"enum\u003cstring>"},"model":{"oneOf":[{"type":"object","description":"Model configuration object or model name string (e.g., 'openai/gpt-5-nano')","required":["modelName","provider","auth","providerOptions"],"properties":{"modelName":{"description":"Model name string with provider prefix (e.g., 'openai/gpt-5-nano')","example":"openai/gpt-5.4-mini","type":"string","isRequired":true,"uniqueKey":"agentConfig.model.oneOf.0.modelName","typeLabel":"string"},"provider":{"description":"Vertex AI model provider","type":"string","const":"vertex","isRequired":true,"uniqueKey":"agentConfig.model.oneOf.0.provider","typeLabel":"string"},"auth":{"type":"object","properties":{"type":{"description":"Use inline Google Cloud service account credentials for provider authentication","type":"string","const":"googleServiceAccount","isRequired":true,"uniqueKey":"agentConfig.model.oneOf.0.auth.type","typeLabel":"string"},"credentials":{"type":"object","properties":{"private_key":{"type":"string","isRequired":true,"uniqueKey":"agentConfig.model.oneOf.0.auth.credentials.private_key","typeLabel":"string"},"client_email":{"type":"string","isRequired":true,"uniqueKey":"agentConfig.model.oneOf.0.auth.credentials.client_email","typeLabel":"string"},"type":{"type":"string","const":"service_account","uniqueKey":"agentConfig.model.oneOf.0.auth.credentials.type","typeLabel":"string"},"project_id":{"type":"string","uniqueKey":"agentConfig.model.oneOf.0.auth.credentials.project_id","typeLabel":"string"},"private_key_id":{"type":"string","uniqueKey":"agentConfig.model.oneOf.0.auth.credentials.private_key_id","typeLabel":"string"},"client_id":{"type":"string","uniqueKey":"agentConfig.model.oneOf.0.auth.credentials.client_id","typeLabel":"string"},"auth_uri":{"type":"string","format":"uri","uniqueKey":"agentConfig.model.oneOf.0.auth.credentials.auth_uri","typeLabel":"string\u003curi>"},"token_uri":{"type":"string","format":"uri","uniqueKey":"agentConfig.model.oneOf.0.auth.credentials.token_uri","typeLabel":"string\u003curi>"},"auth_provider_x509_cert_url":{"type":"string","format":"uri","uniqueKey":"agentConfig.model.oneOf.0.auth.credentials.auth_provider_x509_cert_url","typeLabel":"string\u003curi>"},"client_x509_cert_url":{"type":"string","format":"uri","uniqueKey":"agentConfig.model.oneOf.0.auth.credentials.client_x509_cert_url","typeLabel":"string\u003curi>"},"universe_domain":{"type":"string","uniqueKey":"agentConfig.model.oneOf.0.auth.credentials.universe_domain","typeLabel":"string"}},"required":["private_key","client_email"],"additionalProperties":false,"description":"Google Cloud service account credentials","isRequired":true,"uniqueKey":"agentConfig.model.oneOf.0.auth.credentials","typeLabel":"object"},"scopes":{"oneOf":[{"type":"string","description":"Google auth scopes for the desired API request","uniqueKey":"agentConfig.model.oneOf.0.auth.scopes.oneOf.0","typeLabel":"string"},{"type":"array","items":{"type":"string","uniqueKey":"agentConfig.model.oneOf.0.auth.scopes.oneOf.1.items.[INDEX]","typeLabel":"string"},"description":"Google auth scopes for the desired API request","uniqueKey":"agentConfig.model.oneOf.0.auth.scopes.oneOf.1","typeLabel":"string[]"}],"uniqueKey":"agentConfig.model.oneOf.0.auth.scopes","typeLabel":"string | string[]"},"projectId":{"description":"Google Cloud project ID used by google-auth-library","type":"string","uniqueKey":"agentConfig.model.oneOf.0.auth.projectId","typeLabel":"string"},"universeDomain":{"description":"Google Cloud universe domain","type":"string","uniqueKey":"agentConfig.model.oneOf.0.auth.universeDomain","typeLabel":"string"}},"required":["type","credentials"],"additionalProperties":false,"description":"Vertex provider authentication configuration","isRequired":true,"uniqueKey":"agentConfig.model.oneOf.0.auth","typeLabel":"object"},"providerOptions":{"type":"object","properties":{"vertex":{"type":"object","properties":{"project":{"description":"Google Cloud project ID for Vertex AI models","example":"my-gcp-project","type":"string","isRequired":true,"uniqueKey":"agentConfig.model.oneOf.0.providerOptions.vertex.project","typeLabel":"string"},"location":{"description":"Google Cloud location for Vertex AI models","example":"us-central1","type":"string","isRequired":true,"uniqueKey":"agentConfig.model.oneOf.0.providerOptions.vertex.location","typeLabel":"string"},"baseURL":{"description":"Base URL for the Vertex AI provider","type":"string","format":"uri","uniqueKey":"agentConfig.model.oneOf.0.providerOptions.vertex.baseURL","typeLabel":"string\u003curi>"},"headers":{"description":"Custom headers sent with every request to the Vertex AI provider","type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string","uniqueKey":"agentConfig.model.oneOf.0.providerOptions.vertex.headers.additionalProperties","typeLabel":"string"},"uniqueKey":"agentConfig.model.oneOf.0.providerOptions.vertex.headers","typeLabel":"object"}},"required":["project","location"],"additionalProperties":false,"description":"Vertex AI provider-specific settings","isRequired":true,"uniqueKey":"agentConfig.model.oneOf.0.providerOptions.vertex","typeLabel":"object"}},"required":["vertex"],"additionalProperties":false,"description":"Vertex provider-specific model configuration","isRequired":true,"uniqueKey":"agentConfig.model.oneOf.0.providerOptions","typeLabel":"object"},"apiKey":{"description":"API key for the model provider","example":"sk-some-openai-api-key","type":"string","uniqueKey":"agentConfig.model.oneOf.0.apiKey","typeLabel":"string"},"baseURL":{"description":"Base URL for the model provider","example":"https://api.openai.com/v1","type":"string","format":"uri","uniqueKey":"agentConfig.model.oneOf.0.baseURL","typeLabel":"string\u003curi>"},"headers":{"description":"Custom headers sent with every request to the model provider","type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string","uniqueKey":"agentConfig.model.oneOf.0.headers.additionalProperties","typeLabel":"string"},"uniqueKey":"agentConfig.model.oneOf.0.headers","typeLabel":"object"}},"additionalProperties":false,"uniqueKey":"agentConfig.model.oneOf.0","typeLabel":"object"},{"type":"object","description":"Model configuration object or model name string (e.g., 'openai/gpt-5-nano')","required":["modelName","provider","providerOptions","auth"],"properties":{"modelName":{"description":"Model name string with provider prefix (e.g., 'openai/gpt-5-nano')","example":"openai/gpt-5.4-mini","type":"string","isRequired":true,"uniqueKey":"agentConfig.model.oneOf.1.modelName","typeLabel":"string"},"provider":{"description":"Azure OpenAI model provider","type":"string","const":"azure","isRequired":true,"uniqueKey":"agentConfig.model.oneOf.1.provider","typeLabel":"string"},"providerOptions":{"type":"object","properties":{"azure":{"type":"object","properties":{"resourceName":{"description":"Azure OpenAI resource name","example":"my-azure-openai-resource","type":"string","uniqueKey":"agentConfig.model.oneOf.1.providerOptions.azure.resourceName","typeLabel":"string"},"baseURL":{"description":"Base URL for the Azure OpenAI provider","type":"string","format":"uri","uniqueKey":"agentConfig.model.oneOf.1.providerOptions.azure.baseURL","typeLabel":"string\u003curi>"},"apiVersion":{"description":"Azure OpenAI API version","example":"2024-10-01-preview","type":"string","uniqueKey":"agentConfig.model.oneOf.1.providerOptions.azure.apiVersion","typeLabel":"string"},"useDeploymentBasedUrls":{"description":"Whether to use deployment-based Azure OpenAI URLs","type":"boolean","uniqueKey":"agentConfig.model.oneOf.1.providerOptions.azure.useDeploymentBasedUrls","typeLabel":"boolean"},"headers":{"description":"Custom headers sent with every request to the Azure OpenAI provider","type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string","uniqueKey":"agentConfig.model.oneOf.1.providerOptions.azure.headers.additionalProperties","typeLabel":"string"},"uniqueKey":"agentConfig.model.oneOf.1.providerOptions.azure.headers","typeLabel":"object"}},"additionalProperties":false,"description":"Azure OpenAI provider-specific settings","isRequired":true,"uniqueKey":"agentConfig.model.oneOf.1.providerOptions.azure","typeLabel":"object"}},"required":["azure"],"additionalProperties":false,"description":"Azure provider-specific model configuration","isRequired":true,"uniqueKey":"agentConfig.model.oneOf.1.providerOptions","typeLabel":"object"},"auth":{"type":"object","properties":{"type":{"description":"Use a Microsoft Entra ID bearer token for authentication","type":"string","const":"azureEntraId","isRequired":true,"uniqueKey":"agentConfig.model.oneOf.1.auth.type","typeLabel":"string"},"token":{"description":"Microsoft Entra ID bearer token for Azure OpenAI","type":"string","minLength":1,"isRequired":true,"uniqueKey":"agentConfig.model.oneOf.1.auth.token","typeLabel":"string"}},"required":["type","token"],"additionalProperties":false,"description":"Azure provider authentication configuration","isRequired":true,"uniqueKey":"agentConfig.model.oneOf.1.auth","typeLabel":"object"},"baseURL":{"description":"Base URL for the model provider","example":"https://api.openai.com/v1","type":"string","format":"uri","uniqueKey":"agentConfig.model.oneOf.1.baseURL","typeLabel":"string\u003curi>"},"headers":{"description":"Custom headers sent with every request to the model provider","type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string","uniqueKey":"agentConfig.model.oneOf.1.headers.additionalProperties","typeLabel":"string"},"uniqueKey":"agentConfig.model.oneOf.1.headers","typeLabel":"object"}},"additionalProperties":false,"uniqueKey":"agentConfig.model.oneOf.1","typeLabel":"object"},{"type":"object","description":"Model configuration object or model name string (e.g., 'openai/gpt-5-nano')","required":["modelName","provider","providerOptions"],"properties":{"modelName":{"description":"Model name string with provider prefix (e.g., 'openai/gpt-5-nano')","example":"openai/gpt-5.4-mini","type":"string","isRequired":true,"uniqueKey":"agentConfig.model.oneOf.2.modelName","typeLabel":"string"},"provider":{"description":"Azure OpenAI model provider","type":"string","const":"azure","isRequired":true,"uniqueKey":"agentConfig.model.oneOf.2.provider","typeLabel":"string"},"providerOptions":{"type":"object","properties":{"azure":{"type":"object","properties":{"resourceName":{"description":"Azure OpenAI resource name","example":"my-azure-openai-resource","type":"string","uniqueKey":"agentConfig.model.oneOf.2.providerOptions.azure.resourceName","typeLabel":"string"},"baseURL":{"description":"Base URL for the Azure OpenAI provider","type":"string","format":"uri","uniqueKey":"agentConfig.model.oneOf.2.providerOptions.azure.baseURL","typeLabel":"string\u003curi>"},"apiVersion":{"description":"Azure OpenAI API version","example":"2024-10-01-preview","type":"string","uniqueKey":"agentConfig.model.oneOf.2.providerOptions.azure.apiVersion","typeLabel":"string"},"useDeploymentBasedUrls":{"description":"Whether to use deployment-based Azure OpenAI URLs","type":"boolean","uniqueKey":"agentConfig.model.oneOf.2.providerOptions.azure.useDeploymentBasedUrls","typeLabel":"boolean"},"headers":{"description":"Custom headers sent with every request to the Azure OpenAI provider","type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string","uniqueKey":"agentConfig.model.oneOf.2.providerOptions.azure.headers.additionalProperties","typeLabel":"string"},"uniqueKey":"agentConfig.model.oneOf.2.providerOptions.azure.headers","typeLabel":"object"}},"additionalProperties":false,"description":"Azure OpenAI provider-specific settings","isRequired":true,"uniqueKey":"agentConfig.model.oneOf.2.providerOptions.azure","typeLabel":"object"}},"required":["azure"],"additionalProperties":false,"description":"Azure provider-specific model configuration","isRequired":true,"uniqueKey":"agentConfig.model.oneOf.2.providerOptions","typeLabel":"object"},"apiKey":{"description":"API key for the model provider","example":"sk-some-openai-api-key","type":"string","uniqueKey":"agentConfig.model.oneOf.2.apiKey","typeLabel":"string"},"baseURL":{"description":"Base URL for the model provider","example":"https://api.openai.com/v1","type":"string","format":"uri","uniqueKey":"agentConfig.model.oneOf.2.baseURL","typeLabel":"string\u003curi>"},"headers":{"description":"Custom headers sent with every request to the model provider","type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string","uniqueKey":"agentConfig.model.oneOf.2.headers.additionalProperties","typeLabel":"string"},"uniqueKey":"agentConfig.model.oneOf.2.headers","typeLabel":"object"}},"additionalProperties":false,"uniqueKey":"agentConfig.model.oneOf.2","typeLabel":"object"},{"type":"object","description":"Model configuration object or model name string (e.g., 'openai/gpt-5-nano')","required":["modelName"],"properties":{"modelName":{"description":"Model name string with provider prefix (e.g., 'openai/gpt-5-nano')","example":"openai/gpt-5.4-mini","type":"string","isRequired":true,"uniqueKey":"agentConfig.model.oneOf.3.modelName","typeLabel":"string"},"apiKey":{"description":"API key for the model provider","example":"sk-some-openai-api-key","type":"string","uniqueKey":"agentConfig.model.oneOf.3.apiKey","typeLabel":"string"},"baseURL":{"description":"Base URL for the model provider","example":"https://api.openai.com/v1","type":"string","format":"uri","uniqueKey":"agentConfig.model.oneOf.3.baseURL","typeLabel":"string\u003curi>"},"headers":{"description":"Custom headers sent with every request to the model provider","type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string","uniqueKey":"agentConfig.model.oneOf.3.headers.additionalProperties","typeLabel":"string"},"uniqueKey":"agentConfig.model.oneOf.3.headers","typeLabel":"object"},"openaiEndpointFormat":{"description":"Wire format used by an OpenAI-compatible endpoint. Defaults to the Responses API; use chat for Chat Completions-only endpoints.","example":"chat","type":"string","enum":["responses","chat"],"uniqueKey":"agentConfig.model.oneOf.3.openaiEndpointFormat","typeLabel":"enum\u003cstring>"},"provider":{"description":"AI provider for the model (or provide a baseURL endpoint instead)","example":"openai","type":"string","enum":["openai","anthropic","google","microsoft","bedrock"],"uniqueKey":"agentConfig.model.oneOf.3.provider","typeLabel":"enum\u003cstring>"}},"additionalProperties":false,"uniqueKey":"agentConfig.model.oneOf.3","typeLabel":"object"},{"type":"string","description":"Model configuration object or model name string (e.g., 'openai/gpt-5-nano')","uniqueKey":"agentConfig.model.oneOf.4","typeLabel":"string"}],"uniqueKey":"agentConfig.model","typeLabel":"object · object · object · object · string"},"systemPrompt":{"description":"Custom system prompt for the agent","type":"string","uniqueKey":"agentConfig.systemPrompt","typeLabel":"string"},"cua":{"description":"Deprecated. Use mode: 'cua' instead. If both are provided, mode takes precedence.","example":true,"type":"boolean","uniqueKey":"agentConfig.cua","typeLabel":"boolean"},"mode":{"description":"Tool mode for the agent (dom, hybrid, cua). If set, overrides cua.","example":"cua","type":"string","enum":["dom","hybrid","cua"],"uniqueKey":"agentConfig.mode","typeLabel":"enum\u003cstring>"},"executionModel":{"oneOf":[{"type":"object","description":"Model configuration object or model name string (e.g., 'openai/gpt-5-nano') for tool execution (observe/act calls within agent tools). If not specified, inherits from the main model configuration.","required":["modelName","provider","auth","providerOptions"],"properties":{"modelName":{"description":"Model name string with provider prefix (e.g., 'openai/gpt-5-nano')","example":"openai/gpt-5.4-mini","type":"string","isRequired":true,"uniqueKey":"agentConfig.executionModel.oneOf.0.modelName","typeLabel":"string"},"provider":{"description":"Vertex AI model provider","type":"string","const":"vertex","isRequired":true,"uniqueKey":"agentConfig.executionModel.oneOf.0.provider","typeLabel":"string"},"auth":{"type":"object","properties":{"type":{"description":"Use inline Google Cloud service account credentials for provider authentication","type":"string","const":"googleServiceAccount","isRequired":true,"uniqueKey":"agentConfig.executionModel.oneOf.0.auth.type","typeLabel":"string"},"credentials":{"type":"object","properties":{"private_key":{"type":"string","isRequired":true,"uniqueKey":"agentConfig.executionModel.oneOf.0.auth.credentials.private_key","typeLabel":"string"},"client_email":{"type":"string","isRequired":true,"uniqueKey":"agentConfig.executionModel.oneOf.0.auth.credentials.client_email","typeLabel":"string"},"type":{"type":"string","const":"service_account","uniqueKey":"agentConfig.executionModel.oneOf.0.auth.credentials.type","typeLabel":"string"},"project_id":{"type":"string","uniqueKey":"agentConfig.executionModel.oneOf.0.auth.credentials.project_id","typeLabel":"string"},"private_key_id":{"type":"string","uniqueKey":"agentConfig.executionModel.oneOf.0.auth.credentials.private_key_id","typeLabel":"string"},"client_id":{"type":"string","uniqueKey":"agentConfig.executionModel.oneOf.0.auth.credentials.client_id","typeLabel":"string"},"auth_uri":{"type":"string","format":"uri","uniqueKey":"agentConfig.executionModel.oneOf.0.auth.credentials.auth_uri","typeLabel":"string\u003curi>"},"token_uri":{"type":"string","format":"uri","uniqueKey":"agentConfig.executionModel.oneOf.0.auth.credentials.token_uri","typeLabel":"string\u003curi>"},"auth_provider_x509_cert_url":{"type":"string","format":"uri","uniqueKey":"agentConfig.executionModel.oneOf.0.auth.credentials.auth_provider_x509_cert_url","typeLabel":"string\u003curi>"},"client_x509_cert_url":{"type":"string","format":"uri","uniqueKey":"agentConfig.executionModel.oneOf.0.auth.credentials.client_x509_cert_url","typeLabel":"string\u003curi>"},"universe_domain":{"type":"string","uniqueKey":"agentConfig.executionModel.oneOf.0.auth.credentials.universe_domain","typeLabel":"string"}},"required":["private_key","client_email"],"additionalProperties":false,"description":"Google Cloud service account credentials","isRequired":true,"uniqueKey":"agentConfig.executionModel.oneOf.0.auth.credentials","typeLabel":"object"},"scopes":{"oneOf":[{"type":"string","description":"Google auth scopes for the desired API request","uniqueKey":"agentConfig.executionModel.oneOf.0.auth.scopes.oneOf.0","typeLabel":"string"},{"type":"array","items":{"type":"string","uniqueKey":"agentConfig.executionModel.oneOf.0.auth.scopes.oneOf.1.items.[INDEX]","typeLabel":"string"},"description":"Google auth scopes for the desired API request","uniqueKey":"agentConfig.executionModel.oneOf.0.auth.scopes.oneOf.1","typeLabel":"string[]"}],"uniqueKey":"agentConfig.executionModel.oneOf.0.auth.scopes","typeLabel":"string | string[]"},"projectId":{"description":"Google Cloud project ID used by google-auth-library","type":"string","uniqueKey":"agentConfig.executionModel.oneOf.0.auth.projectId","typeLabel":"string"},"universeDomain":{"description":"Google Cloud universe domain","type":"string","uniqueKey":"agentConfig.executionModel.oneOf.0.auth.universeDomain","typeLabel":"string"}},"required":["type","credentials"],"additionalProperties":false,"description":"Vertex provider authentication configuration","isRequired":true,"uniqueKey":"agentConfig.executionModel.oneOf.0.auth","typeLabel":"object"},"providerOptions":{"type":"object","properties":{"vertex":{"type":"object","properties":{"project":{"description":"Google Cloud project ID for Vertex AI models","example":"my-gcp-project","type":"string","isRequired":true,"uniqueKey":"agentConfig.executionModel.oneOf.0.providerOptions.vertex.project","typeLabel":"string"},"location":{"description":"Google Cloud location for Vertex AI models","example":"us-central1","type":"string","isRequired":true,"uniqueKey":"agentConfig.executionModel.oneOf.0.providerOptions.vertex.location","typeLabel":"string"},"baseURL":{"description":"Base URL for the Vertex AI provider","type":"string","format":"uri","uniqueKey":"agentConfig.executionModel.oneOf.0.providerOptions.vertex.baseURL","typeLabel":"string\u003curi>"},"headers":{"description":"Custom headers sent with every request to the Vertex AI provider","type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string","uniqueKey":"agentConfig.executionModel.oneOf.0.providerOptions.vertex.headers.additionalProperties","typeLabel":"string"},"uniqueKey":"agentConfig.executionModel.oneOf.0.providerOptions.vertex.headers","typeLabel":"object"}},"required":["project","location"],"additionalProperties":false,"description":"Vertex AI provider-specific settings","isRequired":true,"uniqueKey":"agentConfig.executionModel.oneOf.0.providerOptions.vertex","typeLabel":"object"}},"required":["vertex"],"additionalProperties":false,"description":"Vertex provider-specific model configuration","isRequired":true,"uniqueKey":"agentConfig.executionModel.oneOf.0.providerOptions","typeLabel":"object"},"apiKey":{"description":"API key for the model provider","example":"sk-some-openai-api-key","type":"string","uniqueKey":"agentConfig.executionModel.oneOf.0.apiKey","typeLabel":"string"},"baseURL":{"description":"Base URL for the model provider","example":"https://api.openai.com/v1","type":"string","format":"uri","uniqueKey":"agentConfig.executionModel.oneOf.0.baseURL","typeLabel":"string\u003curi>"},"headers":{"description":"Custom headers sent with every request to the model provider","type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string","uniqueKey":"agentConfig.executionModel.oneOf.0.headers.additionalProperties","typeLabel":"string"},"uniqueKey":"agentConfig.executionModel.oneOf.0.headers","typeLabel":"object"}},"additionalProperties":false,"uniqueKey":"agentConfig.executionModel.oneOf.0","typeLabel":"object"},{"type":"object","description":"Model configuration object or model name string (e.g., 'openai/gpt-5-nano') for tool execution (observe/act calls within agent tools). If not specified, inherits from the main model configuration.","required":["modelName","provider","providerOptions","auth"],"properties":{"modelName":{"description":"Model name string with provider prefix (e.g., 'openai/gpt-5-nano')","example":"openai/gpt-5.4-mini","type":"string","isRequired":true,"uniqueKey":"agentConfig.executionModel.oneOf.1.modelName","typeLabel":"string"},"provider":{"description":"Azure OpenAI model provider","type":"string","const":"azure","isRequired":true,"uniqueKey":"agentConfig.executionModel.oneOf.1.provider","typeLabel":"string"},"providerOptions":{"type":"object","properties":{"azure":{"type":"object","properties":{"resourceName":{"description":"Azure OpenAI resource name","example":"my-azure-openai-resource","type":"string","uniqueKey":"agentConfig.executionModel.oneOf.1.providerOptions.azure.resourceName","typeLabel":"string"},"baseURL":{"description":"Base URL for the Azure OpenAI provider","type":"string","format":"uri","uniqueKey":"agentConfig.executionModel.oneOf.1.providerOptions.azure.baseURL","typeLabel":"string\u003curi>"},"apiVersion":{"description":"Azure OpenAI API version","example":"2024-10-01-preview","type":"string","uniqueKey":"agentConfig.executionModel.oneOf.1.providerOptions.azure.apiVersion","typeLabel":"string"},"useDeploymentBasedUrls":{"description":"Whether to use deployment-based Azure OpenAI URLs","type":"boolean","uniqueKey":"agentConfig.executionModel.oneOf.1.providerOptions.azure.useDeploymentBasedUrls","typeLabel":"boolean"},"headers":{"description":"Custom headers sent with every request to the Azure OpenAI provider","type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string","uniqueKey":"agentConfig.executionModel.oneOf.1.providerOptions.azure.headers.additionalProperties","typeLabel":"string"},"uniqueKey":"agentConfig.executionModel.oneOf.1.providerOptions.azure.headers","typeLabel":"object"}},"additionalProperties":false,"description":"Azure OpenAI provider-specific settings","isRequired":true,"uniqueKey":"agentConfig.executionModel.oneOf.1.providerOptions.azure","typeLabel":"object"}},"required":["azure"],"additionalProperties":false,"description":"Azure provider-specific model configuration","isRequired":true,"uniqueKey":"agentConfig.executionModel.oneOf.1.providerOptions","typeLabel":"object"},"auth":{"type":"object","properties":{"type":{"description":"Use a Microsoft Entra ID bearer token for authentication","type":"string","const":"azureEntraId","isRequired":true,"uniqueKey":"agentConfig.executionModel.oneOf.1.auth.type","typeLabel":"string"},"token":{"description":"Microsoft Entra ID bearer token for Azure OpenAI","type":"string","minLength":1,"isRequired":true,"uniqueKey":"agentConfig.executionModel.oneOf.1.auth.token","typeLabel":"string"}},"required":["type","token"],"additionalProperties":false,"description":"Azure provider authentication configuration","isRequired":true,"uniqueKey":"agentConfig.executionModel.oneOf.1.auth","typeLabel":"object"},"baseURL":{"description":"Base URL for the model provider","example":"https://api.openai.com/v1","type":"string","format":"uri","uniqueKey":"agentConfig.executionModel.oneOf.1.baseURL","typeLabel":"string\u003curi>"},"headers":{"description":"Custom headers sent with every request to the model provider","type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string","uniqueKey":"agentConfig.executionModel.oneOf.1.headers.additionalProperties","typeLabel":"string"},"uniqueKey":"agentConfig.executionModel.oneOf.1.headers","typeLabel":"object"}},"additionalProperties":false,"uniqueKey":"agentConfig.executionModel.oneOf.1","typeLabel":"object"},{"type":"object","description":"Model configuration object or model name string (e.g., 'openai/gpt-5-nano') for tool execution (observe/act calls within agent tools). If not specified, inherits from the main model configuration.","required":["modelName","provider","providerOptions"],"properties":{"modelName":{"description":"Model name string with provider prefix (e.g., 'openai/gpt-5-nano')","example":"openai/gpt-5.4-mini","type":"string","isRequired":true,"uniqueKey":"agentConfig.executionModel.oneOf.2.modelName","typeLabel":"string"},"provider":{"description":"Azure OpenAI model provider","type":"string","const":"azure","isRequired":true,"uniqueKey":"agentConfig.executionModel.oneOf.2.provider","typeLabel":"string"},"providerOptions":{"type":"object","properties":{"azure":{"type":"object","properties":{"resourceName":{"description":"Azure OpenAI resource name","example":"my-azure-openai-resource","type":"string","uniqueKey":"agentConfig.executionModel.oneOf.2.providerOptions.azure.resourceName","typeLabel":"string"},"baseURL":{"description":"Base URL for the Azure OpenAI provider","type":"string","format":"uri","uniqueKey":"agentConfig.executionModel.oneOf.2.providerOptions.azure.baseURL","typeLabel":"string\u003curi>"},"apiVersion":{"description":"Azure OpenAI API version","example":"2024-10-01-preview","type":"string","uniqueKey":"agentConfig.executionModel.oneOf.2.providerOptions.azure.apiVersion","typeLabel":"string"},"useDeploymentBasedUrls":{"description":"Whether to use deployment-based Azure OpenAI URLs","type":"boolean","uniqueKey":"agentConfig.executionModel.oneOf.2.providerOptions.azure.useDeploymentBasedUrls","typeLabel":"boolean"},"headers":{"description":"Custom headers sent with every request to the Azure OpenAI provider","type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string","uniqueKey":"agentConfig.executionModel.oneOf.2.providerOptions.azure.headers.additionalProperties","typeLabel":"string"},"uniqueKey":"agentConfig.executionModel.oneOf.2.providerOptions.azure.headers","typeLabel":"object"}},"additionalProperties":false,"description":"Azure OpenAI provider-specific settings","isRequired":true,"uniqueKey":"agentConfig.executionModel.oneOf.2.providerOptions.azure","typeLabel":"object"}},"required":["azure"],"additionalProperties":false,"description":"Azure provider-specific model configuration","isRequired":true,"uniqueKey":"agentConfig.executionModel.oneOf.2.providerOptions","typeLabel":"object"},"apiKey":{"description":"API key for the model provider","example":"sk-some-openai-api-key","type":"string","uniqueKey":"agentConfig.executionModel.oneOf.2.apiKey","typeLabel":"string"},"baseURL":{"description":"Base URL for the model provider","example":"https://api.openai.com/v1","type":"string","format":"uri","uniqueKey":"agentConfig.executionModel.oneOf.2.baseURL","typeLabel":"string\u003curi>"},"headers":{"description":"Custom headers sent with every request to the model provider","type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string","uniqueKey":"agentConfig.executionModel.oneOf.2.headers.additionalProperties","typeLabel":"string"},"uniqueKey":"agentConfig.executionModel.oneOf.2.headers","typeLabel":"object"}},"additionalProperties":false,"uniqueKey":"agentConfig.executionModel.oneOf.2","typeLabel":"object"},{"type":"object","description":"Model configuration object or model name string (e.g., 'openai/gpt-5-nano') for tool execution (observe/act calls within agent tools). If not specified, inherits from the main model configuration.","required":["modelName"],"properties":{"modelName":{"description":"Model name string with provider prefix (e.g., 'openai/gpt-5-nano')","example":"openai/gpt-5.4-mini","type":"string","isRequired":true,"uniqueKey":"agentConfig.executionModel.oneOf.3.modelName","typeLabel":"string"},"apiKey":{"description":"API key for the model provider","example":"sk-some-openai-api-key","type":"string","uniqueKey":"agentConfig.executionModel.oneOf.3.apiKey","typeLabel":"string"},"baseURL":{"description":"Base URL for the model provider","example":"https://api.openai.com/v1","type":"string","format":"uri","uniqueKey":"agentConfig.executionModel.oneOf.3.baseURL","typeLabel":"string\u003curi>"},"headers":{"description":"Custom headers sent with every request to the model provider","type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string","uniqueKey":"agentConfig.executionModel.oneOf.3.headers.additionalProperties","typeLabel":"string"},"uniqueKey":"agentConfig.executionModel.oneOf.3.headers","typeLabel":"object"},"openaiEndpointFormat":{"description":"Wire format used by an OpenAI-compatible endpoint. Defaults to the Responses API; use chat for Chat Completions-only endpoints.","example":"chat","type":"string","enum":["responses","chat"],"uniqueKey":"agentConfig.executionModel.oneOf.3.openaiEndpointFormat","typeLabel":"enum\u003cstring>"},"provider":{"description":"AI provider for the model (or provide a baseURL endpoint instead)","example":"openai","type":"string","enum":["openai","anthropic","google","microsoft","bedrock"],"uniqueKey":"agentConfig.executionModel.oneOf.3.provider","typeLabel":"enum\u003cstring>"}},"additionalProperties":false,"uniqueKey":"agentConfig.executionModel.oneOf.3","typeLabel":"object"},{"type":"string","description":"Model configuration object or model name string (e.g., 'openai/gpt-5-nano') for tool execution (observe/act calls within agent tools). If not specified, inherits from the main model configuration.","uniqueKey":"agentConfig.executionModel.oneOf.4","typeLabel":"string"}],"uniqueKey":"agentConfig.executionModel","typeLabel":"object · object · object · object · string"}},"isRequired":true,"uniqueKey":"agentConfig","typeLabel":"object"},"executeOptions":{"type":"object","properties":{"instruction":{"description":"Natural language instruction for the agent","example":"Log in with username 'demo' and password 'test123', then navigate to settings","type":"string","isRequired":true,"uniqueKey":"executeOptions.instruction","typeLabel":"string"},"maxSteps":{"description":"Maximum number of steps the agent can take","example":20,"type":"number","uniqueKey":"executeOptions.maxSteps","typeLabel":"number"},"highlightCursor":{"description":"Whether to visually highlight the cursor during execution","example":true,"type":"boolean","uniqueKey":"executeOptions.highlightCursor","typeLabel":"boolean"},"useSearch":{"description":"Whether to enable the web search tool powered by Browserbase Search API","example":true,"type":"boolean","uniqueKey":"executeOptions.useSearch","typeLabel":"boolean"},"toolTimeout":{"description":"Timeout in milliseconds for each agent tool call","example":30000,"type":"number","uniqueKey":"executeOptions.toolTimeout","typeLabel":"number"},"variables":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"oneOf":[{"type":"string","uniqueKey":"executeOptions.variables.additionalProperties.oneOf.0","typeLabel":"string"},{"type":"number","uniqueKey":"executeOptions.variables.additionalProperties.oneOf.1","typeLabel":"number"},{"type":"boolean","uniqueKey":"executeOptions.variables.additionalProperties.oneOf.2","typeLabel":"boolean"},{"type":"object","required":["value"],"properties":{"value":{"oneOf":[{"type":"string","isRequired":true,"uniqueKey":"executeOptions.variables.additionalProperties.oneOf.3.value.oneOf.0","typeLabel":"string"},{"type":"number","isRequired":true,"uniqueKey":"executeOptions.variables.additionalProperties.oneOf.3.value.oneOf.1","typeLabel":"number"},{"type":"boolean","isRequired":true,"uniqueKey":"executeOptions.variables.additionalProperties.oneOf.3.value.oneOf.2","typeLabel":"boolean"}],"isRequired":true,"uniqueKey":"executeOptions.variables.additionalProperties.oneOf.3.value","typeLabel":"string | number | boolean"},"description":{"type":"string","uniqueKey":"executeOptions.variables.additionalProperties.oneOf.3.description","typeLabel":"string"}},"additionalProperties":false,"uniqueKey":"executeOptions.variables.additionalProperties.oneOf.3","typeLabel":"object"}],"uniqueKey":"executeOptions.variables.additionalProperties","typeLabel":"string | number | boolean | object"},"description":"Variables available to the agent via %variableName% syntax in supported tools","uniqueKey":"executeOptions.variables","typeLabel":"object"}},"required":["instruction"],"isRequired":true,"uniqueKey":"executeOptions","typeLabel":"object"},"frameId":{"oneOf":[{"type":"string","description":"Target frame ID for the agent","uniqueKey":"frameId.oneOf.0","typeLabel":"string"},{"type":"null","description":"Target frame ID for the agent","uniqueKey":"frameId.oneOf.1","typeLabel":"null"}],"uniqueKey":"frameId","typeLabel":"string | null"},"streamResponse":{"description":"Whether to stream the response via SSE","example":true,"type":"boolean","uniqueKey":"streamResponse","typeLabel":"boolean"},"shouldCache":{"description":"If true, the server captures a cache entry and returns it to the client","type":"boolean","uniqueKey":"shouldCache","typeLabel":"boolean"}},"required":["agentConfig","executeOptions"],"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"agentConfig":{"provider":"openai","model":{"modelName":"openai/gpt-5.4-mini","provider":"vertex","auth":{"type":"googleServiceAccount","credentials":{"private_key":"\u003cstring>","client_email":"\u003cstring>","type":"service_account","project_id":"\u003cstring>","private_key_id":"\u003cstring>","client_id":"\u003cstring>","auth_uri":"\u003cstring>","token_uri":"\u003cstring>","auth_provider_x509_cert_url":"\u003cstring>","client_x509_cert_url":"\u003cstring>","universe_domain":"\u003cstring>"},"scopes":"\u003cstring>","projectId":"\u003cstring>","universeDomain":"\u003cstring>"},"providerOptions":{"vertex":{"project":"my-gcp-project","location":"us-central1","baseURL":"\u003cstring>","headers":{}}},"apiKey":"sk-some-openai-api-key","baseURL":"https://api.openai.com/v1","headers":{}},"systemPrompt":"\u003cstring>","cua":true,"mode":"cua","executionModel":{"modelName":"openai/gpt-5.4-mini","provider":"vertex","auth":{"type":"googleServiceAccount","credentials":{"private_key":"\u003cstring>","client_email":"\u003cstring>","type":"service_account","project_id":"\u003cstring>","private_key_id":"\u003cstring>","client_id":"\u003cstring>","auth_uri":"\u003cstring>","token_uri":"\u003cstring>","auth_provider_x509_cert_url":"\u003cstring>","client_x509_cert_url":"\u003cstring>","universe_domain":"\u003cstring>"},"scopes":"\u003cstring>","projectId":"\u003cstring>","universeDomain":"\u003cstring>"},"providerOptions":{"vertex":{"project":"my-gcp-project","location":"us-central1","baseURL":"\u003cstring>","headers":{}}},"apiKey":"sk-some-openai-api-key","baseURL":"https://api.openai.com/v1","headers":{}}},"executeOptions":{"instruction":"Log in with username 'demo' and password 'test123', then navigate to settings","maxSteps":20,"highlightCursor":true,"useSearch":true,"toolTimeout":30000,"variables":{}},"frameId":"\u003cstring>","streamResponse":true,"shouldCache":true}}},"exampleType":"generated"}},"required":true,"exampleType":"generated"},"responses":{"5c366d3c-1092-429b-92cd-3e5e8e764591":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"description":"Indicates whether the request was successful","type":"boolean","isRequired":true,"uniqueKey":"success","typeLabel":"boolean"},"data":{"type":"object","properties":{"result":{"type":"object","properties":{"success":{"description":"Whether the agent completed successfully","example":true,"type":"boolean","isRequired":true,"uniqueKey":"data.result.success","typeLabel":"boolean"},"message":{"description":"Summary of what the agent accomplished","example":"Successfully logged in and navigated to dashboard","type":"string","isRequired":true,"uniqueKey":"data.result.message","typeLabel":"string"},"actions":{"type":"array","items":{"type":"object","properties":{"type":{"description":"Type of action taken","example":"click","type":"string","isRequired":true,"uniqueKey":"data.result.actions.items.[INDEX].type","typeLabel":"string"},"reasoning":{"description":"Agent's reasoning for taking this action","type":"string","uniqueKey":"data.result.actions.items.[INDEX].reasoning","typeLabel":"string"},"taskCompleted":{"type":"boolean","uniqueKey":"data.result.actions.items.[INDEX].taskCompleted","typeLabel":"boolean"},"action":{"type":"string","uniqueKey":"data.result.actions.items.[INDEX].action","typeLabel":"string"},"timeMs":{"description":"Time taken for this action in ms","type":"number","uniqueKey":"data.result.actions.items.[INDEX].timeMs","typeLabel":"number"},"pageText":{"type":"string","uniqueKey":"data.result.actions.items.[INDEX].pageText","typeLabel":"string"},"pageUrl":{"type":"string","uniqueKey":"data.result.actions.items.[INDEX].pageUrl","typeLabel":"string"},"instruction":{"type":"string","uniqueKey":"data.result.actions.items.[INDEX].instruction","typeLabel":"string"}},"required":["type"],"additionalProperties":{"oneOf":[{}],"uniqueKey":"data.result.actions.items.[INDEX].additionalProperties","typeLabel":"any"},"uniqueKey":"data.result.actions.items.[INDEX]","typeLabel":"object"},"isRequired":true,"uniqueKey":"data.result.actions","typeLabel":"object[]"},"completed":{"description":"Whether the agent finished its task","example":true,"type":"boolean","isRequired":true,"uniqueKey":"data.result.completed","typeLabel":"boolean"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"oneOf":[{}],"uniqueKey":"data.result.metadata.additionalProperties","typeLabel":"any"},"uniqueKey":"data.result.metadata","typeLabel":"object"},"usage":{"type":"object","properties":{"input_tokens":{"example":1500,"type":"number","isRequired":true,"uniqueKey":"data.result.usage.input_tokens","typeLabel":"number"},"output_tokens":{"example":250,"type":"number","isRequired":true,"uniqueKey":"data.result.usage.output_tokens","typeLabel":"number"},"inference_time_ms":{"example":2500,"type":"number","isRequired":true,"uniqueKey":"data.result.usage.inference_time_ms","typeLabel":"number"},"reasoning_tokens":{"type":"number","uniqueKey":"data.result.usage.reasoning_tokens","typeLabel":"number"},"cached_input_tokens":{"type":"number","uniqueKey":"data.result.usage.cached_input_tokens","typeLabel":"number"}},"required":["input_tokens","output_tokens","inference_time_ms"],"additionalProperties":false,"uniqueKey":"data.result.usage","typeLabel":"object"}},"required":["success","message","actions","completed"],"additionalProperties":false,"isRequired":true,"uniqueKey":"data.result","typeLabel":"object"},"cacheEntry":{"type":"object","properties":{"cacheKey":{"description":"Opaque cache identifier computed from instruction, URL, options, and config","type":"string","isRequired":true,"uniqueKey":"data.cacheEntry.cacheKey","typeLabel":"string"},"entry":{"description":"Serialized cache entry that can be written to disk","isRequired":true,"uniqueKey":"data.cacheEntry.entry","typeLabel":"any"}},"required":["cacheKey","entry"],"additionalProperties":false,"uniqueKey":"data.cacheEntry","typeLabel":"object"}},"required":["result"],"additionalProperties":false,"isRequired":true,"uniqueKey":"data","typeLabel":"object"}},"required":["success","data"],"additionalProperties":false,"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"success":true,"data":{"result":{"success":true,"message":"Successfully logged in and navigated to dashboard","actions":[{"type":"click","reasoning":"\u003cstring>","taskCompleted":true,"action":"\u003cstring>","timeMs":123,"pageText":"\u003cstring>","pageUrl":"\u003cstring>","instruction":"\u003cstring>"}],"completed":true,"metadata":{},"usage":{"input_tokens":1500,"output_tokens":250,"inference_time_ms":2500,"reasoning_tokens":123,"cached_input_tokens":123}},"cacheEntry":{"cacheKey":"\u003cstring>","entry":"\u003cunknown>"}}}}},"exampleType":"generated"}},"exampleType":"generated"}},"security":{"cc60a412-157a-4b6a-850a-a896e4b21ff4":{"BrowserbaseApiKey":{"type":"apiKey","in":"header","name":"x-bb-api-key","description":"Browserbase API key for authentication","scopes":[]},"BrowserbaseProjectId":{"type":"apiKey","in":"header","name":"x-bb-project-id","description":"Deprecated. Browserbase API keys are now project-scoped, so this header is no longer required.","scopes":[]}}},"servers":{"40da429c-9334-4c5a-9981-d59bc38e1245":{"url":"https://api.stagehand.browserbase.com"}},"processedSecurityOptions":[{"schemes":[{"scheme":{"type":"apiKey","in":"header","name":"x-bb-api-key","description":"Browserbase API key for authentication","scopes":[]},"schema":{"title":"x-bb-api-key","type":"string","description":"Browserbase API key for authentication","isRequired":true,"typeLabel":"string","deprecated":false},"schemeName":"BrowserbaseApiKey","name":"x-bb-api-key"},{"scheme":{"type":"apiKey","in":"header","name":"x-bb-project-id","description":"Deprecated. Browserbase API keys are now project-scoped, so this header is no longer required.","scopes":[]},"schema":{"title":"x-bb-project-id","type":"string","description":"Deprecated. Browserbase API keys are now project-scoped, so this header is no longer required.","isRequired":true,"typeLabel":"string","deprecated":false},"schemeName":"BrowserbaseProjectId","name":"x-bb-project-id"}],"title":"BrowserbaseApiKey \u0026 BrowserbaseProjectId"}]},"originalFileLocation":"v3/openapi.json"},"subdomain":"stagehand","siteName":"Stagehand","title":"Execute an AI agent - Stagehand","navMaps":{"firstHrefInVersion":{"v4":{"href":"/v4/first-steps/introduction","matchLevel":3},"v3":{"href":"/v3/api-reference/python/execute-an-ai-agent","matchLevel":0}},"firstHrefInLanguage":{}},"lastModified":"2026-07-27T14:24:06.449Z","originalFileLocation":"v3/api-reference/python/execute-an-ai-agent.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Runs an autonomous AI agent that can perform complex multi-step browser tasks.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Stagehand\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/stagehand/AOyqXB1zvpc48cEh/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/stagehand/AOyqXB1zvpc48cEh/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/stagehand/AOyqXB1zvpc48cEh/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/stagehand/AOyqXB1zvpc48cEh/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/stagehand/AOyqXB1zvpc48cEh/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/stagehand/AOyqXB1zvpc48cEh/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/stagehand/AOyqXB1zvpc48cEh/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/stagehand/AOyqXB1zvpc48cEh/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/stagehand/AOyqXB1zvpc48cEh/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Execute an AI agent - Stagehand\">\u003cmeta data-mint-head property=\"og:description\" content=\"Runs an autonomous AI agent that can perform complex multi-step browser tasks.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Stagehand Docs\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.stagehand.dev/v3/api-reference/python/execute-an-ai-agent\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://stagehand.mintlify.app/_mintlify/api/og/v2?division=API+Reference\u0026amp;title=Execute+an+AI+agent\u0026amp;description=Runs+an+autonomous+AI+agent+that+can+perform+complex+multi-step+browser+tasks.\u0026amp;theme=4b62b60986504105fdf72d9e\u0026amp;signature=90956c5dcce93fb67dcdad0e87cdab6c35ca2070d29af71eb9ac5b0065e0ac77\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Execute an AI agent - Stagehand\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Runs an autonomous AI agent that can perform complex multi-step browser tasks.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://stagehand.mintlify.app/_mintlify/api/og/v2?division=API+Reference\u0026amp;title=Execute+an+AI+agent\u0026amp;description=Runs+an+autonomous+AI+agent+that+can+perform+complex+multi-step+browser+tasks.\u0026amp;theme=4b62b60986504105fdf72d9e\u0026amp;signature=90956c5dcce93fb67dcdad0e87cdab6c35ca2070d29af71eb9ac5b0065e0ac77\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/stagehand/AOyqXB1zvpc48cEh/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Stagehand\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#00C851\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.stagehand.dev/v3/api-reference/python/execute-an-ai-agent\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/v3/api-reference/python/execute-an-ai-agent.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.stagehand.dev/#organization\",\"name\":\"Stagehand\",\"url\":\"https://docs.stagehand.dev\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/stagehand/iZoJpVulsYk9lDMY/logo/light_logo.png?fit=max\u0026auto=format\u0026n=iZoJpVulsYk9lDMY\u0026q=85\u0026s=1562b274b6ffc39253bc8091cf8291d9\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.stagehand.dev#website\",\"name\":\"Stagehand\",\"url\":\"https://docs.stagehand.dev\",\"publisher\":{\"@id\":\"https://docs.stagehand.dev/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.stagehand.dev/v3/api-reference/python/execute-an-ai-agent#webpage\",\"url\":\"https://docs.stagehand.dev/v3/api-reference/python/execute-an-ai-agent\",\"name\":\"Execute an AI agent\",\"description\":\"Runs an autonomous AI agent that can perform complex multi-step browser tasks.\",\"dateModified\":\"2026-07-27T14:24:06.449Z\",\"isPartOf\":{\"@id\":\"https://docs.stagehand.dev#website\"},\"breadcrumb\":{\"@id\":\"https://docs.stagehand.dev/v3/api-reference/python/execute-an-ai-agent#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.stagehand.dev/v3/api-reference/python/execute-an-ai-agent#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"API Reference\",\"item\":\"https://docs.stagehand.dev/v3/api-reference/python/start-a-new-browser-session\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Execute an AI agent\",\"item\":\"https://docs.stagehand.dev/v3/api-reference/python/execute-an-ai-agent\"}]},{\"@type\":[\"TechArticle\",\"APIReference\"],\"@id\":\"https://docs.stagehand.dev/v3/api-reference/python/execute-an-ai-agent#apireference\",\"headline\":\"Execute an AI agent\",\"name\":\"Execute an AI agent\",\"description\":\"Runs an autonomous AI agent that can perform complex multi-step browser tasks.\",\"url\":\"https://docs.stagehand.dev/v3/api-reference/python/execute-an-ai-agent\",\"mainEntityOfPage\":{\"@id\":\"https://docs.stagehand.dev/v3/api-reference/python/execute-an-ai-agent#webpage\"},\"dateModified\":\"2026-07-27T14:24:06.449Z\",\"publisher\":{\"@id\":\"https://docs.stagehand.dev/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.stagehand.dev#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Stagehand\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"Stagehand","nav":{"global":{"anchors":[{"anchor":"Discord","icon":"discord","href":"https://discord.gg/stagehand"},{"anchor":"GitHub","icon":"github","href":"https://github.com/browserbase/stagehand"},{"anchor":"Changelog","icon":"scroll","href":"https://github.com/browserbase/stagehand/releases"}]},"versions":[{"version":"v4","pages":[{"title":"v4","href":"/v4/first-steps/introduction"}]},{"version":"v3","dropdowns":[{"dropdown":"TypeScript","icon":"code","groups":[{"group":"First Steps","pages":[{"title":"Introducing Stagehand","sidebarTitle":"Introduction","href":"/v3/first-steps/introduction"},{"title":"Quickstart","href":"/v3/first-steps/quickstart"},{"title":"Installation","href":"/v3/first-steps/installation"},{"title":"AI Rules","href":"/v3/first-steps/ai-rules"}]},{"group":"The Basics","pages":[{"title":"Agent","href":"/v3/basics/agent"},{"title":"Act","href":"/v3/basics/act"},{"title":"Extract","href":"/v3/basics/extract"},{"title":"Observe","sidebarTitle":"Observe","href":"/v3/basics/observe"},{"title":"WebMCP","sidebarTitle":"WebMCP","href":"/v3/basics/webmcp"},{"title":"Evaluations \u0026 Metrics","sidebarTitle":"Evals","href":"/v3/basics/evals"}]},{"group":"Configuration","pages":[{"title":"Browser","sidebarTitle":"Browser","href":"/v3/configuration/browser"},{"title":"Observability","sidebarTitle":"Observability","href":"/v3/configuration/observability"},{"title":"Logging","sidebarTitle":"Logging","href":"/v3/configuration/logging"},{"title":"Models","sidebarTitle":"Models","href":"/v3/configuration/models"}]},{"group":"Best Practices","pages":[{"title":"Caching Actions","href":"/v3/best-practices/caching"},{"title":"Cost Optimization","sidebarTitle":"Cost Optimization","href":"/v3/best-practices/cost-optimization"},{"title":"Deterministic Agent Scripts","sidebarTitle":"Deterministic Agent","href":"/v3/best-practices/deterministic-agent"},{"title":"Using Multiple Tabs","href":"/v3/best-practices/using-multiple-tabs"},{"title":"Deploying Stagehand","href":"/v3/best-practices/deployments"},{"title":"History Tracking","sidebarTitle":"History Tracking","href":"/v3/best-practices/history"},{"title":"Computer Use Agents","href":"/v3/best-practices/computer-use"},{"title":"Agent Fallbacks","href":"/v3/best-practices/agent-fallbacks"},{"title":"Prompting Best Practices","href":"/v3/best-practices/prompting-best-practices"},{"title":"MCP Integrations","href":"/v3/best-practices/mcp-integrations"},{"title":"Speed Optimization","sidebarTitle":"Speed Optimization","href":"/v3/best-practices/speed-optimization"}]},{"group":"Integrations","pages":[{"group":"MCP Server","pages":[{"title":"Browserbase MCP Server","sidebarTitle":"Introduction","href":"/v3/integrations/mcp/introduction"},{"title":"Browserbase MCP Server Setup","sidebarTitle":"Setup","href":"/v3/integrations/mcp/setup"},{"title":"Browserbase MCP Server Tools","sidebarTitle":"Tools","href":"/v3/integrations/mcp/tools"},{"title":"Browserbase MCP Server Configuration","sidebarTitle":"Configuration","href":"/v3/integrations/mcp/configuration"}]},{"group":"CrewAI","pages":[{"title":"CrewAI Introduction","sidebarTitle":"Introduction","href":"/v3/integrations/crew-ai/introduction"},{"title":"Use CrewAI to Automate Browser Tasks","sidebarTitle":"Configuration","href":"/v3/integrations/crew-ai/configuration"}]},{"group":"Langchain","pages":[{"title":"Langchain JS Introduction","sidebarTitle":"Introduction","href":"/v3/integrations/langchain/introduction"},{"title":"LangChain JS Configuration","sidebarTitle":"Configuration","href":"/v3/integrations/langchain/configuration"}]},{"group":"Next.js + Vercel","pages":[{"title":"Next.js + Vercel","sidebarTitle":"Introduction","href":"/v3/integrations/vercel/introduction"},{"title":"Use Stagehand in Next.js","sidebarTitle":"Configuration","href":"/v3/integrations/vercel/configuration"}]},{"group":"Convex","pages":[{"title":"Convex","sidebarTitle":"Introduction","href":"/v3/integrations/convex/introduction"},{"title":"Use Stagehand in Convex","sidebarTitle":"Configuration","href":"/v3/integrations/convex/configuration"}]},{"title":"Playwright","href":"/v3/integrations/playwright"},{"title":"Puppeteer","href":"/v3/integrations/puppeteer"},{"title":"Selenium","href":"/v3/integrations/selenium"}]},{"group":"Reference","pages":[{"title":"Stagehand","icon":"hand-horns","href":"/v3/references/stagehand"},{"title":"agent()","icon":"robot","href":"/v3/references/agent"},{"title":"act()","icon":"arrow-pointer","href":"/v3/references/act"},{"title":"extract()","icon":"ufo-beam","href":"/v3/references/extract"},{"title":"observe()","icon":"magnifying-glass","href":"/v3/references/observe"},{"title":"context","icon":"window","href":"/v3/references/context"},{"title":"clipboard","icon":"clipboard","href":"/v3/references/clipboard"},{"title":"page","icon":"page","href":"/v3/references/page"},{"title":"locator","icon":"crosshairs","href":"/v3/references/locator"},{"title":"deepLocator","icon":"layer-group","href":"/v3/references/deeplocator"},{"title":"Response","icon":"reply","href":"/v3/references/response"}]},{"group":"Migration Guides","pages":[{"title":"Migrate TypeScript v2 to v3","sidebarTitle":"Migrate TypeScript v2 to v3","icon":"arrow-up-right-dots","href":"/v3/migrations/v2"},{"title":"Migrate Python v2 to v3","sidebarTitle":"Migrate Python v2 to v3","icon":"snake","href":"/v3/migrations/python"}]}]},{"dropdown":"Python","icon":"code","groups":[{"group":"SDK Reference","pages":[{"title":"Python SDK","href":"/v3/sdk/python"}]},{"group":"API Reference","pages":[{"title":"Start a new browser session","deprecated":null,"version":null,"openapi":"/v3/openapi.json post /v1/sessions/start","href":"/v3/api-reference/python/start-a-new-browser-session"},{"title":"Navigate to a URL","deprecated":null,"version":null,"openapi":"/v3/openapi.json post /v1/sessions/{id}/navigate","href":"/v3/api-reference/python/navigate-to-a-url"},{"title":"Perform an action","deprecated":null,"version":null,"openapi":"/v3/openapi.json post /v1/sessions/{id}/act","href":"/v3/api-reference/python/perform-an-action"},{"title":"Observe available actions","deprecated":null,"version":null,"openapi":"/v3/openapi.json post /v1/sessions/{id}/observe","href":"/v3/api-reference/python/observe-available-actions"},{"title":"Extract data from the page","description":"Extracts structured data from the current page using AI-powered analysis.","deprecated":null,"version":null,"openapi":"/v3/openapi.json post /v1/sessions/{id}/extract","href":"/v3/api-reference/python/extract-data-from-the-page"},{"title":"Execute an AI agent","deprecated":null,"version":null,"openapi":"/v3/openapi.json post /v1/sessions/{id}/agentExecute","href":"/v3/api-reference/python/execute-an-ai-agent"},{"title":"End a browser session","description":"Terminates the browser session and releases all associated resources.","deprecated":null,"version":null,"openapi":"/v3/openapi.json post /v1/sessions/{id}/end","href":"/v3/api-reference/python/end-a-browser-session"},{"title":"Replay session metrics","deprecated":null,"version":null,"openapi":"/v3/openapi.json get /v1/sessions/{id}/replay","href":"/v3/api-reference/python/replay-session-metrics"}]}]},{"dropdown":"Java","icon":"code","groups":[{"group":"SDK Reference","pages":[{"title":"Java SDK","href":"/v3/sdk/java"}]},{"group":"API Reference","pages":[{"title":"Start a new browser session","deprecated":null,"version":null,"openapi":"/v3/openapi.json post /v1/sessions/start","href":"/v3/api-reference/java/start-a-new-browser-session"},{"title":"Navigate to a URL","deprecated":null,"version":null,"openapi":"/v3/openapi.json post /v1/sessions/{id}/navigate","href":"/v3/api-reference/java/navigate-to-a-url"},{"title":"Perform an action","deprecated":null,"version":null,"openapi":"/v3/openapi.json post /v1/sessions/{id}/act","href":"/v3/api-reference/java/perform-an-action"},{"title":"Observe available actions","deprecated":null,"version":null,"openapi":"/v3/openapi.json post /v1/sessions/{id}/observe","href":"/v3/api-reference/java/observe-available-actions"},{"title":"Extract data from the page","deprecated":null,"version":null,"openapi":"/v3/openapi.json post /v1/sessions/{id}/extract","href":"/v3/api-reference/java/extract-data-from-the-page"},{"title":"Execute an AI agent","deprecated":null,"version":null,"openapi":"/v3/openapi.json post /v1/sessions/{id}/agentExecute","href":"/v3/api-reference/java/execute-an-ai-agent"},{"title":"End a browser session","deprecated":null,"version":null,"openapi":"/v3/openapi.json post /v1/sessions/{id}/end","href":"/v3/api-reference/java/end-a-browser-session"},{"title":"Replay session metrics","deprecated":null,"version":null,"openapi":"/v3/openapi.json get /v1/sessions/{id}/replay","href":"/v3/api-reference/java/replay-session-metrics"}]}]},{"dropdown":"Go","icon":"code","groups":[{"group":"SDK Reference","pages":[{"title":"Go SDK","href":"/v3/sdk/go"}]},{"group":"API Reference","pages":[{"title":"Start a new browser session","deprecated":null,"version":null,"openapi":"/v3/openapi.json post /v1/sessions/start","href":"/v3/api-reference/go/start-a-new-browser-session"},{"title":"Navigate to a URL","deprecated":null,"version":null,"openapi":"/v3/openapi.json post /v1/sessions/{id}/navigate","href":"/v3/api-reference/go/navigate-to-a-url"},{"title":"Perform an action","deprecated":null,"version":null,"openapi":"/v3/openapi.json post /v1/sessions/{id}/act","href":"/v3/api-reference/go/perform-an-action"},{"title":"Observe available actions","deprecated":null,"version":null,"openapi":"/v3/openapi.json post /v1/sessions/{id}/observe","href":"/v3/api-reference/go/observe-available-actions"},{"title":"Extract data from the page","deprecated":null,"version":null,"openapi":"/v3/openapi.json post /v1/sessions/{id}/extract","href":"/v3/api-reference/go/extract-data-from-the-page"},{"title":"Execute an AI agent","deprecated":null,"version":null,"openapi":"/v3/openapi.json post /v1/sessions/{id}/agentExecute","href":"/v3/api-reference/go/execute-an-ai-agent"},{"title":"End a browser session","deprecated":null,"version":null,"openapi":"/v3/openapi.json post /v1/sessions/{id}/end","href":"/v3/api-reference/go/end-a-browser-session"},{"title":"Replay session metrics","deprecated":null,"version":null,"openapi":"/v3/openapi.json get /v1/sessions/{id}/replay","href":"/v3/api-reference/go/replay-session-metrics"}]}]},{"dropdown":"Ruby","icon":"code","groups":[{"group":"SDK Reference","pages":[{"title":"Ruby SDK","href":"/v3/sdk/ruby"}]},{"group":"API Reference","pages":[{"title":"Start a new browser session","deprecated":null,"version":null,"openapi":"/v3/openapi.json post /v1/sessions/start","href":"/v3/api-reference/ruby/start-a-new-browser-session"},{"title":"Navigate to a URL","deprecated":null,"version":null,"openapi":"/v3/openapi.json post /v1/sessions/{id}/navigate","href":"/v3/api-reference/ruby/navigate-to-a-url"},{"title":"Perform an action","deprecated":null,"version":null,"openapi":"/v3/openapi.json post /v1/sessions/{id}/act","href":"/v3/api-reference/ruby/perform-an-action"},{"title":"Observe available actions","deprecated":null,"version":null,"openapi":"/v3/openapi.json post /v1/sessions/{id}/observe","href":"/v3/api-reference/ruby/observe-available-actions"},{"title":"Extract data from the page","deprecated":null,"version":null,"openapi":"/v3/openapi.json post /v1/sessions/{id}/extract","href":"/v3/api-reference/ruby/extract-data-from-the-page"},{"title":"Execute an AI agent","deprecated":null,"version":null,"openapi":"/v3/openapi.json post /v1/sessions/{id}/agentExecute","href":"/v3/api-reference/ruby/execute-an-ai-agent"},{"title":"End a browser session","deprecated":null,"version":null,"openapi":"/v3/openapi.json post /v1/sessions/{id}/end","href":"/v3/api-reference/ruby/end-a-browser-session"},{"title":"Replay session metrics","deprecated":null,"version":null,"openapi":"/v3/openapi.json get /v1/sessions/{id}/replay","href":"/v3/api-reference/ruby/replay-session-metrics"}]}]}]}]},"basePath":"","title":"Execute an AI agent - Stagehand","buildId":"dpl_GZsjphRpnhWkstV12jxWNcMHFyox","deploymentId":"dpl_GZsjphRpnhWkstV12jxWNcMHFyox","dynamics":["c2aa737661","b0f84f53ff","a9bb46feb3","2b790eda92"],"chunks":["OpenApiReferenceProvider-B5zPa4Vr.js","utils-CVjrr8Yd.js","cloneDeep-izs3Hzxb.js","_Uint8Array-BVIqJ90l.js","isObjectLike-C8vmzPEN.js","isArray-Dcu1dQ5t.js","utils-DTgURWzl.js","toString-BX-iyh8G.js","isSymbol-CSH9U2Gm.js","addUniqueKeysToSchema-DxTHtkdZ.js","snippetPresets-Cx47o5Vx.js","style-to-object-BY3JEAdk.js","v4-DIgz8zy6.js","Page-CYZot51e.js","ApiExamples-4Fr6y9N_.js","isEqual-BfaiBbcl.js","usePlaygroundInputsStore-Dq2ElbEk.js","shallow-BfYl9r69.js","getApiPlaygroundDisplay-Ch3xc7i1.js","CodeSnippet-BsBxuJ1v.js","CodeSnippets-CetzeDL8.js","getPastedJson-BxPKFSJx.js","icon-o0J1Ochb.js","MethodPill-Du3usO5m.js","DuplicateIcon-DJypyMzl.js","createIcon-YMA6N8KJ.js","DynamicMarkdown-CWvhfcZc.js","SectionHeading-BdLVaXCd.js","axios-vUo_bRtp.js","Markdown-C4Ez6OeV.js","clsx-DptzKFCt.js","lib-DuNMoZ05.js","lib-B8HbPgcC.js","html-void-elements-mCSPHezU.js","dist-Dt1IougW.js","katex-YMM-FMeD.js","marked.esm-CZWythHk.js","AssistantPageLink-CZ6Wt2Vb.js"]}