A template project for quickly getting started with the Scrapybara SDK and Act SDK for agentic desktop and browser automation.
- Python 3.8 or higher
- uv (Python package manager: https://docs.astral.sh/uv/getting-started/installation/)
- A Scrapybara API key (https://scrapybara.com/dashboard)
- Clone this repository:
git clone https://github.com/Scrapybara/scrapybara-python-template.git
cd scrapybara-python-template
- Install dependencies using uv:
uv sync
- Copy the example environment file and add your API keys:
cp .env.example .env
Then edit .env
with your API keys:
SCRAPYBARA_API_KEY=your_api_key_here
ANTHROPIC_API_KEY=your_api_key_here # Optional
OPENAI_API_KEY=your_api_key_here # Optional
.
├── .cursorrules # Cursor rules for working with the Scrapybara SDK
├── .env # Environment variables
├── pyproject.toml # uv dependencies
├── README.md # This file
└── src/
└── main.py # Main script
Run the template script:
uv run src/main.py
The script will:
- Initialize a Scrapybara client
- Start a new instance
- Launch a browser
- Use the Act SDK to navigate to scrapybara.com
- Print the agent's observations
- Clean up resources automatically
Edit the prompt
parameter in main.py
to give the agent different instructions:
prompt="Your custom instructions here"
You can add more custom tools by defining them as shown in https://docs.scrapybara.com/tools#define-custom-tools
tools=[
ComputerTool(instance),
BashTool(instance),
EditTool(instance),
YourNewTool(instance)
]
The template includes basic error handling with automatic cleanup:
- Catches and prints any exceptions
- Ensures instance cleanup via
finally
block - Stops the browser and instance properly
Modify the model initialization to use your own API key:
model=Anthropic(api_key=os.getenv("ANTHROPIC_API_KEY"))
# or
model=OpenAI(api_key=os.getenv("OPENAI_API_KEY"))
We've included a .cursorrules
file that contains instructions for working with the Scrapybara SDK.
For Scrapybara SDK issues:
- Visit the Scrapybara documentation
- Join the Discord community
- Contact hello@scrapybara.com
For template project issues:
- Open an issue in this repository