Browser4: a lightning-fast, coroutine-safe browser for your AI.
5.6K
English | įŽäŊ䏿â | ä¸åŊéåâ
Table of Contents
đ Browser4: a lightning-fast, coroutine-safe browser engine for your AI đ
// Give your Agent a mission, not just a script.
val agent = AgenticContexts.getOrCreateAgent()
// The Agent plans, navigates, and executes using Browser4 as its hands and eyes.
val result = agent.run("""
1. Go to amazon.com
2. Search for '4k monitors'
3. Analyze the top 5 results for price/performance ratio
4. Return the best option as JSON
""")
đē Bilibili: https://www.bilibili.com/video/BV1fXUzBFE4Lâ
Prerequisites: Java 17+ and Maven 3.6+
Clone the repository
git clone https://github.com/platonai/browser4.git
cd browser4
Configure your LLM API key
Edit application.propertiesâ and add your API key.
Build the project
./mvnw -DskipTests
Run examples
./mvnw -pl pulsar-examples exec:java -D"exec.mainClass=ai.platon.pulsar.examples.agent.Browser4AgentKt"
If you have encoding problem on Windows:
./bin/run-examples.ps1
Explore and run examples in the pulsar-examples module to see Browser4 in action.
For Docker deployment, see our Docker Hub repositoryâ .
Autonomous agents that understand natural language instructions and execute complex browser workflows.
val agent = AgenticContexts.getOrCreateAgent()
val task = """
1. go to amazon.com
2. search for pens to draw on whiteboards
3. compare the first 4 ones
4. write the result to a markdown file
"""
agent.run(task)
Low-level browser automation & data extraction with fine-grained control.
Features:
val session = AgenticContexts.getOrCreateSession()
val agent = session.companionAgent
val driver = session.getOrCreateBoundDriver()
// Open and parse a page
var page = session.open(url)
var document = session.parse(page)
var fields = session.extract(document, mapOf("title" to "#title"))
// Interact with the page
var result = agent.act("scroll to the comment section")
var content = driver.selectFirstTextOrNull("#comments")
// Complex agent tasks
var history = agent.run("Search for 'smart phone', read the first four products, and give me a comparison.")
// Capture and extract from current state
page = session.capture(driver)
document = session.parse(page)
fields = session.extract(document, mapOf("ratings" to "#ratings"))
Ideal for high-complexity data-extraction pipelines with multiple-dozen entities and several hundred fields per entity.
Benefits:
val context = AgenticContexts.create()
val sql = """
select
llm_extract(dom, 'product name, price, ratings') as llm_extracted_data,
dom_first_text(dom, '#productTitle') as title,
dom_first_text(dom, '#bylineInfo') as brand,
dom_first_text(dom, '#price tr td:matches(^Price) ~ td, #corePrice_desktop tr td:matches(^Price) ~ td') as price,
dom_first_text(dom, '#acrCustomerReviewText') as ratings,
str_first_float(dom_first_text(dom, '#reviewsMedley .AverageCustomerReviews span:contains(out of)'), 0.0) as score
from load_and_select('https://www.amazon.com/dp/B08PP5MSVB -i 1s -njr 3', 'body');
"""
val rs = context.executeQuery(sql)
println(ResultSetFormatter(rs, withHeader = true))
Example code:
Achieve extreme throughput with parallel browser control and smart resource optimization.
Performance:
val args = "-refresh -dropContent -interactLevel fastest"
val blockingUrls = listOf("*.png", "*.jpg")
val links = LinkExtractors.fromResource("urls.txt")
.map { ListenableHyperlink(it, "", args = args) }
.onEach {
it.eventHandlers.browseEventHandlers.onWillNavigate.addLast { page, driver ->
driver.addBlockedURLs(blockingUrls)
}
}
session.submitAll(links)
đē Bilibili: https://www.bilibili.com/video/BV1kM2rYrEFCâ
Automatic, large-scale, high-precision field discovery and extraction powered by self-/unsupervised machine learning â no LLM API calls, no tokens, deterministic and fast.
What it does:
Why not just LLMs?
Quick Commands (PulsarRPAPro):
curl -L -o PulsarRPAPro.jar https://github.com/platonai/PulsarRPAPro/releases/download/v4.3.0/PulsarRPAPro.jar
Integration Status:
Key Advantages:
đŊ Extract data with machine learning agents:

(Coming soon: richer in-repo examples and direct API hooks.)
| Module | Description |
|---|---|
pulsar-core | Core engine: sessions, scheduling, DOM, browser control |
pulsar-rest | Spring Boot REST layer & command endpoints |
pulsar-client | Client SDK / CLI utilities |
browser4-spa | Single Page Application for browser agents |
browser4-agents | Agent & crawler orchestration with product packaging |
pulsar-tests | Heavy integration & scenario tests |
pulsar-tests-common | Shared test utilities & fixtures |
Python/Node.js SDKs are on the way.
Set the environment variable PROXY_ROTATION_URL to the URL provided by your proxy service:
export PROXY_ROTATION_URL=https://your-proxy-provider.com/rotation-endpoint
Each time the rotation URL is accessed, it should return a response containing one or more fresh proxy IPs. Ask your proxy provider for such a URL.
For Chinese documentation, refer to įŽäŊ䏿 READMEâ .
Content type
Image
Digest
sha256:518a952f4âĻ
Size
541.9 MB
Last updated
1 day ago
docker pull galaxyeye88/browser4