https://github.com/cloudycotton/browser-operator
Build your own AI operators like OpenAI
https://github.com/cloudycotton/browser-operator
ai anthropic browser browser-agent computer-use javascript nextjs nodejs open-operator openai playwright typescript
Last synced: 11 months ago
JSON representation
Build your own AI operators like OpenAI
- Host: GitHub
- URL: https://github.com/cloudycotton/browser-operator
- Owner: cloudycotton
- License: mit
- Created: 2025-01-26T05:53:13.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-01-27T18:55:56.000Z (about 1 year ago)
- Last Synced: 2025-02-22T06:16:03.064Z (12 months ago)
- Topics: ai, anthropic, browser, browser-agent, computer-use, javascript, nextjs, nodejs, open-operator, openai, playwright, typescript
- Language: TypeScript
- Homepage:
- Size: 33.2 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
### Browser Operator
Build your own AI operators like OpenAI
[](LICENSE) [](https://discord.gg/3YfJeg7pNp)
https://github.com/user-attachments/assets/a7196eef-d3a0-401b-89aa-eb06f4a5f3d9
## 📦 Installation
```bash
npm install browser-operator
```
### Environment
The framework depends on the following environment variables:
- `ANTHROPIC_API_KEY` - API Key for Claude.
```shell
# Set the API key in the shell before running.
export ANTHROPIC_API_KEY=your-api-key
```
> Support for other models is coming. Please open an issue for models you want to see.
## 🔧 Usage
```ts
import { BrowserOperator } from "browser-operator";
const operator = await BrowserOperator.create();
const response = await operator.page.act(
"go to hackernews, click on comments of top post, print the title and top comment."
);
await operator.stop();
console.log(response);
console.log(operator.page._generateScript()); // experimental script generation. Methods starting with _ are not stable.
```
## Terminal Usage
There is an included CLI tool that can be used to act on instructions from the command line or from a file.
```bash
# Pass the instruction from the command line
npx browser-operator "go to hackernews, click on comments of top post, print the title and top comment."
# Pass the instruction from a file
npx browser-operator instruction.txt
# Generate deterministic script of actions taken by the operator. This is experimental and may not work reliably. Next time, you run the same command with --generate-script flag, generated script will be run instead of operator.
npx browser-operator "go to hackernews, click on comments of top post, print the title and top comment." --generate-script
```
## 🙏 Acknowledgements
This project is heavily inspired by [StageHead](https://github.com/browserbase/stagehand).
## 📄 License
This project is licensed under the [MIT License](LICENSE).