Template collection for the browser-use CLI init command.
.
├── templates.json # Template registry and metadata
├── gitignore.template # Shared .gitignore for complex templates
│
├── Simple Templates (single Python files)
├── default_template.py # Example: Minimal setup
├── ... # See templates.json for complete list
│
└── Complex Templates (full project scaffolding)
└── shopping/ # Example: E-commerce automation
├── main.py
├── launch_chrome_debug.py
├── README.md
├── pyproject.toml.template
└── .env.example.template
└── ... # See templates.json for complete list
For a complete list of all available templates, see templates.json.
This repository is used as a git submodule by the main browser-use repository.
Templates are loaded by the browser-use init CLI command:
uvx browser-use init --template default
uvx browser-use init --template shopping
uvx browser-use init --template job-application
uvx browser-use init --template agentmailTo test your templates before submitting a PR, you can modify the browser-use CLI to use your fork/branch:
- Fork this repository and create a branch with your changes
- Clone the browser-use repository and locate
browser_use/init_cmd.py - Find the
TEMPLATE_REPO_URLvariable (line 27, typically set tohttps://raw.githubusercontent.com/browser-use/template-library/main) - Replace it with your fork and branch:
https://raw.githubusercontent.com/YOUR_USERNAME/template-library/YOUR_BRANCH - From the browser-use directory, test your template:
# Interactive mode (select from list) python -m browser_use.init_cmd # Direct template selection python -m browser_use.init_cmd --template your-template --output test.py
This allows you to verify:
- ✓ Template files are copied correctly
- ✓
next_stepsdisplay properly - ✓ File permissions are set (executable files)
- ✓ Binary files work (PDFs, images, etc.)
- ✓ Variable substitution works (
{template},{output})
-
Create your template file in the root directory:
# Example: my_template.py -
Add an entry to
templates.json:"my-template": { "file": "my_template.py", "description": "Brief description of what this template does" }
-
Create a new directory with your template files:
mkdir my-template/ # Add files: main.py, README.md, pyproject.toml.template, .env.example.template -
Add a complete entry to
templates.json:"my-template": { "file": "my-template/main.py", "description": "Brief description of what this template does", "files": [ { "source": "my-template/main.py", "dest": "main.py" }, { "source": "my-template/pyproject.toml.template", "dest": "pyproject.toml" }, { "source": "gitignore.template", "dest": ".gitignore" }, { "source": "my-template/.env.example.template", "dest": ".env.example" }, { "source": "my-template/README.md", "dest": "README.md" } ], "next_steps": [ { "title": "Navigate to project directory", "commands": ["cd {template}"] }, { "title": "Set up your API key", "commands": [ "cp .env.example .env", "# Edit .env and add your API_KEY" ], "note": "(Get your key at https://example.com/api-keys)" }, { "title": "Install dependencies", "commands": ["uv sync"] }, { "title": "Run the script", "commands": ["uv run {output}"] }, { "footer": "📖 See README.md for detailed instructions" } ] }
Each template entry in templates.json supports the following fields:
| Field | Type | Description |
|---|---|---|
file |
string | Path to the main template file (e.g., "my_template.py" or "my-template/main.py") |
description |
string | Short description shown in CLI (1-2 sentences) |
| Field | Type | Description |
|---|---|---|
files |
array | List of files to copy for complex templates (see File Specification below) |
next_steps |
array | Custom post-installation instructions (see Next Steps below) |
featured |
boolean | Mark template as featured (shown prominently in CLI) |
author |
object | Template author information (see Author Information below) |
Each entry in the files array:
{
"source": "path/to/source/file",
"dest": "destination/filename",
"binary": true, // Optional: true for PDFs, images, etc. (default: false)
"executable": true // Optional: true to set +x permission (default: false)
}Examples:
// Text file
{
"source": "my-template/main.py",
"dest": "main.py"
}
// Binary file (PDF, image, etc.)
{
"source": "my-template/resume.pdf",
"dest": "resume.pdf",
"binary": true
}
// Executable script
{
"source": "my-template/launch_script.py",
"dest": "launch_script.py",
"executable": true
}Each entry in the next_steps array can be:
Regular step:
{
"title": "Step title",
"commands": ["command1", "command2"],
"note": "(Optional helpful note)"
}Footer (shown at the end):
{
"footer": "Final message with helpful links or tips"
}Variable Substitution:
The CLI automatically replaces these variables in commands:
{template}→ Template name (e.g.,"shopping"){output}→ Output filename specified by user
Example:
{
"title": "Run your script",
"commands": ["cd {template} && uv run {output}"]
}
// Becomes: "cd shopping && uv run my_bot"The optional author object allows you to add attribution to your template:
{
"name": "Jane Smith", // Optional: Author name or username
"github_profile": "https://github.com/janesmith", // Optional: GitHub profile URL
"last_modified_date": "2025-11-12" // Optional: Last update date (YYYY-MM-DD)
}Example:
"my-template": {
"file": "my-template/main.py",
"description": "Advanced web scraping with AI",
"files": [...],
"next_steps": [...],
"author": {
"name": "Jane Smith",
"github_profile": "https://github.com/janesmith",
"last_modified_date": "2025-11-12"
}
}Notes:
- All fields within
authorare optional - Default templates (
default,advanced,tools) typically don't need author information - Community-contributed templates should include author information when possible
- The
last_modified_dateshould be updated whenever the template is significantly changed
The optional featured boolean flag marks templates for prominent display in the CLI's template selector UI.
{
"featured": true
}Example:
"shopping": {
"file": "shopping/main.py",
"description": "E-commerce automation with structured output",
"featured": true,
"files": [...],
"next_steps": [...]
}Notes:
- Featured templates are shown in a dedicated "Featured Templates" section in the CLI
- Default templates (
default,advanced,tools) are always shown separately and don't need the featured flag - Use this to highlight high-quality, well-maintained, or popular community templates
- Currently featured templates:
shopping,job-application,agentmail,llm-arena,slack,all-openai-jobs
- README.md: Include detailed setup instructions, customization tips, and troubleshooting
- .env.example.template: Document all required environment variables with example values
- pyproject.toml.template: Pin dependencies to working versions
- Description: Be specific about what the template does (e.g., "E-commerce automation with Instacart" vs "Shopping bot")
- next_steps: Provide clear, ordered instructions that work out of the box
- Fork this repository
- Create a new branch for your template
- Add your template files and update
templates.json - Submit a PR with:
- Clear description of what the template does
- Use case or problem it solves
- Any special requirements or dependencies
- Template code is tested and working
- README.md includes clear setup instructions
- .env.example.template documents all required API keys
- pyproject.toml.template has all necessary dependencies
- next_steps guide users through setup correctly
- Template name is descriptive and follows kebab-case convention
Same as browser-use