Python SDK for the BabelWrap API — the web, as an API, for your agents.
Project description
BabelWrap Python SDK
The official Python client for the BabelWrap API — the web, as an API, for your agents.
BabelWrap lets AI agents interact with any website through a simple API. This SDK provides sync and async Python clients.
Installation
pip install babelwrap
Quick Start
from babelwrap import BabelWrap
with BabelWrap(api_key="bw_...") as bw:
with bw.create_session() as session:
snap = session.navigate("https://example.com")
print(snap.title)
# Interact with the page
session.click("the Login button")
session.fill("Email address field", "user@example.com")
session.submit()
# Extract structured data
data = session.extract("all product names and prices")
print(data)
Async Usage
from babelwrap import AsyncBabelWrap
async with AsyncBabelWrap(api_key="bw_...") as bw:
async with await bw.create_session() as session:
snap = await session.navigate("https://example.com")
print(snap.title)
data = await session.extract("all links on the page")
Features
- Sync and async clients
- Automatic retries with exponential backoff on transient errors
- Context managers for automatic session cleanup
- Typed snapshots with attribute access (
snap.title,snap.inputs,snap.actions) - Site mapping — discover and generate tools for any website
API Reference
BabelWrap / AsyncBabelWrap
| Method | Description |
|---|---|
create_session() |
Create a new browser session |
usage() |
Get current usage statistics |
health() |
Check API health |
map_site(url) |
Map a website and generate tools |
list_sites() |
List all mapped sites |
site_tools(site_id) |
List tools for a mapped site |
execute_tool(site_id, tool, params) |
Execute a generated site tool |
Session / AsyncSession
| Method | Description |
|---|---|
navigate(url) |
Navigate to a URL |
click(target) |
Click an element |
fill(target, value) |
Fill a form field |
submit(target?) |
Submit a form |
extract(query) |
Extract structured data |
press(key) |
Press a keyboard key |
scroll(direction, amount) |
Scroll the page |
hover(target) |
Hover over an element |
screenshot() |
Take a screenshot (base64 PNG) |
upload(target, file_path) |
Upload a file |
back() / forward() |
Browser history navigation |
snapshot() |
Get current page state |
wait_for(text?, selector?, url_contains?) |
Wait for a condition |
Documentation
Full documentation at babelwrap.com/docs
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file babelwrap-0.1.0.tar.gz.
File metadata
- Download URL: babelwrap-0.1.0.tar.gz
- Upload date:
- Size: 7.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d0341a34927f1c548a3491eeadc36a2dfac24c42291dc73977dfbfcae8d68ec2
|
|
| MD5 |
a079991b7f40fec984ee132a9d20ad8e
|
|
| BLAKE2b-256 |
e810b7b2af2790de5a022cb66d6a2cb5c21f6c5a6c0930f1654daae0381b816a
|
Provenance
The following attestation bundles were made for babelwrap-0.1.0.tar.gz:
Publisher:
publish.yml on soulfir/babelwrap-monorepo
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
babelwrap-0.1.0.tar.gz -
Subject digest:
d0341a34927f1c548a3491eeadc36a2dfac24c42291dc73977dfbfcae8d68ec2 - Sigstore transparency entry: 1235324653
- Sigstore integration time:
-
Permalink:
soulfir/babelwrap-monorepo@14f7febaf06ba3c2aa3de9f1baae1438e5a6e470 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/soulfir
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@14f7febaf06ba3c2aa3de9f1baae1438e5a6e470 -
Trigger Event:
push
-
Statement type:
File details
Details for the file babelwrap-0.1.0-py3-none-any.whl.
File metadata
- Download URL: babelwrap-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9ee6a9b6597d1584bcffb866ac3891cf2f4cc5c665977ab1d170befc7effba9c
|
|
| MD5 |
543269e9cd9fa6a5192151aa60aca50a
|
|
| BLAKE2b-256 |
fdff31ee63b808c9275fb2bebd52ba48fe4b608e6db224d3d592d10c86068d8e
|
Provenance
The following attestation bundles were made for babelwrap-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on soulfir/babelwrap-monorepo
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
babelwrap-0.1.0-py3-none-any.whl -
Subject digest:
9ee6a9b6597d1584bcffb866ac3891cf2f4cc5c665977ab1d170befc7effba9c - Sigstore transparency entry: 1235324736
- Sigstore integration time:
-
Permalink:
soulfir/babelwrap-monorepo@14f7febaf06ba3c2aa3de9f1baae1438e5a6e470 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/soulfir
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@14f7febaf06ba3c2aa3de9f1baae1438e5a6e470 -
Trigger Event:
push
-
Statement type: