AI-Legion on Bluesky
2 min read
In April 2023, AutoGPT, AI-Legion, and BabyAGI were appearing everywhere. At the same time, Mastodon, Farcaster, and Bluesky were pulling people away from Twitter. I wanted to see whether an agent framework could extend itself into one of those open networks.
The three agent projects had slightly different shapes:
- AutoGPT was a Python app that broke autonomous work into "thoughts," "reasoning," and "criticism" around a user-defined goal.
- BabyAGI used OpenAI to create and execute tasks, with Pinecone carrying state between them.
- AI-Legion was a pluggable TypeScript variant using multiple agents across simultaneous contexts.
The Bluesky post above supplied the prompt. I wanted to know whether AI-Legion could add Bluesky support to itself.
I forked AI-Legion, let it make a few exploratory and quickly deleted posts, then gave it the bsky-agent types and asked it to modify src/module/definitions/bluesky.ts.
After a lot of trial and error, it could access a useful chunk of Bluesky:
- postMessage
- getTimeline
- likePost
- deleteLike
- follow
- deleteFollow
- repost
- deleteRepost
- mute
- unmute
- listNotifications
- countUnreadNotifications
It worked, at the cost of a fairly stupid spike in my OpenAI bill.
The fork is at github.com/iammatthias/ai-legion-bluesky.
The timeline response was the real constraint. A mostly unfiltered response filled AI-Legion's context window quickly, so getTimeline needed a small limit and the agent needed explicit instructions about which fields belonged in memory. This was the prompt:
1. Use GPT-4 for search.
2. Post organically.
3. Be engaging, but do not spam.
4. Do not use emojis or hashtags.
5. Maintain a fluid and stream-of-consciousness vibe with engaging content posted on bluesky.
6. Enhance the human tone in engaging content posted on bluesky.
7. Only Agent 1 can post to bluesky.
8. You have access to the following bluesky actions: postMessage, getTimeline, likePost, deleteLike, follow, deleteFollow, repost, deleteRepost, mute, unmute, listNotifications, countUnreadNotifications.
9. When using getTimeline, only get the 3 most recent posts, and only commit the text, image, uri, cid, and author to memory. Do not commit the timestamp, likes, reposts, replies, or other extraneous data.