AgentWeb Python client
A small, dependency-free Python client for the AgentWeb API. Stdlib only
(urllib, hmac) — nothing to install transitively. Use it on your backend;
the API key is a server secret and must never reach a browser.
pip install agentweb-client # or: uv add agentweb-client
Use it
from agentweb_sdk import AgentWeb
aw = AgentWeb(api_key="sk_live_...") # or base_url=... for a private deployment
# Render only integrations that work in this customer surface.
integrations = aw.integrations.list(host_context="web")
# 1. Mint a single-use sign-in link and send it to your user.
link = aw.connections.create(
end_user_id="user_42", # your own id for the person
integration_id="amazon",
return_url="https://app.example.com/connected",
)
print(link["connect_url"])
# 2. After the connection.created webhook fires, act as that user.
result = aw.execute(
end_user_id="user_42",
integration_id="amazon",
operation="orders.list",
arguments={"limit": 5},
idempotency_key="orders-list-user42-0001", # reuse on retry for writes
)
print(result["data"])
# List / revoke
aw.connections.list("user_42")
aw.connections.revoke("user_42", "amazon")
Calendar, Contacts, Messages, Notes, and Reminders are returned as device
capabilities. They do not have hosted connect URLs. Callers should check
compatible_with_host and connect_url_supported before rendering a connect
control.
Every method returns the wire payload verbatim (snake_case, exactly what curl
shows). Failures raise AgentWebError carrying the service's own code and
kind — match on code, never on the message:
from agentweb_sdk import AgentWebError
try:
aw.execute(end_user_id="user_42", integration_id="amazon",
operation="orders.list", arguments={})
except AgentWebError as err:
if err.code == "connection_needs_reauth":
... # send the user a fresh connect link
print(err.code, err.kind, err.status, err.retryable)
Verify webhooks
Pass the raw request body bytes (the signature is over the exact bytes sent),
the X-AgentWeb-Signature header, and your webhook secret. Constant-time.
from agentweb_sdk import verify_webhook
# FastAPI
@app.post("/webhooks/agentweb")
async def hook(request: Request):
raw = await request.body()
sig = request.headers.get("X-AgentWeb-Signature", "")
if not verify_webhook(raw, sig, WEBHOOK_SECRET):
raise HTTPException(401)
event = json.loads(raw) # {"type": "connection.created", ...}
A fully generated client
This SDK is a hand-written, ergonomic surface over the common calls. If you want a client covering every endpoint, generate one from the live OpenAPI spec:
python sdk/python/scripts/dump_openapi.py > openapi.json
openapi-python-client generate --path openapi.json
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 agentweb_client-0.2.0.tar.gz.
File metadata
- Download URL: agentweb_client-0.2.0.tar.gz
- Upload date:
- Size: 6.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8d63aa7422712e09eb2b17b141b06ccf50794d135631068b5ee11ee89cb2ad7e
|
|
| MD5 |
129232788d1f7935c9834c2f6352ec3c
|
|
| BLAKE2b-256 |
0fa05c60a9bff1fb9537b013d49ec38b8cfae9409ef39e61dbc8571afc9d8cac
|
File details
Details for the file agentweb_client-0.2.0-py3-none-any.whl.
File metadata
- Download URL: agentweb_client-0.2.0-py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
292991c5cd63861002d560f37acbef7bc90906cd5c1ae7d0e42ac0533cf34667
|
|
| MD5 |
49a2d51ec4a4d512507c15c0f9dc24b7
|
|
| BLAKE2b-256 |
646b5f86e595aff8797830ad4082bd0dbc8b518eb5b005473cb98867d0edd156
|