# Introduction > Scrapybara deploys, scales, and maintains remote desktop instances for agents Hero Deploy your first instance Take action with computer use agents Check out our API reference docs Official open source examples ## Why Scrapybara? Scrapybara provides powerful remote desktop infrastructure for AI agents with: * **Flexible deployments**: Easily deploy and manage remote desktop instances through our API and SDKs. Configure instance types and timeouts to match your needs. * **Unified integration**: Seamlessly connect your instances to models like Claude Computer Use and define custom tools. * **Granular control**: Get complete remote desktop access with all the tools your agents need, including Browser, File, Env, Notebook, and Code protocols. * **Lightning speed**: Instantly spin up full desktops under 1 second. * **Authenticated sessions**: Save and reuse browser authentication states across instances. * **Session persistence**: Pause and resume instances with a single API call. ## Dashboard Get your API key and manage your instances on the [dashboard](https://scrapybara.com/dashboard). ## Get support Need help or want to stay up to date? Reach out to us on Discord or X. Join our Discord community Follow us on X # Quickstart > Deploy your first instance ## Deploy your first instance Sign up on our [dashboard](https://scrapybara.com/dashboard). An API key will be generated for you automatically. Install the Python SDK with pip. ```bash pip install scrapybara ``` Configure the client with your API key. ```python from scrapybara import Scrapybara client = Scrapybara(api_key="your_api_key") ``` Start an instance with your desired configuration. ```python instance = client.start( instance_type="small", timeout_hours=1, ) ``` Pause the instance to save resources and resume it when needed. ```python Pause the instance instance.pause() ``` ```python Resume the instance instance.resume(timeout_hours=1) ``` Interact with the instance with `screenshot`, `bash`, `computer`, and `edit`. ```python Get the stream URL stream_url = instance.get_stream_url().stream_url ``` ```python Take a screenshot base_64_image = instance.screenshot().base_64_image ``` ```python Move the mouse result = instance.computer( action="mouse_move", coordinate=[200, 100] ) ``` ```python Left click result = instance.computer( action="left_click" ) ``` ```python Run a bash command result = instance.bash( command="ls -la" ) ``` Connect to the browser with Playwright to enable programmatic browser control and authenticated browser sessions. Learn more [here](/browser). ```python Connect to Playwright from playwright.sync_api import sync_playwright cdp_url = instance.browser.start().cdp_url playwright = sync_playwright().start() browser = playwright.chromium.connect_over_cdp(cdp_url) ``` ```python Save the auth state auth_state_id = instance.browser.save_auth(name="default").auth_state_id ``` ```python Reuse the auth state on other instances instance.browser.authenticate(auth_state_id=auth_state_id) ``` Build your first agent with the Act SDK to control your Scrapybara instance with `BashTool`, `ComputerTool`, `EditTool`. Learn more [here](/act-sdk). ```python from scrapybara.tools import BashTool, ComputerTool, EditTool from scrapybara.anthropic import Anthropic from scrapybara.prompts import SYSTEM_PROMPT response = client.act( model=Anthropic(), tools=[ BashTool(instance), ComputerTool(instance), EditTool(instance), BrowserTool(instance), ], system=SYSTEM_PROMPT, prompt="Go to the top link on Hacker News", on_step=lambda step: print(step.text), ) ``` Stop the instance when you're done. This will delete all data stored during the session. ```python instance.stop() ``` Sign up on our [dashboard](https://scrapybara.com/dashboard). An API key will be generated for you automatically. Install the TypeScript SDK with npm, yarn, or pnpm. ```bash npm install scrapybara yarn add scrapybara pnpm add scrapybara ``` Configure the client with your API key. ```typescript import { ScrapybaraClient } from "scrapybara"; const client = new ScrapybaraClient({ apiKey: "your_api_key" }); ``` Start an instance with your desired configuration. ```typescript const instance = await client.start({ instanceType: "small", timeoutHours: 1, }); ``` Pause instances to save resources and resume them when needed. ```typescript Pause the instance // Pause the instance to save resources await instance.pause(); ``` ```typescript Resume the instance await instance.resume({ timeoutHours: 1 }); ``` Interact with the instance with `screenshot`, `bash`, `computer`, and `edit`. ```typescript const streamUrl = await instance.getStreamUrl().streamUrl; ``` ```typescript const base64Image = await instance.screenshot().base64Image; ``` ```typescript const result = await instance.computer({ action: "mouse_move", coordinate: [200, 100] }); ``` ```typescript const result = await instance.computer({ action: "left_click" }); ``` ```typescript const result = await instance.bash({ command: "ls -la" }); ``` Connect to the browser with Playwright to enable programmatic browser control and authenticated browser sessions. Learn more [here](/browser). ```typescript Connect to Playwright import { chromium } from "playwright"; const cdpUrl = await instance.browser.start().cdpUrl; const browser = await chromium.connectOverCDP(cdpUrl); ``` ```typescript Save the auth state const authStateId = await instance.browser.saveAuth({ name: "default" }).authStateId; ``` ```typescript Reuse the auth state on other instances await instance.browser.authenticate({ authStateId }); ``` Build your first agent with the Act SDK to control your Scrapybara instance with `BashTool`, `ComputerTool`, `EditTool`. Learn more [here](/act-sdk). ```typescript import { bashTool, computerTool, editTool } from "scrapybara/tools"; import { anthropic } from "scrapybara/anthropic"; import { SYSTEM_PROMPT } from "scrapybara/prompts"; const { messages, steps, text, usage } = await client.act({ tools: [ bashTool(instance), computerTool(instance), editTool(instance), ], model: anthropic(), system: SYSTEM_PROMPT, prompt: "Go to the top link on Hacker News", onStep: (step) => console.log(step.text), }); ``` Stop the instance when you're done. This will delete all data stored during the session. ```typescript await instance.stop(); ``` ## Start building Be sure to check out our other resources to learn more. Happy building! ₍ᐢ•(ܫ)•ᐢ₎ Take action with computer use agents Control a browser with Playwright Check out our API reference docs Official open source examples # Best Practices > Best practices for using Scrapybara ## Manage instance usage Instances are billed per usage. When launching an instance, you can specify its timeout before it is automatically terminated (default is 1 hour). ```python instance = client.start(timeout=3) # 3 hours ``` ```typescript const instance = await client.start({ timeout: 3 }); // 3 hours ``` To save costs, pause the instance to resume it later, or stop the instance once you no longer need to control the desktop environment and access its stored data. ```python Pause/resume instance.pause() instance.resume() ``` ```python Stop instance.stop() ``` ```typescript Pause/resume await instance.pause(); await instance.resume(); ``` ```typescript Stop await instance.stop(); ``` ## Take actions programmatically When possible, take actions programmatically rather than relying on the agent to do so. For example, using `instance.bash()` provides a faster way to launch apps compared to having the model use mouse/keyboard interactions. If you know the agent's workflow will happen on a specific application, you can launch it before prompting the agent to take actions. The same applies for browser automation: it is often easier to manipulate the browser programmatically with `instance.browser` and Playwright than relying on the agent itself. ## Initialize the browser For agents requiring programmatic browser interaction, initialize and configure the browser immediately after instance creation. This ensures the browser environment is ready before any browser tool calls are made. ```python instance = client.start() instance.browser.start() instance.browser.authenticate(auth_state_id="auth_state_id") ``` ```typescript const instance = await client.start(); await instance.browser.start(); await instance.browser.authenticate(auth_state_id="auth_state_id"); ``` ## Optimize your prompt We recommend using our provided `SYSTEM_PROMPT` for most general-purpose computer tasks. ```python from scrapybara.prompts import SYSTEM_PROMPT ``` ```typescript import { SYSTEM_PROMPT } from "scrapybara/prompts"; ``` However, it may be suboptimal for any specific use case. Here are some tips from [Anthropic](https://docs.anthropic.com/en/docs/build-with-claude/computer-use) to improve the agent's performance: 1. Specify simple, well-defined tasks and provide explicit instructions for each step. 2. Claude sometimes assumes outcomes of its actions without explicitly checking their results. To prevent this you can prompt Claude with `After each step, take a screenshot and carefully evaluate if you have achieved the right outcome. Explicitly show your thinking: "I have evaluated step X..." If not correct, try again. Only when you confirm a step was executed correctly should you move on to the next one.` 3. Some UI elements (like dropdowns and scrollbars) might be tricky for Claude to manipulate using mouse movements. If you experience this, try prompting the model to use keyboard shortcuts. 4. For repeatable tasks or UI interactions, include example screenshots and tool calls of successful outcomes in your prompt. 5. If you need the model to log in, provide it with the username and password in your prompt inside xml tags like ``. Using computer use within applications that require login increases the risk of bad outcomes as a result of prompt injection. # Official Examples > Official open source examples ## W25 Scraping A demonstration of Scrapybara's agent endpoints for automated data collection and processing of YC W25 companies.