Web Browsing Multi-Agent Workflow
We're building a local, multi-agent browser automation system powered by CrewAI and Stagehand. It leverages autonomous agents to plan, execute, and synthesize web automation tasks using natural language queries.
How It Works:
- Query Submission: User submits natural language query describing desired browser automation task.
- Task Planning: A Planner Agent interprets query and generates structured automation plan, including website URL and task description.
- Plan Execution: Browser Automation Agent executes plan using Stagehand Tool, which autonomously navigates web pages, interacts with elements, and extracts relevant content.
- Response Synthesis: Synthesis Agent takes raw output from execution phase and converts it into clean user-friendly response.
- Final Output: User receives a polished result containing results of web automation task, such as extracted data or completed actions.
We use:
Set Up
Follow these steps one by one:
Create .env File
Create a .env file in the root directory of your project with the following content:
OPENAI_API_KEY=<your_openai_api_key>
MODEL_API_KEY=<your_openai_api_key>Download Ollama
Download and install Ollama for your operating system. Ollama is used to run large language models locally.
For example, on linux, you can use the following command:
curl -fsSL https://ollama.com/install.sh | shPull the required model:
ollama pull gpt-ossInstall Playwright
Install Playwright for browser automation from the official website: Playwright.
Install Dependencies
uv sync
source .venv/bin/activateThis command will install all the required dependencies for the project. Additionally, make sure to install the necessary browser binaries by running:
playwright installRun CrewAI Agentic Workflow
To run the CrewAI flow, execute the following command:
python flow.pyRunning this command will start the CrewAI agentic workflow, which will handle the multi-agent orchestration for web browsing tasks using Stagehand as AI powered browser automation.
📬 Stay Updated with Our Newsletter!
Get a FREE Data Science eBook 📖 with 150+ essential lessons in Data Science when you subscribe to our newsletter! Stay in the loop with the latest tutorials, insights, and exclusive resources. Subscribe now!
