Some modern websites (like Yahoo Finance or Google Finance) only show their content after the browser runs JavaScript. This tool opens the page in a real browser behind the scenes, waits for it to fully load, and hands the finished content to the agent.
Launches a headless browser session, navigates to the URL, waits for the page to finish rendering (wait time is configurable), then extracts the visible text and tables as markdown. Slower and heavier than 'web_scrape' but necessary for modern sites whose content only appears after JavaScript runs.
When a user asks:
What is Apple's current stock price on Yahoo Finance?
the agent calls the tool:
browse(url="https://finance.yahoo.com/quote/AAPL")and gets back: the fully rendered page content, including numbers that Yahoo loads via JavaScript.
Wire this tool into a SwarmAI crew. Use the YAML DSL for declarative workflows, or the Java builder API when you want full programmatic control.
YAML DSL
# price-watch.yaml
name: price-watch-crew
process: SEQUENTIAL
agents:
- id: scout
role: Market Data Scout
goal: Read live prices from JavaScript-heavy finance pages
tools:
- browse
tasks:
- id: price-watch-task
agent: scout
description: Fetch AAPL's live quote from Yahoo Finance and report the spot price and day change.Java
import ai.intelliswarm.swarmai.agent.Agent;
import ai.intelliswarm.swarmai.task.Task;
import ai.intelliswarm.swarmai.swarm.Swarm;
import ai.intelliswarm.swarmai.swarm.SwarmOutput;
import ai.intelliswarm.swarmai.process.ProcessType;
import ai.intelliswarm.swarmai.tool.common.HeadlessBrowserTool;
import org.springframework.ai.chat.client.ChatClient;
import org.springframework.beans.factory.annotation.Autowired;
@Autowired ChatClient chatClient;
@Autowired HeadlessBrowserTool headlessBrowserTool;
Agent scout = Agent.builder()
.role("Market Data Scout")
.goal("Read live prices from JavaScript-heavy finance pages")
.chatClient(chatClient)
.tool(headlessBrowserTool)
.build();
Task scoutTask = Task.builder()
.description("Fetch AAPL's live quote from Yahoo Finance and report the spot price and day change.")
.agent(scout)
.build();
SwarmOutput result = Swarm.builder()
.agent(scout)
.task(scoutTask)
.process(ProcessType.SEQUENTIAL)
.build()
.kickoff();Real scenarios where agents put this tool to work.
Implementation lives at swarmai-tools/src/main/java/ai/intelliswarm/swarmai/tool/common/HeadlessBrowserTool.java in the swarm-ai repository.