Skip to content

sionex-code/small-agentic-browser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

🤖 small agentic browser - Autonomous Browser Agent (under 250 lines)

License: MIT Python 3.9+

A minimalist, self-contained Python agent that uses LLMs to autonomously browse the web and achieve user-defined goals.

✨ Features

  • Goal-Driven: Accepts natural language goals (e.g., "find shoes under 2000 pkr")
  • Smart Perception: Extracts visible and interactive HTML elements
  • LLM Decision Making: Uses structured prompts for intelligent action planning
  • Browser Automation: Executes actions via Playwright/Patchright (click, type, scroll)

🔄 How It Works

The agent operates in a continuous Observe → Decide → Act loop:

  1. 👁️ Observe: Extracts visible elements (inputs, buttons, links) and their attributes
  2. 🧠 Decide: Sends page state + goal to LLM, receives JSON action plan
  3. ✋ Act: Executes the action in browser using Playwright/Patchright

This loop continues until the LLM determines the goal is achieved.

🛠️ Installation

Prerequisites

  • Python 3.9+
  • Configured Gemini API environment

Setup

# Install dependencies
pip install patchright

🚀 Usage

python browser_agent.py

Enter your goal when prompted, or press Enter to use the default goal. A Chrome window will launch and execute actions autonomously.

📋 Example

# Example goal
"Find running shoes under 2000 PKR on an e-commerce site"

The agent will:

  • Navigate to the site
  • Search for products
  • Filter by price
  • Report findings

🏗️ Architecture

User Goal → Observe Page → LLM Planning → Execute Action → Repeat

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🤝 Contributing

Contributions, issues, and feature requests are welcome!

⚠️ Disclaimer

This tool is for educational purposes. Ensure compliance with website terms of service when using automated browsing.


Made with ❤️ using Python & LLMs

About

The simple project started as smallest possible agentic browser

Resources

License

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages