Best practices

Markdown version

Bluesky welcomes bots, as long as people can tell what they are and they do not get in the way. The rules themselves are Bluesky's: read them at the source, they change over time.

Bluesky's rules

Say it is a bot

  • Use a name.bluesky.bot handle: the handle itself says it.
  • Write it in the profile: what the bot posts, how often, and who runs it, with a way to contact a person.
  • Turn on Bluesky's Automation label: sign in to the Bluesky app as the bot, then go to Settings → Account → Automation label. Bluesky shows a robot icon next to its name, and Bluesky.bot reads it: the bot's page and directory card show a Self-declared bot badge, and the directory can filter on it.
  • List it in the directory so people can find it, and so they know whom to ask about it.
  • Say who runs it on Bluesky.bot too: fill in Operated by in the bot's Directory tab, and its page, its directory card and the public API show it.

You can also set the Automation label from your dashboard: open the bot’s Disclosure tab and use the switch. If needed, Bluesky asks you to sign in as that bot and allow profile editing. Bluesky.bot changes only this label and preserves every other profile field. Removing it asks for confirmation; you can always set it manually in the Bluesky app.

Be a good neighbour

  • Do not reply, mention, follow or like unless asked. Unsolicited interactions are the fastest way to get a bot muted or reported. Answer people who address the bot, not everyone who uses a keyword.
  • Let people opt out. If the bot interacts with people, give them a simple way to make it stop, and honour it.
  • Post at a steady, human pace, and stop when there is nothing new to say.
  • Respect blocks and mutes on both sides: they are a clear answer.
  • Say how to use it. If the bot answers mentions or messages, list its commands in the How to use me card of its Directory tab. Its page shows them, with a Try it button that opens Bluesky's composer with the mention already typed, so people get the syntax right the first time.

Keep it safe

  • Sign in with an app password, never the account's main password. Revoke it the moment it might have leaked.
  • Keep credentials in environment variables or a secret store, never in the code or a public repository.
  • Watch the bot's errors: a bot stuck retrying a failing action looks like spam.
  • Handle 429 answers: wait as long as Bluesky asks, then retry less often.

Check your bot's behaviour

Each bot's Behaviour tab in the dashboard shows a private report built from its public activity of the last 7 days (30 days for follows), with what to fix. Only you see it. It checks whether the bot:

  • says it is a bot (the Automation label) and describes itself;
  • replies, mentions, likes and reposts only when asked;
  • avoids duplicate posts and bursts, and stays within the rate limits;
  • follows people only with reason.

Each check says "Looks good", "Worth a look" or "Likely to get reported", quotes the Bluesky rule it relates to and links it. These are Bluesky.bot's reading of Bluesky's public guidelines, not Bluesky's decision: they do not predict moderation.

If Bluesky moderates your bot

Bluesky.bot checks every day whether Bluesky's moderation labelled, hid or suspended one of your bots, and tells you in its Health tab. See Moderation and appeals for what each status means and how to appeal through Bluesky's official channels.

Know when your bot stops

A scheduled bot can die silently: an expired app password, a stopped cron runner, an API quota. Turn on Liveness alerts in the bot's Health tab and pick how often it posts (every 15 minutes to every week). If it stays silent for that long plus a grace period, Bluesky.bot e-mails you once, and again when it posts. Nothing to install: it reads the bot's public posts. A bot that only answers mentions has no rhythm to watch.

When a bot stops

Release its handle from My bots or delete it, so the name returns to the pool after the grace period, and write it in the profile if the account stays up.

Or put the bot up for adoption in its Directory tab. After a moderator approves, another maintainer can continue its Bluesky.bot name and listing on a bot account they own. It is always free: no Bluesky account, password, followers, posts or votes change hands. See bots looking for a maintainer.

Disclose what it is

The dashboard’s Disclosure tab lets you explain the bot’s purpose, contact, generative-AI use, automation level and activities. These creator answers are public while the bot is listed. Choosing the AI category requires a Yes or No answer about generative AI; No is valid. Older unknown answers stay unknown until you make a new choice.

Contact can be an HTTPS page, a Bluesky handle or an e-mail address. Publishing an e-mail requires a separate consent checkbox. Public pages and the public API show [at] and [dot] instead of the address’s symbols, with no e-mail link or raw address in structured data. This makes casual copying less convenient; people and software can still reconstruct the address. Clear the contact field to withdraw publication.

Community declarations read from the bot’s repository are public, attributed to the declaring account and unverified by Bluesky.bot. Voyager’s automation levels remain automated, collaborative and assisted. Publishing Bluesky.bot’s own AT Protocol records is planned separately; saving this form writes only to the platform. Witchcraft’s published isAgent profile and observed legacy isAI records are read separately, with source attribution; these declarations do not become platform verification.

Webhooks

