The AT Protocol SDK for Python

Autogenerated from lexicons, well type hinted, documented, sync and async.

from atproto import Client, client_utils

client = Client()
profile = client.login('my-handle', 'my-password')
print('Welcome,', profile.display_name)

text = client_utils.TextBuilder().text('Hello World from ').link('Python SDK', 'https://atproto.blue')
post = client.send_post(text)
client.like(post.uri, post.cid)
pip install atproto

Warning

Under construction. Until the 1.0.0 release, compatibility between versions is not guaranteed.

Where to start

Quickstart

Install it, log in, send a post, read a timeline. Five minutes.

Quickstart
Guides

Posting, reading, streaming, identity and error handling, organised by what you are trying to do.

Guides
Examples

Every runnable example in the repository, inlined and ready to copy.

Examples
Custom lexicons

Generate typed models and a working client from lexicons of your own. No fork required.

Custom lexicons
Firehose and Jetstream

Consume the whole network’s event stream, verifiable or cheap.

Firehose
Model reference

Every lexicon on the network, generated as a Pydantic model and browsable by NSID.

Lexicons

What it covers

This SDK implements what the AT Protocol provides: lexicon schemas, XRPC clients, the firehose, Jetstream, identity resolution, DID keys, signatures, and the utilities around CIDs, NSIDs, AT-URIs, DAG-CBOR, CAR files, and DID documents.

Every model, query, and procedure is generated from lexicons. The focus is on the lexicons of atproto.com and bsky.app, but there is no vendor lock: point the code generator at your own and it produces the same typed models and clients for them.

  • Sync and async clients with identical method sets

  • Type hints throughout, so your IDE can navigate the whole protocol

  • A high-level client for common tasks, with the full XRPC surface underneath it

  • Direct messages, firehose and Jetstream streaming, and identity resolvers

Not the protocol documentation

This site documents the Python SDK. For the protocol itself, meaning what a DID is, how repositories and the Merkle tree work, the lexicon language and OAuth, go to the source:

Concepts is a short bridge between that vocabulary and the names you will see in this SDK.

Getting help

πŸ’‘ Examples

πŸ“– Models