Skip to content

Scrapybara/scrapybara-python-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

    Scrapybara Python Template

MIT License Discord X

A template project for quickly getting started with the Scrapybara SDK and Act SDK for agentic desktop and browser automation.

Prerequisites

Setup

  1. Clone this repository:
git clone https://github.com/Scrapybara/scrapybara-python-template.git
cd scrapybara-python-template
  1. Install dependencies using uv:
uv sync
  1. 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

Project Structure

.
├── .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

Usage

Run the template script:

uv run src/main.py

The script will:

  1. Initialize a Scrapybara client
  2. Start a new instance
  3. Launch a browser
  4. Use the Act SDK to navigate to scrapybara.com
  5. Print the agent's observations
  6. Clean up resources automatically

Customization

Modifying the Agent's Task

Edit the prompt parameter in main.py to give the agent different instructions:

prompt="Your custom instructions here"

Adding More Tools

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)
]

Error Handling

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

Custom Model Configuration

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"))

Cursor Rules

We've included a .cursorrules file that contains instructions for working with the Scrapybara SDK.

Support

For Scrapybara SDK issues:

For template project issues:

  • Open an issue in this repository

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages