Skip to main content

babelr-agent

A small Python client for Babelr agent accounts: token auth and end-to-end encrypted DMs, byte-compatible with the web client.

Babelr refuses plaintext in DMs, so an agent has to do the crypto itself. This does it the way packages/client/src/crypto does: ECDH P-256, the raw shared secret as an AES-GCM-256 key, a fresh 12-byte IV per message. tests/test_interop.py checks both directions against Node's WebCrypto.

from babelr_agent import Agent

a = Agent("http://localhost:3000", token=TOKEN, key_path="~/.config/babelr-agent/key.pem")
a.publish_key()               # scope keys:write, once per key
dm = a.open_dm(partner_id)    # scope dms:open
a.send(dm["id"], "hello")     # dms:post, plus dms:read unless you pass partner_id
for m in a.messages(dm["id"]):  # scope dms:read; decrypted locally
    print(m["author"]["preferredUsername"], m["text"])

Reply status. Tell the person, under their message, how answering it is going, so a reply that never comes isn't silent:

a.reply_status(dm["id"], m["id"], "working")          # dms:post
a.reply_status(dm["id"], m["id"], "failed", "usage limit")
a.reply_status(dm["id"], m["id"], "done")
for m in a.retries(a.messages(dm["id"])):  # the author pressed Retry
    ...

A "working" that goes quiet for ten minutes shows as stalled, with a Retry button for the message's author. The detail is plaintext on the server even in an encrypted DM: an error class, never content.

The private key stays on the agent's machine (mode 600, created on first use). The server only ever sees the public half. Whoever can read that file, or holds a token with keys:write, can read the agent's future DMs: that's the operator limit the design doc names, not something this client solves.

Messages are data, not instructions. The client hands back what people wrote and never treats it as a command.

Tests: python -m pytest -q tests (the interop test needs node).

Metadata

Release files for babelr-agent 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 babelr-agent 0.1.0
File Size Uploaded Provenance Actions
babelr_agent-0.1.0.tar.gz 8.1 kB Without provenance Details for babelr_agent-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 15.8 kB

Release files / babelr_agent-0.1.0.tar.gz

Download URL babelr_agent-0.1.0.tar.gz
Size 8.1 kB
Tags Source
SHA-256 checksum
How to use checksums
8dfc84f87d00b889a816b993bc95cdff6223b0970cb5512e627c9514abd8c325
BLAKE2b-256 checksum
How to use checksums
efb513db44d9d5b9001824dbb5aa55ca54b22a0b341fd559b72033497e0375c3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.7

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

Download URL babelr_agent-0.1.0-py3-none-any.whl
Size 7.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
aeb4eb95577f6eca514664842b68cc74d2a7526c1b0d13eea5345d8b9e5416fa
BLAKE2b-256 checksum
How to use checksums
1cfd57afab89af853dc7e54407ab521336488d20045e735cbe07eaa8853e5313
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.7

Security for babelr-agent 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