# LaVague

> Build AI web agents that turn a goal into real browser actions

- Category: Agents & Automation / Computer & Browser Use
- Language: Python
- Repository: https://github.com/lavague-ai/LaVague
- Website: https://docs.lavague.ai
- Canonical page: https://ai-tldr.dev/tools/lavague/

## In short

LaVague is an open-source Python framework for building AI web agents that automate tasks in a browser. It sits in the Computer & Browser Use category of the Agents & Automation tools and is open-source, written in Python. To get started: install LaVague.

## Overview

LaVague is an open-source Python framework for building AI web agents that automate tasks in a browser. You give an agent an objective in plain language, such as "Go on the quicktour of PEFT," and it works out the steps needed and runs them on a real web page.

Each agent is made of two parts: a World Model that reads the current page and the objective and produces instructions, and an Action Engine that compiles those instructions into browser code and executes it over Selenium or Playwright. There is also a Chrome extension driver.

It is aimed at developers who want to automate web processes for their end users. Within the agent-frameworks space, LaVague sits in the computer- and browser-use niche, focusing on driving an actual browser rather than calling APIs. A related tool, LaVague QA, builds on the framework to turn Gherkin specs into web tests.

## What it does

- World Model that converts an objective plus the current page state into a set of instructions
- Action Engine that compiles instructions into Selenium or Playwright code and runs them
- Three driver options: Selenium WebDriver, Playwright, and a Chrome extension driver
- Built-in contexts and customizable configuration for swapping models and settings
- Token counter for estimating token usage and costs, plus logging and debugging tools
- Optional interactive Gradio interface for trying agents from a UI

## Getting started

Install the package, set your OpenAI API key, then build a web agent with a driver, a World Model, and an Action Engine. The default configuration uses OpenAI, so set OPENAI_API_KEY in your environment first.

1. Install LaVague

   Install the framework from PyPI with pip.

```bash
pip install lavague
```

2. Set your OpenAI API key

   The default configuration uses the OpenAI API, so export a valid key in your local environment.

```bash
export OPENAI_API_KEY=your-key-here
```

3. Build and run a web agent

   Create a Selenium driver, a World Model, and an Action Engine, then give the agent a page and an objective in plain language.

```python
from lavague.core import WorldModel, ActionEngine
from lavague.core.agents import WebAgent
from lavague.drivers.selenium import SeleniumDriver

selenium_driver = SeleniumDriver(headless=False)
world_model = WorldModel()
action_engine = ActionEngine(selenium_driver)
agent = WebAgent(world_model, action_engine)
agent.get("https://huggingface.co/docs")
agent.run("Go on the quicktour of PEFT")

# Launch Gradio Agent Demo
agent.demo("Go on the quicktour of PEFT")
```

## When to use it

- Automate repetitive web processes for end users by describing the goal instead of scripting each click
- Navigate documentation or product pages to locate and follow a specific flow, such as a quicktour
- Generate web tests from Gherkin specs using the LaVague QA tooling built on the framework
- Prototype browser-use agents while estimating token cost with the built-in token counter
