Back to Blog

coding-agents

Token-Efficient Web Browsing for AI Agents

Learn how web-browsing-cli replaces raw HTML and screenshots with compact numbered views, saving tokens and improving agent reliability.

OpenAgentSkillPublished:

Where this fits

You're building an agent that needs to read a product page, extract a price, or follow a link—but raw HTML burns 10,000+ tokens and screenshots are even worse. Instead of wrestling with messy markup or paying for vision calls, you want a clean, structured view of the page. That's exactly the gap web-browsing-cli fills: it turns any URL into a compact, numbered terminal view—typically under 500 tokens—that your agent can navigate with simple commands.

Why agents benefit

  • Dramatic token savings: A typical page renders to under 500 tokens, letting you read multiple pages in the same context budget as one raw HTML dump.
  • Deterministic interaction: The do <n> command follows links or reads text blocks by number, so your agent never has to guess selectors or parse hrefs.
  • Stateful session: Once open saves a page, find, next, and read replay it locally—no repeated fetches, no network flakiness.
  • Site shortcuts: oc <site> <verb> resolves known sites (like Hacker News) and behaves like open, keeping costs predictable.
  • Clean output for LLMs: The numbered format maps naturally to tool calls, making it easy to chain actions like "open, find, read, do."

Practical scenarios

Scraping a product page for pricing

Your agent needs to compare prices across three e-commerce sites. Instead of fetching each HTML and stripping tags, it runs open <url>, then find "price" to locate the relevant region, and read <n> to extract the exact number. Total cost: three tiny tool calls.

Following a trail of links

You're researching an article's sources. The agent opens the article, uses find "source" to locate a reference link, then do <n> to open that link. Because the session is saved, next can page through the new content without re-fetching—a smooth multi-hop flow.

Checking link validity without full rendering

An agent monitoring a changelog RSS feed can open each new entry and raw the markdown to check for broken URLs. The compact output keeps the context small, and the --html flag gives cleaned HTML when you need precise structure.

Add it to your agent workflow

Install via the OpenAgentSkill CLI:

npx skills add only-cli/oc --skill web-browsing-cli

Then use it in your agent's toolset. For example, in a simple loop:

npx --yes @only-cli/oc@0.4.0 open https://example.com
npx --yes @only-cli/oc@0.4.0 find "API"
npx --yes @only-cli/oc@0.4.0 read 3

Your agent sees the numbered list, picks the right element, and moves on—no parsing required.

Compare before adopting

Before you wire this into production, weigh it against alternatives. Check the repo's star count (currently 263) and recent commit activity—only-cli is actively maintained, but verify it keeps pace with breaking changes. Compare with raw HTML parsing or headless browser tools like Playwright: those give full JavaScript rendering but at a much higher token and latency cost. Also consider whether you need dynamic content—web-browsing-cli is for static pages, so if your target relies on client-side rendering, this won't cut it. Finally, test it on your specific URLs to confirm the token count and that find/read behave as expected.

Why it is worth tracking

This skill is a strong candidate for your agent toolkit because it directly addresses the biggest cost in agent loops: context window bloat. The project's focused scope, clear CLI, and growing community (263 stars and rising) signal a practical, well-designed tool. It's worth evaluating now, especially if you're building agents that frequently read web content. For a broader look at similar skills and community momentum, check out the OpenAgentSkill listing to see how it compares with other browsing utilities.

Featured Skill

web-browsing-cli

Skill by only-cli