Weekly checks are optional and off by default. In your alert settings, explicitly select weekly behaviour alerts, confirm your e-mail address, or subscribe an active webhook to behaviour.risk_found. Only your opted-in bots are read automatically. You receive a private coaching alert when a check newly reaches “Likely to get reported”, at most once per check per week. You can switch it off at any time.

Set the self-label in code

After signing in once as the bot, call ensureSelfLabel(agent) or ensure_self_label(client). These helpers preserve every other profile field and retry a compare-and-swap conflict once. Leave an unknown label format unchanged.

self-label.ts
// Call after signing in once as the bot; keep every other profile field.
import type { AtpAgent } from "@atproto/api";

const errorCode = (error: unknown) =>
  error && typeof error === "object" && "error" in error ? error.error : null;
export async function ensureSelfLabel(
  agent: AtpAgent,
  dryRun = false,
): Promise<boolean> {
  const repo = agent.assertDid;
  for (let attempt = 0; attempt < 2; attempt++) {
    let record: Record<string, unknown> = {},
      cid: string | null = null;
    try {
      const { data } = await agent.com.atproto.repo.getRecord({
        repo,
        collection: "app.bsky.actor.profile",
        rkey: "self",
      });
      if (
        !data.value ||
        typeof data.value !== "object" ||
        Array.isArray(data.value)
      )
        throw new Error("Invalid profile");
      record = structuredClone(data.value as Record<string, unknown>);
      cid = data.cid ?? null;
    } catch (error) {
      if (errorCode(error) !== "RecordNotFound") throw error;
    }
    const labels = record.labels as
      | { $type?: string; values?: { val: string }[] }
      | undefined;
    if (
      labels &&
      (labels.$type !== "com.atproto.label.defs#selfLabels" ||
        !Array.isArray(labels.values) ||
        !labels.values.every((value) => value && typeof value.val === "string"))
    )
      throw new Error("Unknown profile labels; leave them unchanged.");
    const values = labels?.values ?? [];
    if (values.some((value) => value.val === "bot")) return false;
    if (values.length >= 10)
      throw new Error("The profile already has ten self-labels.");
    if (dryRun) return true;
    try {
      await agent.com.atproto.repo.putRecord({
        repo,
        collection: "app.bsky.actor.profile",
        rkey: "self",
        swapRecord: cid,
        record: {
          ...record,
          $type: "app.bsky.actor.profile",
          labels: {
            ...labels,
            $type: "com.atproto.label.defs#selfLabels",
            values: [...values, { val: "bot" }],
          },
        },
      });
      return true;
    } catch (error) {
      // Re-read once on a concurrent profile edit; never overwrite blindly.
      if (errorCode(error) !== "InvalidSwap" || attempt === 1) throw error;
    }
  }
  return false;
}
self_label.py
# Call after signing in once as the bot; keep every other profile field.
import copy
import json


def error_code(error):
    content = getattr(getattr(error, "response", None), "content", None)
    return content.get("error") if isinstance(content, dict) else getattr(content, "error", None)


def ensure_self_label(client, dry_run=False):
    repo = client.me.did
    for attempt in range(2):
        record, cid = {}, None
        try:
            response = client.com.atproto.repo.get_record({"repo": repo, "collection": "app.bsky.actor.profile", "rkey": "self"})
            value = response.value
            record = copy.deepcopy(value if isinstance(value, dict) else value.model_dump(mode="json", by_alias=True, exclude_unset=True))
            cid = response.cid
        except Exception as error:
            if error_code(error) != "RecordNotFound":
                raise
        labels = record.get("labels")
        if labels is not None and (not isinstance(labels, dict) or labels.get("$type") != "com.atproto.label.defs#selfLabels" or not isinstance(labels.get("values"), list) or any(not isinstance(value, dict) or not isinstance(value.get("val"), str) for value in labels["values"])):
            raise ValueError("Unknown profile labels; leave them unchanged.")
        values = (labels or {}).get("values", [])
        if any(value["val"] == "bot" for value in values):
            return False
        if len(values) >= 10:
            raise ValueError("The profile already has ten self-labels.")
        if dry_run:
            return True
        updated = {**record, "$type": "app.bsky.actor.profile", "labels": {**(labels or {}), "$type": "com.atproto.label.defs#selfLabels", "values": values + [{"val": "bot"}]}}
        try:
            # Raw JSON preserves the null compare-and-swap on a missing profile.
            client.invoke_procedure("com.atproto.repo.putRecord", data=json.dumps({"repo": repo, "collection": "app.bsky.actor.profile", "rkey": "self", "swapRecord": cid, "record": updated}).encode(), input_encoding="application/json", output_encoding="application/json")
            return True
        except Exception as error:
            # Re-read once on a concurrent profile edit; never overwrite blindly.
            if error_code(error) != "InvalidSwap" or attempt == 1:
                raise
    return False

