Skip to main content

batonvm

Cloud browsers for agents, from Python. Every session is a real Chrome in its own Firecracker microVM, started in about 200 ms. A running session can move to another machine while your CDP connection stays open, be forked into copies that are logged in the same way, and be paused to storage and resumed later.

Quickstart

  1. Sign in at https://batonvm.vercel.app (email or GitHub) and create an API key.
  2. Install:
pip install batonvm playwright
export BATON_API_KEY=bk_...

Playwright only connects to the remote browser, so it needs no local browser download.

  1. Run:
from batonvm import Baton
from playwright.sync_api import sync_playwright

baton = Baton()  # reads BATON_API_KEY

with baton.sessions.create() as session, sync_playwright() as p:
    browser = p.chromium.connect_over_cdp(session.connect_url)
    page = browser.contexts[0].pages[0]
    page.goto("https://example.com")
    print(page.title())

    move = session.migrate()  # the browser changes machines mid-script
    print(f"moved {move.from_node} → {move.to_node}, paused {move.paused_ms} ms")
    print(page.title())  # same page, same connection

The session ends when the with block does.

Async (browser-use, Playwright's async API)

import asyncio
from batonvm import AsyncBaton
from playwright.async_api import async_playwright

async def main():
    async with AsyncBaton() as baton, async_playwright() as p:
        async with await baton.sessions.create() as session:
            browser = await p.chromium.connect_over_cdp(session.connect_url)
            page = browser.contexts[0].pages[0]
            await page.goto("https://example.com")
            print(await page.title())

asyncio.run(main())

Move it, copy it, put it to sleep

copies = session.fork(3)             # 3 new sessions: same pages, cookies, storage
for copy in copies.sessions:
    print(copy.id, copy.connect_url)

session.pause()                      # stored; no machine holds it; up to 7 days
session.resume()                     # back on any machine; session.connect_url is new

session.save_profile("shop")         # log in once...
later = baton.sessions.create(profile="shop")  # ...start already logged in

API

Baton(api_key=None, base_url=None) client; api_key defaults to BATON_API_KEY (AsyncBaton for asyncio)
baton.sessions.create(profile=None) start a browser → Session with connect_url
baton.sessions.list() / get(id) / delete(id)
session.migrate() move it to another machine → Migration(from_node, to_node, paused_ms, unreachable_ms)
session.fork(n) copy it into n new sessions → Fork(sessions, paused_ms, errors)
session.pause() / session.resume() store it and free its machine; bring it back, with a fresh connect_url
session.save_profile(name) save its pages, cookies and storage; sessions.create(profile=name) starts from it
baton.profiles.list() / delete(name)
session.events() what happened to it: created, migrated, forked, paused, ended and why
session.live_url() a short-lived URL for watching it
session.close() end it (or use the session as a context manager)
baton.usage() running sessions and minutes used today, with your limits

Errors are BatonError with .status, raised as AuthError (401), NotFoundError (404), LimitError (429) or CapacityError (503). When every machine is full and a new one is starting, sessions.create() and resume() wait for it (about a minute) instead of failing.

Limits (free)

2 sessions running at a time · 15 minutes per session · 60 browser-minutes per day · 10 new sessions per minute · 5 paused sessions (kept 7 days) · 3 profiles.

Source: https://github.com/vedantxn/chromebox (MIT). TypeScript: npm install batonvm.

Metadata

Release files for batonvm 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for batonvm 0.1.0
File Size Uploaded Provenance Actions
batonvm-0.1.0.tar.gz 10.9 kB Without provenance Details for batonvm-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for batonvm 0.1.0
File Interpreter ABI Platform Actions
batonvm-0.1.0-py3-none-any.whl Python 3 none any Details for batonvm-0.1.0-py3-none-any.whl

Total release size: 20.5 kB

Release files / batonvm-0.1.0.tar.gz

Download URL batonvm-0.1.0.tar.gz
Size 10.9 kB
Tags Source
SHA-256 checksum
How to use checksums
a28afc7d394d607c822ae606bbadc79898f274cfc5a51c28d0681edf7aa720f2
BLAKE2b-256 checksum
How to use checksums
8efe41bf61e5f365e44f21e933574d6c5b2494d7dac1b4a1f3355934a26a20a3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release files / batonvm-0.1.0-py3-none-any.whl

Download URL batonvm-0.1.0-py3-none-any.whl
Size 9.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3dc6b93df3399c0e6ba92e88b4aafc9993e0fcbd38b6e850171cd3ecaee0b58d
BLAKE2b-256 checksum
How to use checksums
7e782dbbef1fcfec6682432fa8759651607dc8cf4303cddc5f98dc31b13909c7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Security for batonvm 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page