A template project for quickly getting started with the Scrapybara SDK and Act SDK for agentic desktop and browser automation.
- Node.js 18 or higher
- pnpm
- A Scrapybara API key (https://scrapybara.com/dashboard)
- 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 .envThen 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
├── package.json # pnpm dependencies and project config
├── tsconfig.json # TypeScript configuration
└── README.md # This file
├── src/
│ └── index.ts # Main script
Run the template script:
pnpm startThe 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 defining them as shown here.
const tools = [
computerTool(instance),
bashTool(instance),
editTool(instance),
// Add your new tools here
];The template includes basic error handling with automatic cleanup:
- Catches and prints any exceptions
- Ensures instance cleanup via
finallyblock - Stops the browser and instance properly
Modify the model initialization to use your own API key:
model: anthropic({
name: "claude-3-7-sonnet-20240219-thinking",
apiKey: process.env.ANTHROPIC_API_KEY,
});
// or
model: openai({
name: "computer-use-preview-2025-02-04",
apiKey: process.env.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