A template project for quickly getting started with the Scrapybara SDK and Act SDK for AI-powered desktop and browser automation.
- Node.js 18 or higher
- pnpm
- A Scrapybara API key (https://scrapybara.com/dashboard)
- An Anthropic API key (optional, for using your own key)
- Clone this repository:
git clone https://github.com/scrapybara/scrapybara-ts-template.git
cd scrapybara-ts-template
- Install dependencies using pnpm:
pnpm install
- 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
.
├── .env # Environment variables
├── package.json # pnpm dependencies and project config
├── src/
│ └── index.ts # Main script with Scrapybara setup
├── tsconfig.json # TypeScript configuration
├── .cursorrules # Cursor rules for working with the Scrapybara SDK
└── README.md # This file
Run the template script:
pnpm start
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 src/index.ts
to give the agent different instructions:
prompt: "Your custom instructions here";
You can add more custom tools by importing them from scrapybara/tools
:
import {
bashTool,
computerTool,
editTool,
browserTool,
} from "scrapybara/tools";
const tools = [
computerTool(instance),
bashTool(instance),
editTool(instance),
browserTool(instance),
// Add your new tools here
];
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
Add additional environment variables to .env
as needed:
SCRAPYBARA_API_KEY=your_key
ANTHROPIC_API_KEY=your_key # If using your own Anthropic key
Modify the model initialization to use your own API key:
model: anthropic({
apiKey: process.env.ANTHROPIC_API_KEY,
});
We've included a .cursorrules
file that contains instructions for working with the Scrapybara SDK.
- Fork the repository
- Create a feature branch
- Submit a pull request
MIT
For Scrapybara SDK issues:
- Visit the Scrapybara documentation
- Join the Discord community
- Contact [email protected]
For template project issues:
- Open an issue in this repository