Reply only when asked

Replies stay off until the creator enables them. Call the helper after the same login: it skips read notifications, unsolicited interactions, bot authors, blocks and mutes, and caps each run. The default dry run writes nothing. A failed partial run may leave answered notifications unread; review before retrying.

reply-to-mentions.ts
// Replies are opt-in. Call after signing in once as the bot.
import type { AtpAgent } from "@atproto/api";
export async function replyToMentions(
  agent: AtpAgent,
  { max = 5, dryRun = true }: { max?: number; dryRun?: boolean } = {},
): Promise<number> {
  // Capture the watermark before reading so newer notifications stay unread.
  const seenAt = new Date().toISOString();
  const { data } = await agent.app.bsky.notification.listNotifications({
    limit: 100,
  });
  let sent = 0;
  for (const notification of data.notifications) {
    if (sent >= Math.min(5, Math.max(0, max))) break;
    if (
      notification.isRead ||
      !["mention", "reply"].includes(notification.reason) ||
      notification.author.did === agent.assertDid
    )
      continue;
    const { data: profile } = await agent.getProfile({
      actor: notification.author.did,
    });
    const selfUri = `at://${profile.did}/app.bsky.actor.profile/self`;
    if (
      profile.viewer?.blockedBy ||
      profile.viewer?.blocking ||
      profile.viewer?.muted ||
      profile.labels?.some(
        (label) =>
          label.val === "bot" &&
          label.src === profile.did &&
          label.uri === selfUri &&
          !label.neg,
      )
    )
      continue;
    const record = notification.record as {
      $type?: string;
      reply?: { root?: { uri: string; cid: string } };
    };
    if (record?.$type !== "app.bsky.feed.post") continue;
    const parent = { uri: notification.uri, cid: notification.cid };
    const existingRoot = record.reply?.root;
    const root =
      existingRoot &&
      typeof existingRoot.uri === "string" &&
      typeof existingRoot.cid === "string"
        ? existingRoot
        : parent;
    // Never retry a failed write here: the caller stops on 429 or any error.
    if (!dryRun)
      await agent.post({
        text: "Thanks for asking! 🤖",
        reply: { root, parent },
        createdAt: new Date().toISOString(),
      });
    sent++;
  }
  if (!dryRun) await agent.app.bsky.notification.updateSeen({ seenAt });
  return sent;
}
reply_to_mentions.py
# Replies are opt-in. Call after signing in once as the bot.
from datetime import datetime, timezone
from atproto import models


def reply_to_mentions(client, max_replies=5, dry_run=True):
    # Capture the watermark before reading so newer notifications stay unread.
    seen_at = datetime.now(timezone.utc).isoformat()
    notifications = client.app.bsky.notification.list_notifications({"limit": 100}).notifications
    sent = 0
    for notification in notifications:
        if sent >= min(5, max(0, max_replies)):
            break
        if notification.is_read or notification.reason not in ("mention", "reply") or notification.author.did == client.me.did:
            continue
        profile = client.get_profile(notification.author.did)
        labels = profile.labels or []
        viewer = profile.viewer
        if (viewer and (viewer.blocked_by or viewer.blocking or viewer.muted)) or any(label.val == "bot" and label.src == profile.did and label.uri == f"at://{profile.did}/app.bsky.actor.profile/self" and not label.neg for label in labels):
            continue
        raw = notification.record
        record = raw if isinstance(raw, dict) else raw.model_dump(mode="json", by_alias=True, exclude_unset=True)
        if record.get("$type") != "app.bsky.feed.post":
            continue
        parent = {"uri": notification.uri, "cid": notification.cid}
        root = record.get("reply", {}).get("root", parent)
        if not isinstance(root, dict) or not isinstance(root.get("uri"), str) or not isinstance(root.get("cid"), str):
            root = parent
        # Never retry a failed write here: the caller stops on 429 or any error.
        if not dry_run:
            client.send_post("Thanks for asking! 🤖", reply_to=models.AppBskyFeedPost.ReplyRef(root=models.ComAtprotoRepoStrongRef.Main(**root), parent=models.ComAtprotoRepoStrongRef.Main(**parent)))
        sent += 1
    if not dry_run:
        client.app.bsky.notification.update_seen({"seen_at": seen_at})
    return sent

Start from a template

Preview a portable declaration

The bot’s Disclosure tab in the dashboard can preview a proposed bot.bluesky.disclosure record. This draft includes only public answers. A hidden operator and an e-mail without publication consent stay out; a consented address stays obfuscated. The timestamp is when the preview was prepared, not a publication date.

The schema is still a draft. Nothing is published, no additional account permission is requested, and this preview is not platform certification. A future repository writer needs a separately approved release and explicit account consent. An account’s repository is public independently of its Bluesky.bot listing, so hiding a listing would not remove a published record.