For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
DiscordDashboard
DocumentationAPI ReferenceCookbook
DocumentationAPI ReferenceCookbook
  • Get Started
    • Introduction
    • Quickstart
    • Best Practices
  • Guides
    • Act SDK
    • Auth States
    • Conversations
    • Tools
  • Providers
    • OpenAI
    • Anthropic
  • Instances
    • Ubuntu
    • Browser
    • Windows
  • Resources
    • Starter Templates
    • Cursor Rules
    • Cookbook
Logo
DiscordDashboard
On this page
  • Deploy your first instance
  • Start building
Get Started

Quickstart

Deploy your first instance
Was this page helpful?
Previous

Best Practices

Best practices for using Scrapybara
Next
Built with

Deploy your first instance

Python
TypeScript
1

Generate API key

Sign up on our dashboard. An API key will be generated for you automatically.

2

Install SDK

Install the Python SDK with pip.

$pip install scrapybara
3

Configure client

Configure the client with your API key.

1from scrapybara import Scrapybara
2
3client = Scrapybara(api_key="your_api_key")
4

Start an instance

Start an instance with your desired configuration. You can choose from Ubuntu, Browser, and Windows instances. We recommend using Ubuntu for most tasks.

1instance = client.start_ubuntu(
2 timeout_hours=1,
3)
4
5# browser_instance = client.start_browser(
6# timeout_hours=1,
7# )
5

Get the stream URL

Get the stream URL to view and interact with the instance manually.

1stream_url = instance.get_stream_url().stream_url
6

Interact with the instance

Interact with the instance with computer and bash.

Move the mouse
1instance.computer(
2 action="move_mouse",
3 coordinates=[200, 100]
4)
Left click
1instance.computer(
2 action="click_mouse",
3 button="left"
4)
Type hello
1instance.computer(
2 action="type_text",
3 text="Hello, world!"
4)
Run a bash command
1result = instance.bash(
2 command="ls -la"
3)
7

Connect to the browser

Connect to the browser with Playwright to enable programmatic browser control and authenticated browser sessions. Learn more here.

Connect to Playwright
1from playwright.sync_api import sync_playwright
2
3cdp_url = instance.browser.start().cdp_url
4playwright = sync_playwright().start()
5browser = playwright.chromium.connect_over_cdp(cdp_url)
Save the auth state
1auth_state_id = instance.browser.save_auth(name="default").auth_state_id
Reuse the auth state on other instances
1instance.browser.authenticate(auth_state_id=auth_state_id)
8

Take action!

Build your first agent with the Act SDK to control your Scrapybara instance with BashTool, ComputerTool, EditTool. Learn more here.

1from scrapybara.tools import BashTool, ComputerTool, EditTool
2from scrapybara.openai import OpenAI, UBUNTU_SYSTEM_PROMPT
3
4response = client.act(
5 model=OpenAI(),
6 tools=[
7 BashTool(instance),
8 ComputerTool(instance),
9 EditTool(instance),
10 ],
11 system=UBUNTU_SYSTEM_PROMPT,
12 prompt="Go to the top link on Hacker News",
13 on_step=lambda step: print(step.text),
14)
9

Stop the instance

Stop the instance when you’re done. This will delete all data stored during the session.

1instance.stop()

Start building

Be sure to check out our other resources to learn more. Happy building! ₍ᐢ•(ܫ)•ᐢ₎

Act SDK

Take action with computer use agents

API Reference

Check out our API reference docs

Ubuntu

Learn about the UbuntuInstance

Browser

Learn about the BrowserInstance