# Anchor Browser Docs > ## Agent Instructions > Anchor Browser is cloud browser infrastructure for AI agents and automation: browser sessions you control over CDP or REST, natural-language web tasks, versioned automation tasks, managed authentication into third-party web apps (identities with MFA), persistent volumes and profiles, recordings, live view, batch sessions, webhooks, and network options including residential proxies, extra stealth, and captcha solving for sites that block standard browsers. AI agents should start at https://docs.anchorbrowser.io/for-agents, then create an API key at https://app.anchorbrowser.io/api-keys. Read the for-agents page before authentication or API calls. # Action Index Source: https://docs.anchorbrowser.io/advanced/action-index Cached, proven web actions your agent can reuse to finish tasks faster, cheaper, and more reliably. The action index is a cache of proven web actions on real websites, like searching jobs on Walmart or finding products on Amazon. Anchor has already worked out how to do each one, so the agent doesn't have to rediscover it on every run. When your agent lands on a site with cached actions, it can finish a whole step, such as "search with these filters", in a single call. Without the index, it clicks through the page one element at a time. You can use it in two ways: * **Inside a web task**: set `use_action_index_tools: true` on [Perform Web Task](/agentic-browser-control/ai-task-completion) and the agent picks the right action itself. * **Directly**: look up the actions for a site and run one by name, with no AI agent involved. ## Benefits > [card] Higher success rate > > Cached actions already know how a site's search, filters, and pagination work, so the agent stops getting lost on complex pages. > [card] Fewer tokens > > One action replaces a long loop of screenshots, clicks, and retries, so each task costs less. > [card] Faster results > > Fewer steps per task and fewer failed runs to repeat. > [card] Smaller models, top results > > Open and low-cost models gain the most, so you can switch to a cheaper model without losing accuracy. ## Use the index in a web task Set `use_action_index_tools` to `true`. The agent sees only the actions for the domain it is on, and falls back to normal browsing for everything else. ```javascript node.js theme={null} import { client } from 'anchorbrowser'; client.setConfig({ auth: () => process.env.ANCHOR_API_KEY }); const { data: response } = await client.post({ url: '/v1/tools/perform-web-task', body: { url: 'https://cookpad.com/', prompt: 'Find recipes for chocolate chip cookies without nuts and list the first five titles.', agent: 'browser-use', use_action_index_tools: true, }, }); console.log(response.data.result); // Names of the cached actions the agent ran console.log(response.data.action_index_tools_used); ``` ```python python theme={null} import os from anchorbrowser import Anchorbrowser anchor_client = Anchorbrowser(api_key=os.getenv('ANCHOR_API_KEY')) response = anchor_client.post( '/v1/tools/perform-web-task', body={ 'url': 'https://cookpad.com/', 'prompt': 'Find recipes for chocolate chip cookies without nuts and list the first five titles.', 'agent': 'browser-use', 'use_action_index_tools': True, }, cast_to=object, ) print(response['data']['result']) # Names of the cached actions the agent ran print(response['data'].get('action_index_tools_used')) ``` `action_index_tools_used` appears only when the agent ran at least one action. Add `?includeTokens=true` to the URL to also get token `usage` and compare runs with and without the index. > [!NOTE] > > When you omit `use_action_index_tools`, it defaults to `true` on free plans and `false` on paid plans. An explicit `true` or `false` always wins. It works with every agent except [Jev](/agentic-browser-control/computer-use-agents/jev), which accepts the flag and ignores it. ## Run an action directly Use the index without an agent when you already know what you want to do on a site. **1. Find actions for a domain** `GET /v1/actions-index/search` returns the active actions for a domain, with their input and output schemas. ```javascript node.js theme={null} const { data: actions } = await client.get({ url: '/v1/actions-index/search', query: { domain: 'cookpad.com' }, }); for (const action of actions) { console.log(action.name, '-', action.description); console.log(action.inputSchema); } ``` ```python python theme={null} actions = anchor_client.get('/v1/actions-index/search?domain=cookpad.com', cast_to=object) for action in actions: print(action['name'], '-', action['description']) print(action['inputSchema']) ``` An empty list means the domain has no actions yet. Use Perform Web Task for that site instead. **2. Execute the action** `POST /v1/actions-index/by-name/{name}/execute` runs the cached action in an Anchor browser. Pass `input` that matches the action's `inputSchema`. ```javascript node.js theme={null} const { data: run } = await client.post({ url: '/v1/actions-index/by-name/cookpad-search-recipes/execute', body: { input: { search_query: 'chocolate chip cookies', excluded_keywords: 'nuts', country_code: 'us', max_results: 5, }, }, }); console.log(run.success, run.output); console.log('Session:', run.sessionId); ``` ```python python theme={null} run = anchor_client.post( '/v1/actions-index/by-name/cookpad-search-recipes/execute', body={ 'input': { 'search_query': 'chocolate chip cookies', 'excluded_keywords': 'nuts', 'country_code': 'us', 'max_results': 5, }, }, cast_to=object, ) print(run['success'], run['output']) print('Session:', run['sessionId']) ``` ```json Response theme={null} { "name": "cookpad-search-recipes", "sessionId": "25cc5a42-2024-4214-87fd-5612fb693309", "success": true, "output": { "recipe_titles": "[\"Chewy Chocolate Chip Cookies\", \"Brown Butter Chocolate Chip Cookies\", ...]" } } ``` Without a `sessionId`, Anchor creates a browser at the action's domain and returns its id. The session closes after two idle minutes, so you can chain more actions or a web task on it right away. ### Actions that need a signed-in account Actions with `authRequired: true` must run in a session that is already signed in. Create the session with an [identity](/essentials/managed-authentication) and pass its id: ```javascript node.js theme={null} const { data: run } = await client.post({ url: `/v1/actions-index/by-name/${actionName}/execute`, body: { sessionId, input: { /* fields from inputSchema */ } }, }); ``` ```python python theme={null} run = anchor_client.post( f'/v1/actions-index/by-name/{action_name}/execute', body={'sessionId': session_id, 'input': {}}, # fields from inputSchema cast_to=object, ) ``` ## API reference | Endpoint | What it does | | - | - | | `GET /v1/actions-index/search?domain=` | Active actions for a domain, plus actions that work on any site | | `GET /v1/actions-index/by-name/{name}` | One action by name | | `POST /v1/actions-index/by-name/{name}/execute` | Runs an action. Body: `input`, optional `sessionId` | | `GET /v1/actions-index/` | All actions. Filters: `status`, `domain`, `authRequired` | ## Use it from MCP The [hosted MCP servers](/advanced/mcp) expose the same index as `search_action_index`, `get_action_index`, and `execute_action_index` tools. `/v1/mcp/actions/{domain}` turns every action for a site into its own tool. # Ad Blocker Source: https://docs.anchorbrowser.io/advanced/adblocker Block ads, trackers, and unwanted content in your browser sessions Ad blocking is enabled by default in Anchor Browser. It blocks ads, trackers, and malicious content to improve page load times and create cleaner automation. > [!NOTE] > > Ad blocking is enabled by default. Disable it only if you need to test ad-related functionality. ## Quick Start ```javascript node.js theme={null} import { client, Sessions } from 'anchorbrowser'; (async () => { client.setConfig({ auth: () => process.env.ANCHOR_API_KEY }); const session = await Sessions.createSession({ // Optional: ad blocking is enabled by default, so this configuration is not required body: { browser: { adblock: { active: true // Set to false to disable ad blocking } } } }); console.log("Session:", session.data.id); })().catch(console.error); ``` ```python python theme={null} import os from anchorbrowser import Anchorbrowser anchor_client = Anchorbrowser(api_key=os.getenv("ANCHOR_API_KEY")) session = anchor_client.sessions.create_session( # Optional: ad blocking is enabled by default, so this configuration is not required browser={ "adblock": { "active": True # Set to False to disable ad blocking } } ) print("Session:", session.data.id) ``` ## Disabling Ad Blocker To disable ad blocking for a session, set `active: false` in the adblock configuration: ```javascript node.js theme={null} import { client, Sessions } from 'anchorbrowser'; (async () => { client.setConfig({ auth: () => process.env.ANCHOR_API_KEY }); const session = await Sessions.createSession({ body: { browser: { adblock: { active: false // Disables ad blocking for this session } } } }); console.log("Session:", session.data.id); })().catch(console.error); ``` ```python python theme={null} import os from anchorbrowser import Anchorbrowser anchor_client = Anchorbrowser(api_key=os.getenv("ANCHOR_API_KEY")) session = anchor_client.sessions.create_session( browser={ "adblock": { "active": False # Disables ad blocking for this session } } ) print("Session:", session.data.id) ``` ## Related Features * [Popup Blocker](/advanced/popup-blocker) - Block cookie banners and consent dialogs * [Captcha Solving](/advanced/captcha-solving) - Solve CAPTCHAs that may appear when ad blocking is detected # Anchor VPN Source: https://docs.anchorbrowser.io/advanced/anchor-vpn Integrated VPN egress that is secure, reliable, and fast - beyond what proxy setups can offer. Anchor VPN routes all outbound browser traffic through Anchor's own VPN infrastructure, giving each session a consistent egress path and a stable, dedicated client IP. Unlike commodity proxy setups, it is built to be **secure**, **reliable**, and **fast** - because the path is owned and operated by Anchor end-to-end. | **Anchor VPN** | **Market Standard** | | :- | :- | | ✅ Always get the same IP address | 🔴 Randomized IP addresses | | ✅ High speed, cloud hosted IPs | 🔴 Variable speed, hosted on personal edge devices | | ✅ The IP address only belongs to you | 🔴 IP address is used by unkown amount of users at the same time | | ✅ Used only for enterprise automation | 🔴 Used for scraping, bot operation, malicious activity | | ✅ Built for enterprise AI workloads | 🔴 Built for scraping, retrofitted for AI | > [!NOTE] > > Anchor VPN is a premium feature enabled by the Anchor team upon request. It can be scoped to an entire project or to a specific identity. [Contact the Anchor team](mailto:support@anchorbrowser.io?subject=Anchor%20VPN%20enablement) to get started. ## Why it matters Unstable IPs, low-reputation shared exits, and slow proxy hops are the root cause of most browser automation failures at scale. They lead to session drops, failed auth, elevated risk scores, and sluggish page loads - all of which compound when you're running many sessions. Anchor VPN addresses all three at once. ## Secure Your assigned egress IP is used by you alone. It is not shared with other customers in a multi-tenant pool where unrelated traffic degrades the address's reputation and broadens the blast radius of any incident. There is no third-party proxy operator sitting between the browser and the internet. Traffic stays on Anchor-operated infrastructure under Anchor's security program, so no outside vendor can observe, log, or mishandle your sessions. ## Reliable Which egress IP you use - and whether the same IP is reused across sessions - is driven by your Anchor VPN configuration. Once an assignment is active, all HTTP(S) traffic follows it. There is no routine mid-session rotation for load-spreading; downstream sites see a steady origin for the lifetime of the assignment. Exits are health- and latency-monitored. If a node goes unhealthy, failover is policy-driven and designed to minimize geographic jumps rather than silently dumping you onto a random replacement. ## Fast Traffic leaves the browser through exits provisioned for Anchor sessions - not through oversubscribed shared proxy endpoints that add latency on every request. The stack is tuned for interactive pages and APIs: TLS optimization, connection reuse, and direct peering. Because the IP stays stable, you also avoid the hidden performance tax of proxy churn: fewer captchas, fewer re-auth flows, and less wall-clock time lost to recovery loops that fire every time the origin IP changes. ## How it works Consistent routing is applied at the browser networking layer before requests are dispatched. | Component | Role | | - | - | | **Session router** | Applies your VPN configuration - selecting an exit and, where enabled, reusing an egress IP across sessions | | **Exit node pool** | Regionally grouped endpoints monitored for health and latency | | **Routing policy engine** | Enforces assignment rules, stickiness settings, and failover behavior | Behavior depends on how Anchor VPN is configured for your project or identity. The system is designed to preserve geographic coherence, avoid gratuitous IP rotation, and keep a stable client origin for as long as your configuration dictates. ## Get started Anchor VPN is enabled by the Anchor team upon request. [Contact us](mailto:support@anchorbrowser.io?subject=Anchor%20VPN%20enablement) to enable it for your project or identity. ## Related capabilities > [card] [Proxy](/advanced/proxy) > > Country, region, and city targeting with Anchor's built-in proxy. > [card] [Bring Your Own Proxy](/advanced/bring-your-own-proxy) > > Route sessions through your own HTTP, HTTPS, or SOCKS5 server. > [card] [Dedicated Sticky IP](/advanced/dedicated-sticky-ip) > > A fixed IP reserved per profile across sessions. # Async execution Source: https://docs.anchorbrowser.io/advanced/async-automation-tasks Run automation tasks asynchronously and poll for results. By default, task execution is **synchronous** — the API call waits for the task to complete before returning results. For long-running tasks, you can use **asynchronous execution** to start the task and check results later. ## Running tasks asynchronously When you set `async: true`, the API returns immediately with a confirmation that the task has started. You can then poll for execution results using the task execution history endpoint. ```typescript node.js theme={null} import { TasksLegacy } from 'anchorbrowser'; // Run the task asynchronously const execution = await TasksLegacy.runAdhocTask({ body: { taskId: taskId, version: '1', async: true, // Enable async execution inputs: { ANCHOR_TARGET_URL: 'https://example.com', ANCHOR_MAX_PAGES: '10' } } }); console.log('Task execution started:', execution.data); // Response: { async: true, success: true, message: 'Task execution started', taskId: '...' } ``` ```python python theme={null} # Run the task asynchronously execution = client.tasks_legacy.run_adhoc_task( task_id=task_id, version="1", async_=True, # Enable async execution inputs={ "ANCHOR_TARGET_URL": "https://example.com", "ANCHOR_MAX_PAGES": "10" } ) print(f"Task execution started: {execution.data}") # Response: {'async': True, 'success': True, 'message': 'Task execution started', 'taskId': '...'} ``` ## Checking execution results After starting an async task, you can check its execution status and results by querying the task's execution history endpoint: ```typescript node.js theme={null} import { TasksLegacy } from 'anchorbrowser'; // Get execution results const results = await TasksLegacy.listTaskExecutions({ path: { taskId }, query: { page: 1, limit: 1, version: 1 } }); console.log('Execution results:', results.data); ``` ```python python theme={null} # Get execution results results = client.tasks_legacy.list_task_executions( task_id, # status="success", # Optional: filter by status (success, failure, timeout, cancelled) page="1", limit="1", version="1", # Optional: filter by version ) print(f"Execution results: {results.data}") ``` **Example response:** ```json theme={null} { "data": { "results": [ { "id": "550e8400-e29b-41d4-a716-446655440000", "status": "success", "executionTime": 5234, "output": "{\"success\": true, \"message\": \"Task completed successfully\"}", "errorMessage": null, "startTime": "2024-01-15T10:30:00Z" } ], "pagination": { "page": 1, "limit": 1, "total": 1, "totalPages": 1 } } } ``` > [!WARNING] > > Async task executions have a maximum duration of **3 hours**. Tasks that exceed this limit will be automatically cancelled. > > **Note:** Tasks must be deployed (not just in draft) to appear in the execution results list. ## Polling for results For async tasks, you can implement polling to wait for completion: ```typescript node.js theme={null} import { TasksLegacy } from 'anchorbrowser'; // Poll for task completion async function waitForTaskCompletion(taskId: string, maxAttempts: number = 60) { for (let i = 0; i < maxAttempts; i++) { const results = await TasksLegacy.listTaskExecutions({ path: { taskId }, query: { page: 1, limit: 1 } }); const latestResult = results.data?.results?.[0]; if (latestResult) { if (latestResult.status === 'success' || latestResult.status === 'failure') { return latestResult; } } // Wait 2 seconds before next poll await new Promise(resolve => setTimeout(resolve, 2000)); } throw new Error('Task execution timeout'); } // Usage const execution = await TasksLegacy.runAdhocTask({ body: { taskId: taskId, version: '1', async: true, inputs: { ANCHOR_TARGET_URL: 'https://example.com' } } }); const result = await waitForTaskCompletion(taskId); console.log('Task completed:', result); ``` ```python python theme={null} import time # Poll for task completion def wait_for_task_completion(task_id: str, max_attempts: int = 60): for _ in range(max_attempts): results = client.tasks_legacy.list_task_executions(task_id, page="1", limit="1") latest_result = results.data.results[0] if results.data and results.data.results else None if latest_result: if latest_result.status in ("success", "failure"): return latest_result # Wait 2 seconds before next poll time.sleep(2) raise Exception('Task execution timeout') # Usage execution = client.tasks_legacy.run_adhoc_task( task_id=task_id, version="1", async_=True, inputs={"ANCHOR_TARGET_URL": "https://example.com"} ) result = wait_for_task_completion(task_id) print(f"Task completed: {result}") ``` # Batch Browser Sessions Source: https://docs.anchorbrowser.io/advanced/batch-browser-sessions Create and manage multiple browser sessions simultaneously for large-scale automation tasks > [!NOTE] > > For a single session use [Create a Session](/quickstart/create-session). See [Browser Sessions](/quickstart/browser-sessions#how-to-create) for when to choose batch vs sync or async. Create up to 5,000 browser sessions in a single API call for large-scale automation, web scraping, and load testing. ## Quick Start ### 1. Create a Batch ```javascript theme={null} const response = await fetch('https://api.anchorbrowser.io/v1/batch-sessions', { method: 'POST', headers: { 'anchor-api-key': process.env.ANCHOR_API_KEY, 'Content-Type': 'application/json' }, body: JSON.stringify({ count: 10, configuration: { browser: { headless: { active: true }, viewport: { width: 1440, height: 900 } }, session: { timeout: { idle_timeout: 10, max_duration: 300 } } }, metadata: { project: 'web-scraping' } }) }); const batch = await response.json(); const batchId = batch.data.batch_id; console.log('Batch ID:', batchId); ``` ### 2. Monitor Progress ```javascript theme={null} const response = await fetch(`https://api.anchorbrowser.io/v1/batch-sessions/${batchId}`, { headers: { 'anchor-api-key': process.env.ANCHOR_API_KEY } }); const status = await response.json(); console.log(`Progress: ${status.data.progress.percentage}%`); console.log(`Completed: ${status.data.completed_requests}/${status.data.total_requests}`); ``` ### 3. Use Sessions ```javascript theme={null} import { chromium } from 'playwright'; const sessions = status.data.sessions.filter(s => s.status === 'completed'); for (const session of sessions) { const browser = await chromium.connectOverCDP(session.cdp_url); const page = await browser.contexts()[0].newPage(); await page.goto('https://example.com'); // ... your automation logic await browser.close(); } ``` ## Polling Strategy ```javascript theme={null} async function waitForBatchCompletion(batchId, maxWaitMinutes = 10) { const maxWaitMs = maxWaitMinutes * 60 * 1000; let checkInterval = 5000; const startTime = Date.now(); while (Date.now() - startTime < maxWaitMs) { const response = await fetch(`https://api.anchorbrowser.io/v1/batch-sessions/${batchId}`, { headers: { 'anchor-api-key': process.env.ANCHOR_API_KEY } }); const data = await response.json(); if (data.data.status === 'completed') return data.data.sessions; if (data.data.status === 'failed') throw new Error(`Batch failed: ${data.data.error}`); await new Promise(resolve => setTimeout(resolve, checkInterval)); checkInterval = Math.min(checkInterval * 1.5, 30000); } throw new Error(`Batch did not complete within ${maxWaitMinutes} minutes`); } ``` ## Parameters **count** `number` *required* Number of browser sessions to create (1-1000) **configuration** `object` Session configuration that applies to all sessions in the batch **metadata** `object` Optional key-value pairs for batch identification ## Status States **Batch States**: `pending` → `processing` → `completed` / `failed` **Session States**: `pending` → `processing` → `completed` / `failed` ## Available Endpoints * `POST /v1/batch-sessions` - Create batch sessions * `GET /v1/batch-sessions/{batch_id}` - Get batch status > [!NOTE] > > Additional endpoints for listing, canceling, and retrying batches are planned for future releases. ## Limits * **Maximum batch size**: 1,000 sessions * **Session lifetime**: Up to 24 hours * Large batches may take several minutes to provision # Bring Your Own Keys (BYOK) Source: https://docs.anchorbrowser.io/advanced/bring-your-own-key Use your own LLM provider keys to power AI-driven browser automations Bring Your Own Keys (BYOK) lets you connect your own LLM provider - OpenAI, Anthropic, Google, Azure, or any OpenAI-compatible endpoint - to power Anchor's AI browser automations. You store your provider keys on a project, then **opt in per request** by referencing a key. When you don't reference a key, Anchor uses its default model as usual. **Why use BYOK?** * **Model choice** - pick the provider that works best for each task * **Data privacy** - LLM requests go directly to your provider, not through Anchor's inference layer * **Rate limits** - manage your own provider rate limits ## How it works * You can store **one or more keys per project**. Each key has a **key name** (a short slug you choose, e.g. `my-anthropic-key`) so you can keep several keys - even for the same provider - side by side. * BYOK is **opt-in per request**. A session or web task uses one of your keys only when it explicitly passes that key's name. Otherwise it uses Anchor's default model. * Your key isn't tied to a single model. The model is chosen **per request** (you can pass a model name), and if you don't pass one, the provider's default for that agent is used. * Your keys are **encrypted at rest** and never returned by the API - only a reference to them is stored. > [!NOTE] > > BYOK currently supports **`perform-web-task`** and **sessions** - not Tasks. If you need BYOK for Tasks, [contact support](mailto:support@anchorbrowser.io). ## Supported providers | Provider | API value | Example models | | - | - | - | | OpenAI | `openai` | gpt-4o, gpt-5.4, o3 | | Anthropic | `anthropic` | claude-sonnet-4-6, claude-opus-4-7 | | Google (AI Studio) | `google` | gemini-2.5-pro, gemini-2.5-flash | | Google Vertex AI | `vertex` | gemini-2.5-pro, gemini-2.5-flash | | Azure OpenAI | `azure` | Any deployed Azure OpenAI model | | Custom / OpenAI-compatible | `custom` | Any endpoint that follows the OpenAI chat completions API | Azure and custom endpoints require a **base URL**. Vertex AI uses a **service-account JSON** (not an API key) and an optional **region**. ## Setup (Dashboard) **1. Open BYOK in Project Settings** In the Dashboard, go to **Project Settings** and scroll to the **BYOK** section (below Members). **2. Add a key** 1. Click **Add Key** 2. Select your provider 3. Give the key a **key name** (e.g. `my-anthropic-key`) - this is how you'll reference it later 4. Paste your API key (or service-account JSON for Vertex) 5. For Azure or custom endpoints, enter the **base URL**; for Vertex, optionally set a **region** 6. Click **Verify & Save** - Anchor makes a quick live test call to confirm the credential works before storing it **3. Add more keys (optional)** Repeat for any other providers or keys you want available in this project. They'll appear in a table, sorted by provider. ## Using BYOK Reference a key by its **key name** (`key_slug`) on the request. This works in two places: ### On a session Pass `key_slug` when creating a session. Every action in that session then uses your key: ```json theme={null} POST /v1/sessions { "key_slug": "my-anthropic-key" } ``` Optional fields: * `provider` - a safety check; if set, it must match the stored provider for that key (guards against typos). * `model` - a specific model name to use; omit it to use the provider's default. ```json theme={null} POST /v1/sessions { "key_slug": "my-anthropic-key", "provider": "anthropic", "model": "claude-sonnet-4-6" } ``` ### On a web task Pass `key_slug` to `perform-web-task`. If you don't pass a `sessionId`, Anchor creates a session on the fly using your key. If you pass an existing `sessionId`, the key applies **just to that task** - it doesn't change the session's saved model. ```json theme={null} POST /v1/tools/perform-web-task { "prompt": "Find the price of the product on this page", "key_slug": "my-openai-key" } ``` > **No key\_slug = Anchor default.** Leave `key_slug` out and the request uses Anchor's default model. ## Registering keys via the REST API You can also manage keys without the Dashboard. **When creating a project** - include a `model` object: ```json theme={null} POST /v1/projects { "name": "My project", "model": { "provider": "openai", "key_slug": "my-openai-key", "credentials": "sk-...", "base_url": null } } ``` **Adding or updating a key on an existing project:** ```json theme={null} PUT /v1/projects/{projectId}/byom { "model": { "provider": "anthropic", "key_slug": "my-anthropic-key", "credentials": "sk-ant-..." } } ``` In both cases Anchor verifies the credential with a live test call before saving. `base_url` is required for `azure` and `custom`; for `vertex`, put the service-account JSON in `credentials` and optionally add `location`. ## FAQs > [accordion] Do I have to use my key on every request? > > No. BYOK is opt-in: a request uses your key only when it includes `key_slug`. Anything without it uses Anchor's default model. > [accordion] Does BYOK work with Tasks? > > Not currently. BYOK applies to sessions and `perform-web-task` only. If you need BYOK for Tasks, [contact support](mailto:support@anchorbrowser.io). > [accordion] Can I keep several keys in one project? > > Yes. Each key has its own key name, and you can store several — even for the same provider. You pick which one to use per request. > [accordion] Which model does my key use? > > The one you pass as `model` on the request. If you don't pass a model, the provider's default for that agent is used. Make sure your key has access to whichever model ends up being used — for example, computer-use agents need a computer-use-capable model. > [accordion] Does BYOK affect pricing? > > With BYOK, LLM requests go directly to your provider, so you pay your provider for token usage. Anchor's standard browser usage charges still apply. > [accordion] Is my API key stored securely? > > Yes. Keys are encrypted at rest and never returned by the API — only a reference is stored. You re-enter the key whenever you change a configuration. # Bring Your Own Proxy Source: https://docs.anchorbrowser.io/advanced/bring-your-own-proxy Use your own HTTP, HTTPS, or SOCKS5 proxy servers with Anchor Browser sessions. Anchor Browser lets you use your own proxy servers, giving you complete control over your proxy infrastructure. This is particularly useful when you have existing proxy solutions or need to comply with specific network policies. ## Configuration To use your own proxy, set `type` to `"custom"` and provide: * **`active`**: Set to `true` to enable the proxy * **`type`**: Set to `"custom"` to indicate you're using your own proxy * **`server`**: The full proxy URL in the format `protocol://hostname:port` * **`username`**: Your proxy authentication username (if required) * **`password`**: Your proxy authentication password (if required) ## Supported protocols Anchor Browser supports the following proxy protocols: * **HTTP Proxy**: Standard HTTP proxy with optional authentication (e.g., `http://proxy.example.com:8080`) * **HTTPS Proxy**: Secure HTTPS proxy connections (e.g., `https://proxy.example.com:443`) * **SOCKS5 Proxy**: SOCKS5 proxy for enhanced privacy and flexibility (e.g., `socks5://proxy.example.com:1080`) ## Examples ```javascript node.js theme={null} import { client, Sessions } from 'anchorbrowser'; client.setConfig({ auth: () => process.env.ANCHOR_API_KEY }); const response = await Sessions.createSession({ body: { session: { proxy: { active: true, type: 'custom', server: 'https://proxy.example.com:443', // Supported protocols: http, https, socks5 username: 'myUser', password: 'myPassword', } } } }); console.log('Session created:', response.data); ``` ```python python theme={null} import os import json from anchorbrowser import Anchorbrowser anchor_client = Anchorbrowser(api_key=os.getenv('ANCHOR_API_KEY')) response = anchor_client.sessions.create_session( session={ 'proxy': { 'active': True, 'type': 'custom', 'server': 'https://proxy.example.com:443', # Supported protocols: http, https, socks5 'username': 'myUser', 'password': 'myPassword', } } ) print('Session created:') print(response.data) ``` For Anchor's built-in proxy with country, region, and city targeting, see [Proxy](/advanced/proxy). # Embedded Browser Live UI Source: https://docs.anchorbrowser.io/advanced/browser-live-view Embed interactive browser sessions directly into your application ## Overview Anchor Browser offers a live view feature that allows you to embed an interactive frame of a website as a web element. The `live_view_url` is received when creating a session. ## Headful Mode (Default) Headful mode provides a single URL to view the full chrome view, including the address bar. This ensures the presented tab is always the active tab and provides the best user experience. ![Browser Live View in Headful Mode](https://mintcdn.com/anchor-b3ec2715/hJc2I0-WvjLCCXOl/images/vnc-live-view.png?fit=max\&auto=format\&n=hJc2I0-WvjLCCXOl\&q=85\&s=774f0fea0d9359730307c6a21e50ae9c) To create a browser in headful mode, [create a session](/quickstart/create-session) with `browser.headless.active` set to `false` (the default): ```javascript node.js theme={null} import { client, Sessions } from 'anchorbrowser'; // Initialize the client client.setConfig({ auth: () => process.env.ANCHOR_API_KEY }); // For explicit headfull session configuration (optional, default to false) const config = { browser: { headless: { active: false } } }; const session = await Sessions.createSession({ body: config }); const liveViewUrl = session.data.live_view_url; console.log(`Live view URL: ${liveViewUrl}`); ``` ```python python theme={null} from anchorbrowser import Anchorbrowser import os # Initialize the client client = Anchorbrowser(api_key=os.getenv("ANCHOR_API_KEY")) # For explicit headfull session configuration (optional, default to False) config = { "headless": { "active": False } } session = client.sessions.create_session(browser=config) print(f"Live view URL: {session.data.live_view_url}") ``` Then, use the `live_view_url` from the response to embed the live view directly into an iframe: ```html theme={null} ``` ## Advanced Embedding Configuration ### Embed in Fullscreen View (Hide Navigation Bar) To use the fullscreen view, replace the live view URL with the following: ```html theme={null} ``` ### Disable Browser Interactivity To prevent the end user from interacting with the browser, add the `style="pointer-events: none;"` attribute to the iframe: ```html theme={null} ``` > [!NOTE] > > This feature is available for both headful and headless modes. ### Single-Use Live View URL To generate a live view URL that can only be used once, set `one_time_url` to `true`. After the first viewer connects and disconnects, the URL becomes permanently invalid. ```javascript node.js theme={null} import { client, Sessions } from 'anchorbrowser'; client.setConfig({ auth: () => process.env.ANCHOR_API_KEY }); const session = await Sessions.createSession({ body: { session: { live_view: { one_time_url: true } } } }); const liveViewUrl = session.data.live_view_url; console.log(`Single-use live view URL: ${liveViewUrl}`); ``` ```python python theme={null} from anchorbrowser import Anchorbrowser import os client = Anchorbrowser(api_key=os.getenv("ANCHOR_API_KEY")) session = client.sessions.create_session( session={ "live_view": { "one_time_url": True } } ) print(f"Single-use live view URL: {session.data.live_view_url}") ``` > [!WARNING] > > `one_time_url` requires a headful browser. It cannot be used with headless mode. ### Scoped Access Tokens To hand a session to an end user without sharing its session id, set `session.scoped_access.active` to `true`. The create response then carries three URLs, each with its own `token` and no session id: | Field | The token holder can | | - | - | | `live_view_read_only_url` | Watch the browser. Mouse, keyboard and clipboard input is ignored. | | `live_view_url` | Watch and interact with the browser. | | `cdp_url` | Control the browser over CDP. | A read-only viewer and an interactive viewer can watch the same session at the same time. A live view token only opens the live view: it cannot connect over CDP or call the browser's APIs. On a scoped session the session id is no longer a credential on its own: connecting to CDP or the live view with only `?sessionId=` is refused. Connect with a token (`?token=`), or with the session id and a token (`?sessionId=...&token=...`). Any other session switches to tokens the same way as soon as you mint a token for it (see below); sessions that never use tokens keep working with the session id alone. If the session also sets `live_view.read_only`, no live view can interact: `live_view_url` is the same read-only URL as `live_view_read_only_url`, and `cdp_url` keeps full control. ```javascript node.js theme={null} import { client, Sessions } from 'anchorbrowser'; client.setConfig({ auth: () => process.env.ANCHOR_API_KEY }); const session = await Sessions.createSession({ body: { session: { scoped_access: { active: true } } } }); console.log(`Read-only live view: ${session.data.live_view_read_only_url}`); console.log(`Interactive live view: ${session.data.live_view_url}`); console.log(`CDP: ${session.data.cdp_url}`); ``` ```python python theme={null} from anchorbrowser import Anchorbrowser import os client = Anchorbrowser(api_key=os.getenv("ANCHOR_API_KEY")) session = client.sessions.create_session( session={ "scoped_access": { "active": True } } ) print(f"Read-only live view: {session.data.live_view_read_only_url}") ``` To mint more token URLs for any running headful session, for example one per end user, call `POST /v1/sessions/{session_id}/tokens`. Pass `scopes` to choose which URLs to mint, or omit it for every URL the session can serve (no `live_view_url` on a `one_time_url` session). Every call returns new tokens: ```bash theme={null} curl -X POST "https://api.anchorbrowser.io/v1/sessions/$SESSION_ID/tokens" \ -H "anchor-api-key: $ANCHOR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"scopes": ["live_view_read_only"]}' ``` To revoke one, pass the `token` from its URL. The URL stops opening new connections; a connection that is already open stays until it closes: ```bash theme={null} curl -X DELETE "https://api.anchorbrowser.io/v1/sessions/$SESSION_ID/tokens/$TOKEN" \ -H "anchor-api-key: $ANCHOR_API_KEY" ``` > [!WARNING] > > Tokens stop working when the session ends. `scoped_access` requires a headful cloud browser, cannot be combined with `one_time_url`, and is not accepted by batch or async session creation: for those, mint tokens with `POST /v1/sessions/{session_id}/tokens` once the session is running. > > Minting a token on a session without `scoped_access` makes it token-only from then on: connections that are already open stay up, but new connections with only `?sessionId=` are refused, so include `cdp` in `scopes` if your own code still connects. Revoking the tokens does not restore session id access. ## Remote OS cursor By default, live view draws a cursor at **your** mouse. To paint the remote OS pointer into the stream instead (needed to watch OS-level mouse APIs), append `show_cursor=1` to `live_view_url`: ``` https://live.anchorbrowser.io/inspector.html?sessionId=&show_cursor=1 ``` ## Headless Mode To obtain the browser live session URL in headless mode, start by [creating a session](/api-reference/browser-sessions/start-browser-session): ```javascript node.js theme={null} import { client, Sessions } from 'anchorbrowser'; // Initialize the client client.setConfig({ auth: () => process.env.ANCHOR_API_KEY }); const config = { browser: { headless: { active: true } } }; const session = await Sessions.createSession({ body: config }); const liveViewUrl = session.data.live_view_url; console.log(`Live view URL: ${liveViewUrl}`); ``` ```python python theme={null} from anchorbrowser import Anchorbrowser import os # Initialize the client client = Anchorbrowser(api_key=os.getenv("ANCHOR_API_KEY")) config = { "headless": { "active": True } } session = client.sessions.create_session(browser=config) print(f"Live view URL: {session.data.live_view_url}") ``` ![Browser Live View in Headless Mode](https://mintcdn.com/anchor-b3ec2715/hJc2I0-WvjLCCXOl/images/cdp-live-view.png?fit=max\&auto=format\&n=hJc2I0-WvjLCCXOl\&q=85\&s=dc51ac109c87e8f58ff04aefd508ebf5) > [!WARNING] > > The live\_view\_url currently points to the browser default first page. Then, use the **create-session** response to embed the live view URL directly into an iframe: ```html theme={null} ``` # CA Certificates Source: https://docs.anchorbrowser.io/advanced/ca-certificates Install custom CA certificates to trust internal services and private PKI in browser sessions. ## Common use cases | Use case | Description | | - | - | | **Internal services** | Access private dashboards and endpoints using certificates signed by your organization's CA | | **Dev/staging environments** | Connect to environments with self-signed or private CA certificates | | **mTLS authentication** | Validate server certificate chains in mutual TLS setups | | **QA/testing** | Run automated tests with temporary CAs or simulated certificate chains | | **Enterprise networks** | Support environments with custom trust policies or air-gapped infrastructure | ## Managing certificates Certificates are managed at the team level. Upload a certificate once, then reference it by name in any session. ### Upload a certificate ```javascript node.js theme={null} import { client, Certificates } from 'anchorbrowser'; import fs from 'fs'; client.setConfig({ auth: () => process.env.ANCHOR_API_KEY }); const certificate = await Certificates.createCertificate({ body: { file: fs.createReadStream('/path/to/your-ca.crt'), name: 'my-internal-ca', description: 'CA for internal services', }, }); console.log('Certificate uploaded:', certificate); ``` ```python python theme={null} import os from anchorbrowser import Anchorbrowser anchor_client = Anchorbrowser(api_key=os.getenv('ANCHOR_API_KEY')) with open('/path/to/your-ca.crt', 'rb') as f: certificate = anchor_client.post( '/v1/certificates', body={ 'file': f, 'name': 'my-internal-ca', 'description': 'CA for internal services', }, ) print('Certificate uploaded:', certificate) ``` | Parameter | Required | Description | | - | - | - | | `file` | Yes | Certificate file (`.crt`, `.pem`, `.cer`, `.der`) | | `name` | Yes | Unique identifier (alphanumeric, hyphens, underscores) | | `description` | No | Optional description (max 1000 characters) | ### List certificates ```javascript node.js theme={null} import { client, Certificates } from 'anchorbrowser'; client.setConfig({ auth: () => process.env.ANCHOR_API_KEY }); const certificates = await Certificates.listCertificates(); console.log('Certificates:', certificates); ``` ```python python theme={null} import os from anchorbrowser import Anchorbrowser anchor_client = Anchorbrowser(api_key=os.getenv('ANCHOR_API_KEY')) certificates = anchor_client.get('/v1/certificates') print('Certificates:', certificates) ``` ### Delete a certificate ```javascript node.js theme={null} import { client, Certificates } from 'anchorbrowser'; client.setConfig({ auth: () => process.env.ANCHOR_API_KEY }); const response = await Certificates.deleteCertificate({ path: { name: 'my-internal-ca', }, }); console.log('Deleted:', response); ``` ```python python theme={null} import os from anchorbrowser import Anchorbrowser anchor_client = Anchorbrowser(api_key=os.getenv('ANCHOR_API_KEY')) response = anchor_client.delete('/v1/certificates/my-internal-ca') print('Deleted:', response) ``` ## Using a certificate After uploading a certificate, reference it by name when creating a session: ```javascript node.js theme={null} import { client, Sessions } from 'anchorbrowser'; client.setConfig({ auth: () => process.env.ANCHOR_API_KEY }); const session = await Sessions.createSession({ body: { browser: { ca_cert: { active: true, name: 'my-internal-ca', }, }, }, }); console.log('Session:', session.data.id); ``` ```python python theme={null} import os from anchorbrowser import Anchorbrowser anchor_client = Anchorbrowser(api_key=os.getenv('ANCHOR_API_KEY')) session = anchor_client.sessions.create_session( browser={ 'ca_cert': { 'active': True, 'name': 'my-internal-ca', }, }, ) print('Session:', session.data.id) ``` ## Related capabilities > [card] [Proxy](/advanced/proxy) > > Route traffic through proxies for network control. > [card] [Authentication](/essentials/managed-authentication) > > Persistent identity for seamless access to applications. # Captcha Solving Source: https://docs.anchorbrowser.io/advanced/captcha-solving ### Visual CAPTCHA solving Anchor browser solves CAPTCHA challenges using a vision-based approach, along with extension-based fallbacks. The vision-based approach imitates human behavior to solve any CAPTCHA (including Cloudflare) without multiple challenges. > [!NOTE] > > CAPTCHA solving requires either an active proxy or a configured browser profile (the profile may carry its own egress IP and stable identity). For the full list of available options, view the [interactive api documentation](/api-reference) ### Enable CAPTCHA solving ```javascript node.js theme={null} import { client, Sessions } from 'anchorbrowser'; (async () => { client.setConfig({ auth: () => process.env.ANCHOR_API_KEY }); const session = await Sessions.createSession({ body: { browser: { captcha_solver: { active: true } }, session: { proxy: { active: true // Required } } } }); console.log("Session created with CAPTCHA solver:", session.data.id); })().catch(console.error); ``` ```python python theme={null} import os from anchorbrowser import Anchorbrowser anchor_client = Anchorbrowser(api_key=os.getenv("ANCHOR_API_KEY")) session = anchor_client.sessions.create_session( browser= { "captcha_solver": { "active": True } }, session= { "proxy": { "active": true # Required } } ) print("Session created with CAPTCHA solver:", session.data.id) ``` #### Configure Text-based CAPTCHA solving ```javascript node.js theme={null} import { client, Sessions } from 'anchorbrowser'; (async () => { client.setConfig({ auth: () => process.env.ANCHOR_API_KEY }); const session = await Sessions.createSession({ body: { browser: { captcha_solver: { active: true, image_selector: 'ol_capcha img', input_selector: 'ol-captcha input' } }, session: { proxy: { active: true // Required } } } }); console.log("Session created with text-based CAPTCHA solver:", session.data.id); })().catch(console.error); ``` ```python python theme={null} import os from anchorbrowser import Anchorbrowser anchor_client = Anchorbrowser(api_key=os.getenv("ANCHOR_API_KEY")) session = anchor_client.sessions.create_session( browser={ "captcha_solver": { "active": True, "image_selector": 'ol_capcha img', "input_selector": 'ol-captcha input' } }, session= { "proxy": { "active": true # Required } } ) print("Session created with text-based CAPTCHA solver:", session.data.id) ``` # Cloudflare Web Bot Auth Source: https://docs.anchorbrowser.io/advanced/cloudflare-web-bot-auth Authenticate browser sessions with Cloudflare Web Bot Auth Anchor Browser supports Cloudflare Web Bot Auth HTTP message signing for browser sessions. This allows you to identify as Anchor Browser to websites that require Cloudflare's web bot authentication, enabling access to protected content and avoiding bot detection. ![WebBotAuth.io Test](https://mintcdn.com/anchor-b3ec2715/hJc2I0-WvjLCCXOl/images/cloudflare-web-bot-auth.png?fit=max\&auto=format\&n=hJc2I0-WvjLCCXOl\&q=85\&s=b2984b651bdbcdcac0b5de047aaaa235) ## How It Works 1. **Session Creation**: Create a browser session with web bot auth enabled 2. **HTTP Message Signing**: All HTTP requests are automatically signed as Anchor Browser 3. **Authentication**: Cloudflare validates the signatures 4. **Access Granted**: Successfully authenticated requests can access protected content ## Using Web Bot Auth ### How Authentication Works When you enable web bot auth, Anchor Browser automatically identifies all HTTP requests to websites using our registered identity. This allows you to access protected content that requires Cloudflare's web bot authentication without any additional configuration. ### Browser Configuration ```typescript theme={null} { "browser": { "web_bot_auth": { "active": boolean // Enable/disable web bot auth (default: false) } } } ``` ### SDK Examples Enable web bot auth by setting the `web_bot_auth.active` flag to `true` in your session configuration: ```python python theme={null} from anchorbrowser import Anchorbrowser import os # Initialize the client client = Anchorbrowser(api_key=os.getenv("ANCHOR_API_KEY")) # Session configuration with web bot auth enabled config = { "web_bot_auth": { "active": True } } # Create session with web bot auth session = client.sessions.create_session(browser=config) print(f"Session created: {session.data.id}") print(f"CDP URL: {session.data.cdp_url}") print(f"Live view URL: {session.data.live_view_url}") ``` ```javascript node.js theme={null} import { client, Sessions } from 'anchorbrowser'; // Initialize the client client.setConfig({ auth: () => process.env.ANCHOR_API_KEY }); // Session configuration with web bot auth enabled const config = { browser: { web_bot_auth: { active: true } } }; // Create session with web bot auth const session = await Sessions.createSession({ body: config }); console.log('Session created:', session); ``` ## Testing You can test your web bot auth configuration by visiting [https://webbotauth.io/test](https://webbotauth.io/test) in a browser session with web bot auth enabled. This site will show you whether your requests are being properly signed and authenticated. ## Read More * [Cloudflare Verified Bots Blog](https://blog.cloudflare.com/verified-bots-with-cryptography/) * [HTTP Message Signatures (RFC 9421)](https://datatracker.ietf.org/doc/html/rfc9421) * [Web Bot Auth IETF Draft](https://datatracker.ietf.org/doc/html/draft-meunier-web-bot-auth-architecture) * [WebBotAuth.io](https://webbotauth.io) # Dedicated Sticky IP Source: https://docs.anchorbrowser.io/advanced/dedicated-sticky-ip Reserve a fixed IP address for a specific profile. A **Dedicated Sticky IP** ensures that a specific profile uses by default the same IP address, reserved exclusively for that profile. This is helpful when IP consistency is required across sessions. > [!NOTE] > > [Extra Stealth](/essentials/stealth) mode is automatically enabled for all sessions using a Dedicated Sticky IP profile. **1. Create a profile with a dedicated sticky IP** Use the [Create Profile API](https://docs.anchorbrowser.io/api-reference/profiles/create-profile?playground=open) to create a profile with a dedicated sticky IP by setting `dedicated_sticky_ip` to `true`: ```javascript node.js theme={null} import { client, Profiles } from 'anchorbrowser'; client.setConfig({ auth: () => process.env.ANCHOR_API_KEY }); const profile = await Profiles.createProfile({ body: { name: 'my-sticky-profile', dedicated_sticky_ip: true, }, }); console.log('Profile created:', profile.data); ``` ```python python theme={null} from anchorbrowser import Anchorbrowser import os anchor_client = Anchorbrowser(api_key=os.getenv("ANCHOR_API_KEY")) profile = anchor_client.profiles.create_profile( name="my-sticky-profile", dedicated_sticky_ip=True, ) print("Profile created:", profile.data) ``` This allocates a dedicated IP that is not shared with other profiles. **2. Start a session using the profile** Start a browser session with the profile. Set `persist` to `true` so the browser state (cookies, localStorage, etc.) is saved when the session ends. ```javascript node.js theme={null} import { client, Sessions } from 'anchorbrowser'; client.setConfig({ auth: () => process.env.ANCHOR_API_KEY }); const session = await Sessions.createSession({ body: { browser: { profile: { name: 'my-sticky-profile', persist: true, }, }, }, }); console.log('Session created:', session.data); ``` ```python python theme={null} from anchorbrowser import Anchorbrowser import os anchor_client = Anchorbrowser(api_key=os.getenv("ANCHOR_API_KEY")) session = anchor_client.sessions.create_session( browser={ "profile": { "name": "my-sticky-profile", "persist": True, } } ) print("Session created:", session.data) ``` The session will automatically use the reserved sticky IP and Extra Stealth mode. **3. Do your work in the session** Connect to the session via live view, CDP, or the session view in the dashboard. Log in to accounts, configure settings, or perform any actions you need. When you're done, close the session. The profile state (cookies, localStorage, etc.) will be persisted automatically because `persist` was set to `true`. **4. Start future sessions with the same profile** Any new session started with this profile will use the same dedicated sticky IP and have all the saved browser state from previous sessions. **5. Override the IP with your own proxy (optional)** To override the default sticky IP, set the `proxy` field when using the [Start Browser Session API](https://docs.anchorbrowser.io/api-reference/browser-sessions/start-browser-session). See [Bring Your Own Proxy](/advanced/bring-your-own-proxy) for configuration details. ## Mac hardware Sessions that run on Mac hardware (`session.hardware: "mac"`) can use a profile with a dedicated sticky IP once the capability is enabled for your project. Nothing changes in the request: the session restores the profile before it is ready, routes through the profile's dedicated IP, and persists the profile when it ends. > [!NOTE] > > On Mac hardware the saved state is written when the session ends (`DELETE` the session, let it time out, or close the browser over CDP). `GET /v1/profiles/{name}` reports `status: "ready"` once the new state is stored; poll it before starting the next session on the same profile if you depend on the latest state. Until the capability is enabled for your project, Mac sessions that use a profile answer `400` with `browser.profile is not available on hardware 'mac'`, preceded by `profile-managed sticky proxies are not available on hardware 'mac'` when the profile has a dedicated sticky IP; the `(set by your project's enforced configuration)` suffix only says the refused setting came from your project's enforced configuration. # Demonstrations API Source: https://docs.anchorbrowser.io/advanced/demonstrations-api Send a shareable link so someone can demonstrate a task and Anchor generates production-ready automation from it. Send a shareable link so someone can demonstrate a task in a live browser. Anchor captures every event and compiles it into deterministic, repeatable code with an AI fallback — the same outcome as [creating a task from a demonstration](/tasks/creating-a-task#create-from-a-demonstration) in the UI. Use this when the person who knows the flow isn't at the keyboard in your Anchor workspace. ## How it works 1. **Create** a demonstration session via API — you get back a `share_url` 2. **Send** the link to the person who will demonstrate the task 3. They open it, see a live browser, and **perform the task** 4. They click **Finish Demonstration** — the demonstration is submitted 5. Anchor **compiles the captured events** into a task 6. **Poll** the status endpoint until it reaches `completed` — you get `task_id` and `tool_id` ## API Endpoints ### Create a demonstration ```javascript node.js theme={null} import { client } from 'anchorbrowser'; client.setConfig({ auth: () => process.env.ANCHOR_API_KEY }); const { data: demo } = await client.post({ url: '/v1/demonstrations/', body: { task_name: 'Download invoice report', task_description: 'Navigate to Reports, select the monthly invoice report, and download it as PDF', user_name: 'John', }, }); console.log('Share URL:', demo.share_url); console.log('Session ID:', demo.session_id); console.log('Task ID:', demo.task_id); ``` ```python python theme={null} import os from anchorbrowser import Anchorbrowser anchor_client = Anchorbrowser(api_key=os.getenv('ANCHOR_API_KEY')) demo = anchor_client.post( '/v1/demonstrations/', body={ 'task_name': 'Download invoice report', 'task_description': 'Navigate to Reports, select the monthly invoice report, and download it as PDF', 'user_name': 'John', }, cast_to=object, ) print('Share URL:', demo['share_url']) print('Session ID:', demo['session_id']) print('Task ID:', demo['task_id']) ``` **Request body:** | Field | Type | Required | Description | | - | - | - | - | | `task_name` | string | Yes | Name for the task being demonstrated | | `task_description` | string | Yes | Natural language description of what the task does — helps Anchor interpret the demonstration | | `identity_id` | string | No | Pre-authenticate the browser with a saved identity | | `identity_skip_validation` | boolean | No | Skip identity validation (default: `true`) | | `user_name` | string | No | Display name shown in the demonstration UI ("Thanks, John!") | | `session_config` | object | No | Override browser session settings (start URL, proxy, timeouts, etc.) | **Response:** ```json theme={null} { "session_id": "abc123-...", "live_view_url": "https://connect.anchorbrowser.io/...", "share_url": "https://app.anchorbrowser.io/demonstrate?token=eyJ...", "share_token": "eyJ...", "share_expires_at": "2026-04-15T09:00:00.000Z", "task_id": "task-uuid-..." } ``` > [!NOTE] > > The `share_url` is a signed JWT link valid for 1 hour. The customer does not need an Anchor account — the token contains the session and team context. ### Get demonstration status Poll this endpoint to track progress after the demonstration is submitted. ```javascript node.js theme={null} const { data: status } = await client.get({ url: `/v1/demonstrations/${sessionId}` }); console.log(status); ``` ```python python theme={null} status = anchor_client.get(f'/v1/demonstrations/{session_id}', cast_to=object) print(status) ``` **Response:** ```json theme={null} { "session_id": "abc123-...", "status": "completed", "hektor_project_id": "proj-uuid-...", "task_id": "task-uuid-...", "task_version_id": "ver-uuid-...", "tool_id": "tool-uuid-...", "created_at": "2026-04-15T07:32:12.865Z" } ``` **Status values:** | Status | Description | | - | - | | `recording` | Browser session is live — demonstration in progress | | `processing` | Demonstration complete — Anchor is compiling the task | | `completed` | Task generated — `task_id` and `tool_id` are available | | `failed` | Task generation failed | | `stopped` | Session was stopped before completing | ### Complete demonstration Called automatically when the user clicks **Finish Demonstration**. Can also be called programmatically via `POST .../recording/complete`. ```javascript node.js theme={null} const { data: result } = await client.post({ url: `/v1/demonstrations/${sessionId}/recording/complete`, }); console.log(result); ``` ```python python theme={null} result = anchor_client.post(f'/v1/demonstrations/{session_id}/recording/complete', cast_to=object) print(result) ``` **Response:** ```json theme={null} { "session_id": "abc123-...", "status": "processing", "hektor_project_id": "proj-uuid-...", "task_id": "task-uuid-..." } ``` This endpoint: 1. Ends the browser session and uploads the captured events 2. Waits for demonstration artifacts to be stored 3. Submits them for task generation 4. Returns immediately with `status: "processing"` ### Stop demonstration Stop a demonstration without generating a task. Useful for cleanup. ```javascript node.js theme={null} const { data: result } = await client.post({ url: `/v1/demonstrations/${sessionId}/stop` }); console.log(result); ``` ```python python theme={null} result = anchor_client.post(f'/v1/demonstrations/{session_id}/stop', cast_to=object) print(result) ``` **Response:** ```json theme={null} { "success": true } ``` ## End-to-end example ```javascript node.js theme={null} import { client } from 'anchorbrowser'; client.setConfig({ auth: () => process.env.ANCHOR_API_KEY }); // 1. Create demonstration const { data: demo } = await client.post({ url: '/v1/demonstrations/', body: { task_name: 'Download invoice report', task_description: 'Go to Reports > Invoices, select this month, download PDF', identity_id: 'your-identity-id', user_name: 'Sarah', }, }); console.log(`Send this link to your customer: ${demo.share_url}`); const sessionId = demo.session_id; // 2. Poll until completed let status; while (true) { status = (await client.get({ url: `/v1/demonstrations/${sessionId}` })).data; console.log(`Status: ${status.status}`); if (['completed', 'failed', 'stopped'].includes(status.status)) break; await new Promise((r) => setTimeout(r, 5000)); } // 3. Use the generated task if (status.status === 'completed') { console.log(`Task ID: ${status.task_id}`); console.log(`Tool ID: ${status.tool_id}`); } ``` ```python python theme={null} import os import time from anchorbrowser import Anchorbrowser anchor_client = Anchorbrowser(api_key=os.getenv('ANCHOR_API_KEY')) # 1. Create demonstration demo = anchor_client.post( '/v1/demonstrations/', body={ 'task_name': 'Download invoice report', 'task_description': 'Go to Reports > Invoices, select this month, download PDF', 'identity_id': 'your-identity-id', 'user_name': 'Sarah', }, cast_to=object, ) print(f"Send this link to your customer: {demo['share_url']}") session_id = demo['session_id'] # 2. Poll until completed while True: status = anchor_client.get(f'/v1/demonstrations/{session_id}', cast_to=object) print(f"Status: {status['status']}") if status['status'] in ('completed', 'failed', 'stopped'): break time.sleep(5) # 3. Use the generated task if status['status'] == 'completed': print(f"Task ID: {status['task_id']}") print(f"Tool ID: {status['tool_id']}") ``` ## Identity pre-authentication Pass an `identity_id` to pre-authenticate the browser before the link is opened. The user will see the target application already logged in and can start the demonstration immediately. ```json theme={null} { "task_name": "Export quarterly report", "task_description": "Navigate to the reports section and export Q1 data", "identity_id": "7f0db4ad-74ca-42e5-896e-3f0daea36c13" } ``` > [!TIP] > > If identity authentication fails (expired credentials, site unreachable), the session still starts — the user can log in manually during the demonstration. Set `identity_skip_validation: true` (default) to ensure this behavior. ## Share URL and the demonstration UI The `share_url` opens a full-screen demonstration interface with: * **Live browser** — interact with the actual website * **Live Browser Events panel** — clicks, typing, and navigation as they happen * **Finish Demonstration** — submits the demonstration and starts task generation When the user finishes, they see a confirmation screen. If the share URL was opened as a popup (via `window.open`), the parent window receives a `demonstration-complete` postMessage with the `task_id`, `task_version_id`, and `tool_id`. ## Session configuration Override default session settings: ```json theme={null} { "task_name": "My task", "task_description": "Task description", "session_config": { "browser": { "start_url": "https://app.example.com/dashboard" }, "session": { "timeout": { "max_duration": 60, "idle_timeout": 30 } } } } ``` Default demonstration timeouts are `max_duration: 30` minutes and `idle_timeout: 30` minutes. # Email MFA Source: https://docs.anchorbrowser.io/advanced/email-otp Email-based MFA for identity creation, reauthentication, and agent sessions. Anchor supports one-time password (OTP) as its email MFA method. Each identity is assigned a dedicated mailbox — simply configure a forwarding rule with your email provider to route OTP codes to Anchor during identity creation, reauthentication, and agent sessions. ### Step 1: Add Email MFA as an authentication method 1. Go to the [Identities](https://app.anchorbrowser.io/identities) page and select your identity. 2. Choose **Preset authentication** — the available authentication flows will appear below. 3. Click the **Add flow** button to create a new authentication flow. 4. Enter a name for the flow and click **Add**. 5. Select the **Email MFA** checkbox under **Authentication Methods**. Include any other authentication methods needed for this login flow. 6. Click **Save Changes** in the top-right corner. ### Step 2: Create an identity that uses the Email MFA authentication method After creating the Email MFA authentication method: 1. Create a new identity. 2. In the credentials window, choose the Email MFA authentication method. 3. You will receive a dedicated mailbox (for example, `zesty-vale7820@mfa.anchorbrowser.io`). 4. Set up a forwarding rule from your mailbox to your dedicated mailbox. 5. Optionally, test the forwarding flow using the detailed instructions. ### Forwarding setup details Official help for forwarding in common mail clients: * [Gmail](https://support.google.com/mail/answer/10957) * [Outlook](https://support.microsoft.com/en-us/office/use-rules-to-automatically-forward-messages-45aa9664-4911-4f96-9663-ece42816d746) ## API Reference Use the mailbox and identity email APIs to provision an inbox, attach it to an identity, verify forwarding, and read OTP emails programmatically. All endpoints require the `anchor-api-key` header. ### Typical flow 1. Create an [authentication flow](/api-reference/applications/create-authentication-flow) that includes `email_mfa` in `methods`. 2. [Create a mailbox](/api-reference/identities/create-mailbox) to get a dedicated forwarding address. 3. [Create an identity](/api-reference/identities/create-identity) and pass the mailbox `id` as `mailboxId`, plus `authOptionId` for the flow you created. 4. [Send a probe email](/api-reference/identities/send-mailbox-probe) to verify delivery. 5. [List](/api-reference/identities/list-identity-emails) or [read](/api-reference/identities/get-identity-email) emails to retrieve OTP codes. **Endpoints** | Method | Path | Description | | - | - | - | | `POST` | `/v1/mailboxes` | Create a detached mailbox before identity creation | | `GET` | `/v1/mailboxes/{mailboxId}/emails` | List emails received by a mailbox | | `POST` | `/v1/mailboxes/{mailboxId}/send-probe` | Send a test email to verify forwarding | | `POST` | `/v1/identities/{identityId}/email` | Enable or return the identity's mailbox | | `GET` | `/v1/identities/{identityId}/email` | Get the identity's mailbox details | | `DELETE` | `/v1/identities/{identityId}/email` | Detach and delete the identity's mailbox | | `GET` | `/v1/identities/{identityId}/email/emails` | List emails in the identity's mailbox | | `GET` | `/v1/identities/{identityId}/email/emails/{emailId}` | Get full email content (text and HTML) | ### Example: provision mailbox and create identity ```javascript node.js theme={null} import { client, Applications, Identities } from 'anchorbrowser'; // 1. Create an auth flow with Email MFA const authFlow = await Applications.createAuthFlow({ path: { applicationId }, body: { name: 'Login with Email MFA', methods: ['username_password', 'email_mfa'], }, }); // 2. Create a detached mailbox const { data: mailbox } = await client.post({ url: '/v1/mailboxes', body: {} }); console.log('Forwarding address:', mailbox.address); // 3. Create the identity and attach the mailbox const identity = await Identities.createIdentity({ body: { name: 'Work Account', source: 'https://example.com/login', authOptionId: authFlow.id, mailboxId: mailbox.id, credentials: [ { type: 'username_password', username: 'user@example.com', password: 'secret' }, ], }, }); ``` ```python python theme={null} import os from anchorbrowser import Anchorbrowser anchor_client = Anchorbrowser(api_key=os.getenv("ANCHOR_API_KEY")) auth_flow = anchor_client.applications.create_auth_flow( application_id=application_id, name="Login with Email MFA", methods=["username_password", "email_mfa"], ) mailbox = anchor_client.post("/v1/mailboxes", body={}, cast_to=object) print("Forwarding address:", mailbox["address"]) identity = anchor_client.identities.create_identity( name="Work Account", source="https://example.com/login", credentials=[ {"type": "username_password", "username": "user@example.com", "password": "secret"}, ], extra_body={"authOptionId": str(auth_flow.id), "mailboxId": mailbox["id"]}, ) ``` ### Example: test forwarding and read OTP emails After setting up your email forwarding rule, send a probe to confirm delivery, then poll for incoming messages. Use the `since` query parameter to fetch only emails received after a given ISO timestamp. ```javascript node.js theme={null} const identityId = 'IDENTITY_ID'; const mailboxId = 'MAILBOX_ID'; // Send a probe email to verify forwarding await client.post({ url: `/v1/mailboxes/${mailboxId}/send-probe`, body: {} }); // List recent emails for the identity const since = new Date(Date.now() - 5 * 60 * 1000).toISOString(); const { data: emails } = await client.get({ url: `/v1/identities/${identityId}/email/emails`, query: { since }, }); // Read full content of the newest email if (emails.length > 0) { const { data: email } = await client.get({ url: `/v1/identities/${identityId}/email/emails/${emails[0].id}`, }); console.log(email.subject, email.body_text); } ``` ```python python theme={null} import os from datetime import datetime, timedelta, timezone from anchorbrowser import Anchorbrowser anchor_client = Anchorbrowser(api_key=os.getenv('ANCHOR_API_KEY')) identity_id = 'IDENTITY_ID' mailbox_id = 'MAILBOX_ID' anchor_client.post(f'/v1/mailboxes/{mailbox_id}/send-probe', body={}, cast_to=object) since = (datetime.now(timezone.utc) - timedelta(minutes=5)).isoformat() emails = anchor_client.get( f'/v1/identities/{identity_id}/email/emails', query={'since': since}, cast_to=object, ) if emails: email = anchor_client.get( f'/v1/identities/{identity_id}/email/emails/{emails[0]["id"]}', cast_to=object, ) print(email['subject'], email['body_text']) ``` > [!NOTE] > > During identity creation and agent sessions, Anchor automatically reads OTP codes from the mailbox. Use the list and get email endpoints when you need to handle codes in your own integration. ### Related API docs > [card] [Create Mailbox](/api-reference/identities/create-mailbox) > > Provision a dedicated forwarding address > [card] [Enable Identity Mailbox](/api-reference/identities/enable-identity-mailbox) > > Attach a mailbox to an existing identity > [card] [List Identity Emails](/api-reference/identities/list-identity-emails) > > Poll for forwarded OTP emails > [card] [Send Mailbox Probe](/api-reference/identities/send-mailbox-probe) > > Verify forwarding is working # Browser Extensions Source: https://docs.anchorbrowser.io/advanced/extensions Upload and use custom browser extensions in your sessions Anchor allows you to upload and use Chrome extensions in your browser sessions. This lets you add ad blockers, privacy tools, or any other extension to enhance your browsing automation. For uploading, listing, and managing extensions, see the [interactive API documentation](/api-reference/extensions). ## Getting Extensions from Chrome Web Store To use extensions from the Chrome Web Store, you'll need to download and inspect their files: ### Download Extension Files 1. **Install CRX Extractor/Downloader** - Add this extension to your browser to download .zip files 2. **Navigate to the extension** you want on the Chrome Web Store 3. **Click the CRX Extractor icon** and download the .zip file 4. **Extract the ZIP** to inspect the contents ### Inspect Extension Contents Once extracted, you'll see the extension's files: * `manifest.json` - Contains extension metadata and permissions * `background.js` or `service_worker.js` - Background scripts * `content_scripts/` - Scripts that run on web pages * `popup.html` - Extension popup interface * `icons/` - Extension icons ### Repackage for Upload After inspecting (and optionally modifying) the files: 1. **Select all files and folders** in the extracted directory 2. **Create a new ZIP file** containing all the extension files 3. **Upload this ZIP** to AnchorBrowser using the SDK ## Extension Requirements Your extension ZIP file must contain a valid `manifest.json` with basic extension information like name and version. ### Example Manifest ```json theme={null} { "manifest_version": 3, "name": "My Extension", "version": "1.0.0", "description": "Extension description", "permissions": ["activeTab", "storage"], "background": { "service_worker": "background.js" }, "content_scripts": [{ "matches": [""], "js": ["content.js"] }] } ``` ## Code Example ```javascript node.js theme={null} import { client, Extensions, Sessions } from 'anchorbrowser'; import fs from 'fs'; client.setConfig({ auth: () => process.env.ANCHOR_API_KEY }); const extension = await Extensions.uploadExtension({ body: { file: new File([fs.readFileSync('./my-extension.zip')], 'my-extension.zip'), name: 'My Custom Extension' } }); const extensionId = extension.data.id; console.log("ExtensionId:", extensionId); const session = await Sessions.createSession({ body: { browser: { extensions: [extensionId] } } }); console.log("Session:", session); ``` ```python python theme={null} from anchorbrowser import Anchorbrowser import os anchor_client = Anchorbrowser(api_key=os.getenv("ANCHOR_API_KEY")) with open('./my-extension.zip', 'rb') as file: extension = anchor_client.extensions.upload_extension(file=file,name='My Custom Extension') extensionId = extension.data.id print("ExtensionId:", extensionId) session = anchor_client.sessions.create_session(browser={ "extensions": [extensionId] }) print("Session:", session) ``` ## Limitations * Maximum extension size: 50MB per ZIP file * Extensions must be valid Chrome extensions # File Download Source: https://docs.anchorbrowser.io/advanced/file-download Anchor Browser supports two methods for downloading files during your browser sessions: 1. **Traditional Downloads**: Files are downloaded to the browser instance and then stored by Anchor for retrieval > [!NOTE] > > To download PDF files directly instead of viewing them in the browser, set `pdf_viewer` to `false` when creating your session. 2. **P2P Downloads**: Files are captured directly in the browser using peer-to-peer technology, available instantly without waiting for Anchor storage ## Traditional File Downloads The following examples demonstrate how to download a file using the traditional method and retrieve it from the browser session. **1. Create a browser session** Use the [create session](api-reference/browser-sessions/start-browser-session) API to create a new browser session. To enable automatic PDF downloads, include the following `browser` configuration: ```tsx node.js theme={null} browser: { pdf_viewer: { active: false } } ``` ```python python theme={null} "browser": { "pdf_viewer": { "active": False } } ``` **2. Browse and download a file** Use the following example to perform a file download ```tsx node.js theme={null} await page.goto("https://browser-tests-alpha.vercel.app/api/download-test"); await Promise.all([page.waitForEvent("download"), page.locator("#download").click()]); // The download has completed ``` ```python python theme={null} await page.goto("https://browser-tests-alpha.vercel.app/api/download-test") async with page.expect_download() as download_info: await page.locator("#download").click() download = await download_info.value ``` **3. Fetch the file from the browser session** You can retrieve the downloaded file from the browser session using the [get session downloads](/api-reference/browser-sessions/list-session-downloads) API ## Keep downloads across sessions Downloads are normally stored per session. To keep them in a folder your team owns, mount a [volume](/advanced/volumes) into the session: every download then lands in the volume's `downloads/` folder, and any later session that mounts the same volume sees it. ## P2P Downloads For real-time download notifications and direct file streaming without waiting for Anchor storage, see the [P2P Download Guide](/advanced/p2p-downloads). Files are available immediately when the download completes — no polling required. # File Upload Source: https://docs.anchorbrowser.io/advanced/file-upload Anchor Browser allows you to upload files during your browser sessions, enabling you to interact with web applications/forms that require files as input. The following examples demonstrate how to upload a file, either from your local development environment or one downloaded during the browser session. ## Using a local file ### Playwright example ```tsx node.js theme={null} await page.goto('https://browser-tests-alpha.vercel.app/api/upload-test') const input = await page.$("#fileUpload") await input.setInputFiles('/tmp/my-files/google.png'); // Reference the local file path ``` ```python python theme={null} page.goto('https://browser-tests-alpha.vercel.app/api/upload-test') input = page.locator("#fileUpload") input.set_input_files('/tmp/my-files/google.png') # Reference the local file path ``` # Code Tasks Source: https://docs.anchorbrowser.io/advanced/legacy-tasks Write task automation as TypeScript, or hand-edit workflow JSON for fine-grained control. > [!NOTE] > > Most **Automation Tasks** start from a [prompt or demonstration](/tasks/creating-a-task). **Code Tasks** are for authoring automation directly — as TypeScript you upload with the SDK, or as workflow JSON you edit by hand when you need precise control. ## Overview Code Tasks cover two related paths: | Path | When to use it | | - | - | | **TypeScript tasks** | You write a `.ts` file, upload it with the v1 Tasks SDK, and run it in Anchor's task sandbox. | | **Workflow JSON** | You already have an Automation Task (from a prompt, demonstration, or generation) and need to edit its segment graph via API — for selector fixes, branching, or changes the UI editor can't express. | For the standard create-from-prompt or demonstration flow, start with [Creating a Task](/tasks/creating-a-task) and [Run a Task](/tasks/run-a-task). Use this page when you are writing or editing code yourself. ## Writing TypeScript task code For reliable execution, **follow these guidelines:** * Write your **code in TypeScript.** * **Export** a single **default async function.** * In that function, **return** whatever your workflow requires as **output** (e.g., status, messages, domain data). > [!NOTE] > > Tasks can receive values as inputs. **All input names must be prefixed with `ANCHOR_`** ### Basic Task Example ```typescript typescript theme={null} import { client, createBrowser } from 'anchorbrowser'; // Initialize the Anchor client with your API key client.setConfig({ auth: () => process.env.ANCHOR_API_KEY }); // Export the main function as the default export export default async function run() { // Create a new browser instance const { browser } = await createBrowser(); const page = browser.contexts()[0].pages()[0]; // Access input values const targetUrl = process.env.ANCHOR_TARGET_URL; const maxPages = parseInt(process.env.ANCHOR_MAX_PAGES || '10'); // Implement your automation logic await page.goto(targetUrl); console.log(`Scraping up to ${maxPages} pages from ${targetUrl}`); // Always close the browser when done await browser.close(); // Return a result object with success status and message return { success: true, message: 'Task completed successfully' }; } ``` ### Using the SDK Upload and run a TypeScript Code Task with the v1 Tasks SDK: **1. Save your typescript code as a .ts file** > [!WARNING] > > Make sure it follows the guidelines from above. **2. Get the base64 version of the file** Run the script to show your base64 file version ```bash terminal theme={null} # Convert your TypeScript file to base64 base64 -i your-task.ts ``` Copy the output for later. **3. Create your Code Task in Anchor** ```typescript node.js theme={null} import { client, TasksLegacy } from 'anchorbrowser'; client.setConfig({ auth: () => process.env.ANCHORBROWSER_API_KEY }); // Create a new task const task = await TasksLegacy.createTask({ body: { name: 'example-task', language: 'typescript', description: 'A task to scrape product information from e-commerce sites', code: "" // Replace with the output of the last step. } }); const taskId = task.data.id console.log('Task created:', taskId); ``` ```python python theme={null} import os from anchorbrowser import Anchorbrowser client = Anchorbrowser( api_key=os.environ.get("ANCHORBROWSER_API_KEY") ) # Create a new task task = client.tasks_legacy.create_task( name="example-task", language="typescript", description="A task to scrape product information from e-commerce sites", code="" # Replace with the output of the last step. ) # Save the id for later task_id = task.data.id print(f"Task created: {task_id}") ``` **4. Run the Code Task** ```typescript node.js theme={null} // Run the task with inputs const execution = await TasksLegacy.runAdhocTask({ body: { taskId: taskId, version: 'draft', inputs: { ANCHOR_TARGET_URL: 'https://example.com', ANCHOR_MAX_PAGES: '10' } } }); console.log('Task execution started:', execution.data); ``` ```python python theme={null} # Run the task with inputs execution = client.tasks_legacy.run_adhoc_task( task_id=task_id, version="draft", inputs={ "ANCHOR_TARGET_URL": "https://example.com", "ANCHOR_MAX_PAGES": "10" } ) print(f"Task execution started: {execution.data}") ``` > [!NOTE] > > By default, the browser session is automatically closed when the task ends. Set `cleanupSessions: false` to keep the session open after task execution. ![Running a task with inputs](https://mintcdn.com/anchor-b3ec2715/tCZ8ZZdZSDFlzsaC/images/tasks-run.webp?fit=max\&auto=format\&n=tCZ8ZZdZSDFlzsaC\&q=85\&s=490b5c70ac63d3e3679f00b57ab07a57) **5. Deploy the Code Task** ```typescript node.js theme={null} // Deploy the task to make it available for production use const deployment = await TasksLegacy.deployTask({ path: { taskId }, body: { code: "", // Replace with the base64 encoded code language: 'typescript', description: 'Optional description for this version' } }); console.log('Task deployed:', deployment.data); ``` ```python python theme={null} # Deploy the task to make it available for production use deployment = client.tasks_legacy.deploy_task( task_id=task_id, code="", # Replace with the base64 encoded code language="typescript", description="Optional description for this version" ) print(f"Task deployed: {deployment.data}") ``` For long-running TypeScript task runs, see [Async execution](/advanced/async-automation-tasks). ## Support For additional help with Code Tasks: * [Run a Task](/tasks/run-a-task) — execute Automation Tasks via the v2 API * Contact Anchor Browser support at [support@anchorbrowser.io](mailto:support@anchorbrowser.io) ## Manually editing workflow JSON > [!NOTE] > > Use this when you already have an Automation Task and need to edit the underlying workflow document via API — for example after [self-healing](/advanced/self-healing) produces a draft, or for changes too detailed for the UI editor. See [Automation Tasks Overview](/tasks/overview#the-workflow-page) for the equivalent workflow in the dashboard. A workflow is a JSON document describing an ordered graph of **segments** that run against a browser session. Each segment can run deterministic Playwright code, an AI agent, or both. Segment outputs flow forward by parameter name into a shared state, and the workflow's final output is read from that state at the end. This section covers the JSON schema for hand-editing and the API flow for saving and publishing those edits. ### API process for editing a workflow **1. Get the task ID** Use the `task_id` returned when you created the task, or from a completed [demonstration](/advanced/demonstrations-api) status response. **2. Read the current workflow JSON** ```bash theme={null} GET /v1/task/{taskId}/latest ``` The `code` field is base64-encoded. Decode it to get the raw workflow JSON. **3. Edit and save as draft** Edit the decoded JSON using the schema reference below, re-encode it to base64, then save: ```bash theme={null} POST /v1/task/{taskId}/draft { "code": "", "language": "workflow" } ``` **4. Publish the draft** ```bash theme={null} POST /v2/tasks/{taskId}/publish-draft ``` ### Top-level shape ```json theme={null} { "name": "string", "startSegmentName": "string", "inputParameters": [ /* Parameter[] */ ], "outputParameters": [ /* Parameter[] */ ], "segments": [ /* Segment[] */ ] } ``` | Field | Description | | - | - | | `name` | Human-readable workflow name. | | `startSegmentName` | The `name` of the segment that runs first. Must match one of `segments[].name`. | | `inputParameters` | Values supplied by the caller at run time. | | `outputParameters` | Values returned at the end of the run, read from the shared state by name. | | `segments` | The segments that make up the graph. | ### Parameter ```json theme={null} { "name": "snake_case_key", "type": "string", "required": true, "description": "What this is, in plain language.", "defaultValue": null, "options": null } ``` | Field | Default | Notes | | - | - | - | | `name` | — | The state key. Outputs flow forward by name — an output named `foo` becomes the input `foo` of any later segment that declares it. | | `type` | — | One of `string`, `number`, `boolean`, `secret`, `file`. `secret` is a string that is masked in logs. `file` carries a base64 data URI; the runtime writes it to a temp path before Playwright `setInputFiles`. | | `required` | `true` | Required parameters must be present and non-null. For optional parameters, see [Optionality](#optionality-the-most-common-gotcha). | | `description` | `null` | Read by the AI agent when present. Be concrete and action-oriented. | | `defaultValue` | `null` | Applied before validation when the value is missing/empty. | | `options` | `null` | If set, the value must be one of the listed strings (renders a dropdown). Treated as a string at runtime regardless of `type`. | A minimal parameter is `{ "name": "...", "type": "..." }` — the rest take their defaults. > [!NOTE] > > Use `secret` for credentials, tokens, API keys. Use `file` for user-uploaded attachments — declare it as a workflow input, reference it as `{{parameter_name}}` in prompts and `parameters.parameter_name` in deterministic code. Do not use `string` for binary uploads. ### Segment ```json theme={null} { "name": "snake_case_action_name", "type": "ui", "prompt": "Plain-English instruction for the agent.", "inputParameters": [], "outputParameters": [], "deterministic": "async (page, parameters) => { /* ... */ return {}; }", "next": "next_segment_name", "router": null } ``` A segment only sees parameters it **declares in `inputParameters`**. The shared state is global, but the segment's `parameters` object at runtime contains only the values the segment opted into. If you forget to declare an input, `parameters.foo` is `undefined`, even if an earlier segment produced `foo`. #### Segment types | Type | When to use | `deterministic` | `prompt` | AI fallback if deterministic throws | | - | - | - | - | - | | `ui` | DOM interaction, navigation, visible-page extraction (the default) | recommended | required | yes | | `network` | Reading data out of recorded API responses | required | required | yes | | `logic` | Deterministic-only control flow / hard errors / invariant checks | required | must be `null` | **no** — segment hard-fails | | `agent` | Subjective judgment ("best", "most relevant", visual selection) | must be `null` | required | n/a — agent is the only mode | Rules of thumb: * Default to `ui`. Reach for `network` only when the response payload is the source of truth (the user said "from API", or UI parsing is brittle). * Use `logic` when you specifically want **no [AI fallback](/advanced/self-healing#ai-fallback)** — for example, throwing "no results" errors or post-filter validation. * Use `agent` when deterministic code can't reliably encode the decision. #### `deterministic` `deterministic` is a **JSON string** containing a stringified async arrow function — not a live function. Two valid signatures: ```js theme={null} async (page, parameters) => { /* Playwright */ return { /* outputs */ }; } async (page, parameters, networkResponses) => { /* network segments */ } ``` * `page` is a Playwright page bound to the active session. * `parameters` contains all declared `inputParameters` for this segment. * `networkResponses` (network segments only) — see [Network segments](#network-segments) below. * The function **must return an object** — use `{}` if there are no outputs. * Throw on missing/invalid required values; never return `null` placeholders. Because the function is serialized as a JSON string, escape internal double quotes and keep it on a single line. For example, the function body `await page.goto('https://example.com'); return {};` becomes: ```json theme={null} "deterministic": "async (page, parameters) => { await page.goto('https://example.com'); return {}; }" ``` #### `prompt` Plain English for the AI agent. Reference parameters as `{{parameter_name}}` for runtime substitution. Describe the goal in terms of logical actions, not selectors: * ✅ `"Search Amazon for {{search_query}} and submit."` * ❌ `"Click button[aria-label=Search], fill input#q, press Enter."` For `ui`/`network` segments, the prompt is also used as [AI fallback](/advanced/self-healing#ai-fallback) if the deterministic step throws — write it as if it might run on its own. #### `next` and `router` * **Linear:** `"next": "next_segment"`. * **Terminal:** `"next": null` (workflow ends after this segment). * **Branching:** `"next": ["segment_a", "segment_b"]` plus `"router": "(parameters) => parameters.x ? 'segment_a' : 'segment_b'"`. > [!WARNING] > > The router function receives **only this segment's `outputParameters`** (its own output object), not the merged shared state. If you want to route on a value, that value **must** be declared as an `outputParameter` of the same segment whose `router` reads it. ### Data flow State is a single flat map keyed by parameter `name`. After a segment runs, its `outputParameters` are merged into that map and made available to every later segment whose `inputParameters` declare the same name. The workflow's `outputParameters` are read from the same map at the end. Implications: * Two segments with the same output name **overwrite** each other. * A segment only reads parameters it explicitly declares in `inputParameters` — declaring an input is opt-in even though the underlying state is shared. * A router only reads its own segment's outputs — see the warning above. * If a downstream segment treats an input as `required: true`, the producing segment's output should also be `required: true`, and its deterministic code must throw (not return `null`/empty) when the value is unavailable. * Demonstration values and static URLs belong **inside the prompt**, not as parameters. ### Network segments For `type: "network"` segments, the deterministic function receives a third argument — `networkResponses` — containing all responses recorded during the session. Each entry has fields like `requestUrl`, `method`, `status`, `headers`, and a body. The body field name varies by recorder version, so always read it with the canonical fallback: ```js theme={null} const rawPayload = entry?.responseBody ?? entry?.body; ``` Match responses with stable predicates (pathname/method/status), not full URL string equality: ```json theme={null} "deterministic": "async (page, parameters, networkResponses) => { const matches = (networkResponses || []).filter(e => String(e?.requestUrl || '').includes('/api/data') && String(e?.method || '').toUpperCase() === 'GET' && Number(e?.status) === 200); if (!matches.length) throw new Error('Expected /api/data GET 200 response not found'); const last = matches[matches.length - 1]; const rawPayload = last?.responseBody ?? last?.body; if (rawPayload == null) throw new Error(\"Missing required output 'result' from response payload\"); const json = typeof rawPayload === 'string' ? JSON.parse(rawPayload) : rawPayload; return { result: JSON.stringify(json) }; }" ``` Do not use `page.waitForResponse` inside a workflow segment — `networkResponses` is the deterministic source of truth. ### Reliability patterns These are the highest-leverage rules for hand-written deterministic code. #### Split navigation from interaction Always put `page.goto(url)` in its own segment. Element waits, fills, and clicks belong in the next segment. * ❌ `nav_open_and_fill_search` — navigation + interaction in one segment * ✅ `nav_to_search_page` → `fill_search_form` The page load is handled automatically by the browser; do not call `page.waitForLoadState('networkidle')` after `page.goto`. The next segment handles waiting for specific elements to appear. Splitting them makes segments reusable and resilient to timing issues. #### Click and input stability For any element that may be off-screen or in a virtual list, use the canonical pattern: ```js theme={null} const el = page.locator('selector'); await el.waitFor({ state: 'attached', timeout: 30000 }); await el.scrollIntoViewIfNeeded(); await el.click(); ``` * `state: 'attached'` waits for DOM presence even when the element is off-screen. The default `state: 'visible'` breaks on virtual lists. * For text inputs (`input`, `textarea`, contenteditable), click/focus first, then `fill()` or `type()`. #### Selector quality Prefer stable attributes in this order: `data-testid` → `aria-label` → `name` → semantic role + text. Scope selectors to a relevant region before text matching; avoid global `.first()` unless uniqueness is guaranteed. ### Optionality (the most common gotcha) The schema validator accepts `undefined` (i.e. a missing key) for optional fields, **not `null`**. An AI agent producing structured JSON tends to emit `"field": null` for "absent", which fails validation — especially for optional fields with `options` (enums). Three patterns that work: **1. Route around it.** Declare the optional value as an `outputParameter` of the segment whose `router` will read it, so the router can branch *before* the consuming segment ever runs. The consuming segment can then treat the input as required. ```json theme={null} { "name": "get_task_details", "type": "ui", "prompt": "Read the task and return its current estimation if any.", "inputParameters": [], "outputParameters": [ { "name": "estimation", "type": "number", "required": true, "description": "Current estimation, or 0 if none." } ], "deterministic": "async (page, parameters) => { /* read DOM, default to 0 */ return { estimation: 0 }; }", "next": ["set_estimation", "skip_estimation"], "router": "(parameters) => parameters.estimation > 0 ? 'set_estimation' : 'skip_estimation'" } ``` Note that `parameters.estimation` here refers to **this segment's own output**, which is what the router receives. **2. Add an explicit "none" option.** For optional enums, include a sentinel like `"none"` in `options` and make the field `required: true`. The agent will pick `"none"` instead of `null`. **3. Omit the key.** If you control the deterministic code, return `{}` (omit the key entirely) instead of `{ field: null }`. ### Identity-linked workflows When an [identity](/essentials/authenticated-applications) is attached to the workflow, the platform pre-authenticates the session before the workflow runs. In that case: * **Do not** declare `username`, `password`, `otp_code`, `totp_secret`, `mfa_code`, login `email`, or any other auth credential as an `inputParameter`. * **Do not** add login segments to the workflow — login is handled before your first segment runs. * Treat any login actions you saw during recording as pre-conditions performed by the platform, not as part of the user's task. * Only declare business-logic parameters the user actually needs to provide at runtime (e.g. `report_name`, `invoice_number`, `search_query`). ### Authoring checklist * [ ] Every segment has a `type`. * [ ] `logic` segments have `prompt: null` and a non-null `deterministic`. * [ ] `agent` segments have `deterministic: null` and a comprehensive `prompt`. * [ ] Every value referenced in a `router` is declared as an `outputParameter` **of the same segment** as the router. * [ ] Every value a segment uses is declared in its `inputParameters`. * [ ] Required downstream inputs come from required upstream outputs; deterministic code throws instead of returning `null` for them. * [ ] Optional values are handled by routing, an explicit `"none"` option, or by omitting the key — not by emitting `null`. * [ ] Prompts use `{{parameter_name}}` for dynamic values; static URLs and demonstration values are embedded in the prompt, not declared as parameters. * [ ] `secret` for credentials/tokens; `file` for user-uploaded attachments. * [ ] Navigation segments do `page.goto` only — element waits and interactions live in the next segment. * [ ] `next: null` only on terminal segments; otherwise a single string or an array paired with a `router`. * [ ] `deterministic` is a JSON string with quotes escaped, on a single line. * [ ] If an identity is attached, no auth credentials are declared as parameters. ### Complete example A two-input, two-output workflow that searches Amazon and extracts the first result. ```json theme={null} { "name": "amazon_price_check", "startSegmentName": "nav_to_amazon", "inputParameters": [ { "name": "search_query", "type": "string", "required": true, "description": "Product to search for", "defaultValue": null, "options": null }, { "name": "max_price", "type": "number", "required": false, "description": "Optional price ceiling (USD)", "defaultValue": null, "options": null } ], "outputParameters": [ { "name": "top_result_title", "type": "string", "required": true, "description": "Title of the first matching product", "defaultValue": null, "options": null }, { "name": "top_result_price", "type": "number", "required": false, "description": "Price of the first matching product", "defaultValue": null, "options": null } ], "segments": [ { "name": "nav_to_amazon", "type": "ui", "prompt": "Navigate to https://www.amazon.com/.", "inputParameters": [], "outputParameters": [], "deterministic": "async (page, parameters) => { await page.goto('https://www.amazon.com/'); return {}; }", "next": "search_product", "router": null }, { "name": "search_product", "type": "ui", "prompt": "Type {{search_query}} into the search box and submit.", "inputParameters": [ { "name": "search_query", "type": "string", "required": true, "description": "Product to search for", "defaultValue": null, "options": null } ], "outputParameters": [], "deterministic": "async (page, parameters) => { const input = page.locator('#twotabsearchtextbox'); await input.waitFor({ state: 'attached', timeout: 30000 }); await input.fill(parameters.search_query); await page.keyboard.press('Enter'); return {}; }", "next": "extract_top_result", "router": null }, { "name": "extract_top_result", "type": "ui", "prompt": "Extract the title and price of the first product result. Return them as { top_result_title, top_result_price }.", "inputParameters": [], "outputParameters": [ { "name": "top_result_title", "type": "string", "required": true, "description": "First result title", "defaultValue": null, "options": null }, { "name": "top_result_price", "type": "number", "required": false, "description": "First result price", "defaultValue": null, "options": null } ], "deterministic": "async (page, parameters) => { const card = page.locator('[data-component-type=\"s-search-result\"]').first(); await card.waitFor({ state: 'attached', timeout: 30000 }); const title = (await card.locator('h2 span').first().textContent())?.trim(); const priceText = (await card.locator('.a-price > .a-offscreen').first().textContent())?.replace(/[^0-9.]/g, ''); const price = priceText ? Number(priceText) : undefined; if (!title) throw new Error(\"Missing required output 'top_result_title' from extract_top_result/h2\"); return { top_result_title: title, top_result_price: price }; }", "next": null, "router": null } ] } ``` # MCP - Hosted Version Source: https://docs.anchorbrowser.io/advanced/mcp Connect Cursor, Claude, ChatGPT, Grok, or any MCP client to Anchor: cloud browsers that get past bot detection, sign in with MFA, run deterministic site actions, and scale without concurrency limits. ![Model Context Protocol](https://mintcdn.com/anchor-b3ec2715/hJc2I0-WvjLCCXOl/images/mcp_logo.png?fit=max\&auto=format\&n=hJc2I0-WvjLCCXOl\&q=85\&s=ec164cf1532c41350abe6f1dd8c52e73) Anchor's hosted MCP servers give an agent a real browser in the cloud. Each session is an isolated VM destroyed when it ends, there is no concurrency limit, and the tools cover what agents actually struggle with on the web: * **Sites that block bots**: residential and mobile proxies by country, extra-stealth fingerprinting, automatic captcha solving. * **Scale at low cost**: saved tasks and the action index run deterministic code and fall back to an AI step only where a page changed, so repeat work does not pay LLM cost. * **Digital coworkers**: long-lived signed-in sessions, a live view the user can watch or take over, and sign-in links so a person never hands an agent a password. * **Authentication**: identities are managed logins; Anchor signs in, handles MFA, and keeps credentials in its vault. No tool returns them. * **Security**: ephemeral VMs, Zero Data Retention mode, SOC 2 Type II, ISO 27001, HIPAA, and GDPR. Nothing to install. Paste a URL into your client and sign in, or add an API key header. The dashboard's [MCP page](https://app.anchorbrowser.io/mcp) builds the config for you. ## Servers Three servers over the same account. Start with `Anchor`; add `Anchor Browser` to drive a live browser and `Anchor Actions` for verified site actions. > [card] [Anchor](#anchor) > > `https://api.anchorbrowser.io/v1/mcp` — start here. Web tasks, site actions, saved automations, managed logins, browser sessions, and `call_endpoint` for everything else. > [card] [Anchor Browser](#anchor-browser) > > `https://api.anchorbrowser.io/v1/mcp/browser` — step-by-step control of a live browser. > [card] [Anchor Actions](#anchor-actions) > > `https://api.anchorbrowser.io/v1/mcp/actions` — find and run deterministic recipes for any site. Add `/{domain}` for one site's recipes as typed tools. ### Anchor `https://api.anchorbrowser.io/v1/mcp` [Add to Cursor](cursor://anysphere.cursor-deeplink/mcp/install?name=anchor\&config=eyJ1cmwiOiJodHRwczovL2FwaS5hbmNob3Jicm93c2VyLmlvL3YxL21jcCJ9), or from a CLI: ```bash theme={null} claude mcp add --transport http anchor https://api.anchorbrowser.io/v1/mcp grok mcp add --transport http anchor https://api.anchorbrowser.io/v1/mcp ``` The headline set for agents that should get work done on the web: | Area | Tools | | - | - | | Web tasks | `perform_web_task`, `get_web_task_status` | | Site actions | `search_action_index`, `get_action_index`, `execute_action_index` | | Saved automations | `list_tasks`, `get_task`, `run_task`, `get_execution` | | Managed logins | `create_identity`, `create_identity_link`, `create_reauth_link`, `reauthenticate_identity`, `get_identity` | | Browser sessions | `create_session`, `get_session`, `end_session` | | Docs | `search_docs`, `read_doc` | | Everything else | `list_endpoints`, `get_endpoint`, `call_endpoint_read`, `call_endpoint_write` | Long operations are asynchronous so tool calls return within a minute: `perform_web_task` returns a `workflow_id` to poll with `get_web_task_status`, `reauthenticate_identity` returns `pending` to poll with `get_identity`, and `run_task` returns an execution to poll with `get_execution`. > [!NOTE] > > `https://api.anchorbrowser.io/v1/mcp/all` serves every route tagged for agents as its own typed tool, `Anchor` tools first, for integrations whose client can hold a large tool list. Use it instead of `Anchor`, not alongside it; the tool names overlap. ### Anchor Browser `https://api.anchorbrowser.io/v1/mcp/browser` [Add to Cursor](cursor://anysphere.cursor-deeplink/mcp/install?name=anchor-browser\&config=eyJ1cmwiOiJodHRwczovL2FwaS5hbmNob3Jicm93c2VyLmlvL3YxL21jcC9icm93c2VyIn0%3D), or from a CLI: ```bash theme={null} claude mcp add --transport http anchor-browser https://api.anchorbrowser.io/v1/mcp/browser grok mcp add --transport http anchor-browser https://api.anchorbrowser.io/v1/mcp/browser ``` Step-by-step `anchor_*` tools over a live Anchor session: navigate, snapshot, click, type, screenshot, network and console logs, and Playwright code generation. Element references come from accessibility snapshots instead of selectors, so no vision model is needed. Add an `anchor-session-id` header to attach to a session you created on the `Anchor` server; without it the first tool call opens a new session. Every result echoes the session id so `perform_web_task` and actions can continue in the same browser. > [!NOTE] > > `https://api.anchorbrowser.io/mcp` is the legacy address of this server and keeps working with an `anchor-api-key` header. ### Anchor Actions `https://api.anchorbrowser.io/v1/mcp/actions` One server for every site, with two tools. `find_actions` takes a site (a URL or bare domain) and/or a short goal and returns matching actions with their input schemas, outputs, and run records. `run_action` runs one by name. Actions run server-side in an Anchor browser with no LLM steps, and neither tool returns the action's code. ```bash theme={null} claude mcp add --transport http anchor-actions https://api.anchorbrowser.io/v1/mcp/actions grok mcp add --transport http anchor-actions https://api.anchorbrowser.io/v1/mcp/actions ``` #### One site as typed tools `https://api.anchorbrowser.io/v1/mcp/actions/{domain}`, for example `/v1/mcp/actions/amazon.com` The domain is part of the URL, so each site is its own server. For `amazon.com`: [Add to Cursor](cursor://anysphere.cursor-deeplink/mcp/install?name=anchor-amazon\&config=eyJ1cmwiOiJodHRwczovL2FwaS5hbmNob3Jicm93c2VyLmlvL3YxL21jcC9hY3Rpb25zL2FtYXpvbi5jb20ifQ%3D%3D), or from a CLI: ```bash theme={null} claude mcp add --transport http anchor-amazon https://api.anchorbrowser.io/v1/mcp/actions/amazon.com grok mcp add --transport http anchor-amazon https://api.anchorbrowser.io/v1/mcp/actions/amazon.com ``` Several sites run in parallel: repeat with a different name and domain for each (`anchor-linkedin`, `anchor-github`, …). They share one sign-in and tool names are prefixed with the site, so they do not collide. The `anchor-actions` plugin holds one domain per install; use these per-site entries for anything beyond that. Every active action index item for the site becomes a tool with the action's own parameter schema. Actions that require a signed-in session say so; pass the `sessionId` of a session created with an identity on the `Anchor` server. Each run is deterministic code in an Anchor browser, with no LLM steps. ## Authentication **Sign in (OAuth).** Give the client only the URL. On first use it opens the Anchor sign-in and connects to your default project. Cursor, Claude, ChatGPT, Grok, and VS Code all support this. **API key.** Add an `anchor-api-key` header from [API Keys](https://app.anchorbrowser.io/api-keys). Use this for CI, non-interactive runtimes, or a project other than your default. ## Connect a client Each server above has its own Add to Cursor link and CLI commands. The snippets here use the `Anchor` server and cover the remaining clients; swap the URL for any server. > [tab] Cursor > > One click: [Add to Cursor](cursor://anysphere.cursor-deeplink/mcp/install?name=anchor\&config=eyJ1cmwiOiJodHRwczovL2FwaS5hbmNob3Jicm93c2VyLmlvL3YxL21jcCJ9), or add to `.cursor/mcp.json`: > > ```json theme={null} > { > "mcpServers": { > "anchor": { > "url": "https://api.anchorbrowser.io/v1/mcp" > } > } > } > ``` > > With an API key instead of sign-in: > > ```json theme={null} > { > "mcpServers": { > "anchor": { > "url": "https://api.anchorbrowser.io/v1/mcp", > "headers": { "anchor-api-key": "YOUR_ANCHOR_API_KEY" } > } > } > } > ``` > [tab] Claude > > Claude Code: > > ```bash theme={null} > claude mcp add --transport http anchor https://api.anchorbrowser.io/v1/mcp > ``` > > Claude Desktop and claude.ai: Settings → Connectors → Add custom connector, paste `https://api.anchorbrowser.io/v1/mcp`, and sign in when prompted. > [tab] ChatGPT > > Settings → Connectors → Create, paste `https://api.anchorbrowser.io/v1/mcp`, and sign in when prompted. Developer mode must be enabled for custom connectors. > [tab] Grok > > Grok CLI: > > ```bash theme={null} > grok mcp add --transport http anchor https://api.anchorbrowser.io/v1/mcp > ``` > > grok.com: Connectors → New Connector → Custom, paste the URL, and sign in. Grok also reads `.cursor/mcp.json` and `.mcp.json` from your project. > [tab] VS Code > > Add to `.vscode/mcp.json`: > > ```json theme={null} > { > "servers": { > "anchor": { > "type": "http", > "url": "https://api.anchorbrowser.io/v1/mcp" > } > } > } > ``` > [tab] Python > > ```python theme={null} > import asyncio > from mcp import ClientSession > from mcp.client.streamable_http import streamablehttp_client > > async def main(): > async with streamablehttp_client( > url="https://api.anchorbrowser.io/v1/mcp", > headers={"anchor-api-key": "YOUR_ANCHOR_API_KEY"}, > ) as (read, write, _): > async with ClientSession(read, write) as session: > await session.initialize() > result = await session.call_tool( > "perform_web_task", > {"prompt": "Return the top Show HN post", "url": "https://news.ycombinator.com"}, > ) > print(result.content[0].text) > > asyncio.run(main()) > ``` > [tab] OpenAI / xAI API > > Attach a server to a Responses API request; the platform calls Anchor for you: > > ```python theme={null} > tools=[{ > "type": "mcp", > "server_label": "anchor", > "server_url": "https://api.anchorbrowser.io/v1/mcp", > "headers": {"anchor-api-key": "YOUR_ANCHOR_API_KEY"}, > }] > ``` ## Examples **Run a web task and poll it** ```text theme={null} Use Anchor to find the current top post on Hacker News and give me its title and URL. ``` The agent calls `perform_web_task`, receives a `workflow_id`, and polls `get_web_task_status` until the result is ready. **Work inside a signed-in account** ```text theme={null} Create an Anchor identity for https://app.example.com and give me a link to sign in. Then open a session with it and list my open invoices. ``` The agent calls `create_identity`, then `create_reauth_link` and hands you the link. After you sign in, it calls `create_session` with the identity and runs `perform_web_task` with that `sessionId`. Your password never passes through the conversation. **Generate a Playwright test from a real session (Anchor Browser)** ```text theme={null} - You are a playwright test generator. - You are given a scenario and you need to generate a playwright test for it. - DO NOT generate test code based on the scenario alone. - DO run steps one by one using the tools provided by the Anchor Browser MCP. - Only after all steps are completed, emit a Playwright TypeScript test that uses @playwright/test based on message history - Save generated test file in the tests directory - Execute the test file and iterate until the test passes Generate a Playwright test for the following scenario: 1. Navigate to https://www.imdb.com/ 2. search for 'Garfield' 3. return the director of the last movie ```