Python

Free Python Bluesky bot hosting.

The atproto SDK or plain HTTP. Your requirements install on deploy and the bot posts, replies or watches around the clock.

Libraries

Libraries that run here

atproto

The Python SDK for the AT Protocol: a typed client for every Bluesky endpoint, with sync and async variants, and session export so you can save a login and resume it.

websockets for Jetstream

Jetstream is JSON over a WebSocket. A watching bot needs nothing more specialised than the websockets package and a filter in the connection URL.

Plain HTTP

The protocol is HTTP and JSON. A bot that posts one thing a day can do it with httpx and two requests: create a session, create a record.

Deploying

Getting it running

  1. 1

    Upload your project

    Drag the folder into the file manager or push it over SFTP. There is no need for a virtual environment: your server is already isolated from everyone else.

  2. 2

    requirements.txt does the rest

    Installed on deploy, before the bot starts. Pin the SDK version, since it follows a protocol that is still moving.

  3. 3

    Point us at your entry file

    Usually bot.py. Handle and app password come from os.environ; the exported session string goes into a file next to your code.

Memory

What actually fits in 256 MB

A posting or reply bot fits with room to spare. The interpreter and the SDK make up most of the baseline, and a bot that spends its time waiting for the next poll spends almost nothing else.

The SDK can also consume the raw firehose, and that is the one thing not to do here: decoding every event on the network in Python on 25% of a core cannot keep pace. Use Jetstream with a filter instead, and handle each event as it arrives.

As everywhere, the leak you write yourself is the one to watch. A set of every post the bot has replied to belongs in SQLite on your 512 MB of disk, not in memory.

FAQ

Questions

How do I save the session between restarts?

The atproto client can export its session as a string and log in from one. Write the export to a file whenever it changes, and try it before a fresh login at start-up. That keeps a crash loop from locking the account out of logging in.

Sync or async client?

Sync for a posting bot or a simple reply loop. Async when the bot also listens to Jetstream or does other network work at the same time, so one slow request does not stall the rest.

Can it post images?

Yes. Upload the image as a blob, then attach it to the post. Delete temporary files afterwards so a busy bot does not slowly fill its 512 MB of disk.

Do I need a virtual environment?

No. Everything in requirements.txt is installed for you on deploy.