Multi-Agent Scheduler

Run multiple browser automation agents concurrently on configurable intervals

Multi-Agent Scheduler

Overview

Orchestrate multiple browser automation agents that run concurrently on configurable intervals. Perfect for scheduled tasks like monitoring social media, checking emails, or tracking websites - all running in parallel.

Key Features

  • Auto-discovery - Automatically finds and runs all Python scripts in agents/ directory
  • Concurrent execution - Runs multiple agents simultaneously as subprocesses
  • Configurable intervals - Set custom schedules (default: every 5 minutes)
  • Clean output - Displays only final results from each agent
  • Error handling - Gracefully handles failures and continues running
  • Zero configuration - Just drop your scripts in the agents folder
  • Easy management - Enable/disable agents by prefixing filenames with underscore

Installation

uvx browser-use init --template scheduler

Requirements

Get your Browser Use API Key here

Optional for agent authentication:

  • Cloud Profile ID - For agents requiring persistent login sessions

How It Works

The scheduler automatically discovers and executes all .py files in the agents/ directory:

  1. Scans the agents directory for Python scripts
  2. Launches all discovered scripts concurrently as subprocesses
  3. Waits for all agents to complete
  4. Displays final results from each agent
  5. Sleeps until the next scheduled interval
  6. Repeats the cycle

Auto-Discovery

No configuration needed! The scheduler automatically finds and runs ALL Python files in the agents/ directory.

To add a new agent:

  1. Create your script in agents/ (e.g., agents/instagram.py)
  2. That's it! It will run automatically on the next cycle

To disable an agent temporarily:

Prefix the filename with underscore:

mv agents/linkedin.py agents/_linkedin.py  # Disabled
mv agents/_linkedin.py agents/linkedin.py  # Re-enabled

Configuration

Control scheduler behavior via environment variables in .env:

# Required
BROWSER_USE_API_KEY=your-key-here

# Optional - Scheduler Settings
SCHEDULER_INTERVAL_MINUTES=5      # Run every 5 minutes
SCHEDULER_SCRIPTS_DIR=agents       # Directory containing agent scripts

# Optional - Cloud Settings (for agents)
CLOUD_PROFILE_ID=your-profile-id   # For persistent authentication
CLOUD_PROXY_COUNTRY_CODE=us        # Proxy routing
CLOUD_TIMEOUT=60                   # Session timeout

Included Example Agents

The template includes two example agents:

agents/gmail.py

  • Navigates to Gmail inbox
  • Extracts 5 most recent emails
  • Returns summary of inbox activity

agents/x.py

  • Navigates to X.com (Twitter)
  • Extracts 5 newest tweets from Following feed
  • Returns summary of tweet topics

Both agents use the @sandbox decorator for cloud execution with persistent authentication.

Running the Scheduler

Run all agents on schedule:

uv run main.py

The scheduler will:

  • Execute all agents concurrently every 5 minutes (or your custom interval)
  • Log each execution with timestamps
  • Display final output from each agent
  • Continue running until you press Ctrl+C

Run a single agent once:

uv run agents/gmail.py      # Run Gmail agent
uv run agents/x.py          # Run X agent

Use Cases

Social Media Monitoring

  • Track mentions across multiple platforms
  • Monitor competitor activity
  • Aggregate trending topics

Inbox Management

  • Check multiple email accounts
  • Summarize important messages
  • Alert on priority emails

Website Monitoring

  • Track price changes
  • Monitor stock availability
  • Check for content updates

Data Collection

  • Scrape multiple sources concurrently
  • Aggregate data at regular intervals
  • Build time-series datasets

Customization

Change the interval:

Update SCHEDULER_INTERVAL_MINUTES in your .env:

SCHEDULER_INTERVAL_MINUTES=10  # Run every 10 minutes

Use a different agents directory:

Update SCHEDULER_SCRIPTS_DIR in your .env:

SCHEDULER_SCRIPTS_DIR=my-agents

Learn More

πŸ“– See the detailed README for creating custom agents, advanced configuration, and troubleshooting.

Learn More

To learn more about Browser Use, check out the following resources: