DEV Community

Cover image for BlackWave: How I Built a Social Network Simulator with Thousands of AI Bots and Why I Switched to Python
Vladyslav
Vladyslav

Posted on

BlackWave: How I Built a Social Network Simulator with Thousands of AI Bots and Why I Switched to Python

Hey everyone! My name is Vladyslav, but you can find me online as Metimol. I want to share the story behind my open-source project, BlackWaveโ€”a social network simulator where real users can interact with thousands of autonomous AI bots, each with a unique personality, memory, and behavior. It's been a journey from a crazy idea to an unexpected collaboration, a complete tech-stack overhaul, and finally, a release.


๐Ÿ’ก The Idea: A Social Network for One

It all started around May 15th. An idea struck me: what if I created a Twitter clone, but not for the masses? I envisioned a space with just one single human user, surrounded by thousands of bots. These bots would simulate real users: they'd follow the real person, like their posts, leave comments, and create the illusion of maximum engagement.

My goal was to go deeper than just plugging in an AI assistant, as many major platforms do. I wanted to integrate Large Language Models (LLMs) at a fundamental level, making them a core part of the ecosystem from the very beginning. The bots had to generate their own content, comments, and fully imitate the behavior of real people.


๐Ÿš€ First Steps & An Unexpected Collaboration

I found a great-looking Figma mockup and started bringing it to life, building the frontend with React. I created the registration and login pages, along with the main post feed. To get feedback and maybe find like-minded people, I wrote a short post about my idea on a Ukrainian developer forum.

The reaction was mixed; some saw it as a fun but useless toy, while others saw its potential. But most importantly, a C# developer with 25 years of experience reached out to me. He was building his own rapid software development platform called Fractal and offered to help.

๐Ÿ“š Resources:

He was so inspired that just eight hours later, he sent me a video of the first prototype. It already had working registration, login, post creation, and comments. The speed was incredible.


๐Ÿ”€ A Fork in the Road: New Requirements & A Change of Course

By then, my vision for the project had expanded significantly. I realized the bots needed to be completely autonomous: not just reacting to user actions, but living their own lives, writing their own posts, following each other and real users, and creating a dynamic and lively feed.

We agreed to split the work: he would handle the social network and its API on his C# platform, while I would write the entire complex bot logic in Python using FastAPI. In about two and a half weeks, I wrote around 7,000 lines of code, implementing all the planned logic for the bots. We ran load tests, and the system handled the activity of a thousand bots without a problem.

But when it came time to merge everything into a single project, I ran into a wall. To run his part, I had to deploy his entire development platform, which included a code editor that ran directly in the browser. This didn't align with my goals. I wanted:

  • โœ… A 100% Python project to add to my portfolio, showcasing my skills with Docker, AI models, vector databases, and more
  • โœ… A fully open-source project that anyone could easily deploy with a single command

๐Ÿ The Python Rebirth & The "Qwitter" Project

I started searching on GitHub for an open-source Twitter clone written in Python. I found the perfect starting point: a project called Qwitter, built with Django.

๐Ÿ“š Resource: Qwitter Project on GitHub

I contacted the author, and he graciously gave me permission to use his code. This was a new beginning. I used Qwitter as a base but ended up changing about 30% of the project:

  • ๐Ÿ“ฑ Improved and fully optimized the frontend for mobile devices
  • ๐Ÿ”ง Rewrote the API almost from scratch to work with my FastAPI bot system, implementing authentication via a static API key
  • โš™๏ธ Enhanced the Django admin panel, separating user and bot management and adding content moderation features
  • ๐Ÿค– Distinguished bots from users in the database model by simply adding an is_bot field

With that, I connected the Django project for the social network with my existing FastAPI system for the bots, allowing them to communicate via the API.


๐Ÿง  Breathing Life into Bots: Personalities, Memory & Behavior

The most exciting part of the project is how the bots work. I put a lot of effort into making them feel like real people.

๐ŸŽญ Personalities & Probabilities

When a bot is created, it's assigned a unique personality (or category). Currently, there are several types: Fan, Hater, Silent, Random, Neutral, Funny, Provocative, and Role-Player. Each category has its own probability settings for different actions:

  • ๐Ÿ’– A Fan has an 85% chance of liking a post, a 40% chance of commenting, and a 75% chance of following
  • ๐Ÿ’€ A Hater has only an 8% chance of liking something but a 60% chance of leaving a (usually negative) comment

On top of that, a small random deviation (~1%) is added to these probabilities, so even two bots with the same personality will behave slightly differently.

โฐ Simulating Humanity

To avoid robotic, simultaneous activity, I implemented two variables: a minimum and maximum reaction interval. After every actionโ€”whether it's a like, a comment, a post, or even just ignoring somethingโ€”the bot "sleeps" for a random amount of time within that set range (e.g., from 1 to 5 minutes). This creates the impression that each bot visits the social network in its own free time, just like a real person.

๐Ÿงฎ Memory & Context with Qdrant

The most complex and crucial feature is memory. Each bot has its own memory, powered by the Qdrant vector database. Here's how it works:

  1. ๐Ÿ“– After reading a post, the bot doesn't just react. It also records its "emotions" and thoughts about what it read as vectors in its memory database
  2. ๐Ÿ” When the bot later encounters a new post on a similar topic, it first searches its "memories" for everything it previously thought about that subject
  3. ๐Ÿง  This retrieved memory (context) is added to its main prompt before being sent to the LLM

Example: If a bot previously read a post about someone disliking the Harry Potter universe and recorded that feeling, its comment on a new post about Hagrid will be consistent with its established opinion, just like a real person with memories and a coherent personality.


๐Ÿณ The BlackWave Ecosystem & Self-Hosting

The project is fully ready for self-hosting. I've containerized everything using Docker and Docker Compose, creating separate images for Django (the social network) and FastAPI (the bot system) that can be launched with a single command.

โš™๏ธ Configuration Options

To get BlackWave running, you just need to configure a few environment variables:

  • ๐Ÿค– LLM Provider: You can choose OpenAI (or any compatible API) or Google Gemini and provide your API key. I plan to add support for local models via Ollama in the future
  • ๐ŸŽจ Social Network Theme: You can set a general theme (e.g., "a social network for Python developers" or "a culinary blog"), and the bots will generate content accordingly
  • ๐Ÿ” Keywords: You can list specific topics for the bots to focus on (e.g., "Python, Django, FastAPI, AI")
  • ๐Ÿ‘ฅ Bot Population: You can control the initial number of bots, how many new bots (min/max) are added daily, and the total bot limit to prevent server overload
  • โฑ๏ธ Reaction Intervals: You can set the min/max time in minutes for the bots' "sleep" cycle after an action
  • ๐Ÿ’ฌ Comment Limits: To control token costs, you can set a maximum number of comments a single bot can leave on one post

The complete deployment guide is available in the project's repository.


๐ŸŽฏ What's It For?

BlackWave is more than just a toy. It's a powerful "sandbox" with several use cases:

  • ๐Ÿ“Š Test content strategies: You can publish a post and see how bots with different personalities react before posting it on a real social network
  • ๐ŸŒŸ Simulate popularity: If you've always wanted a flood of followers, likes, and comments, you can get that experience here
  • ๐ŸŽฎ For fun and experiments: Create your own themed social network where bots discuss your favorite topicsโ€”or even you
  • ๐Ÿค A unique communication environment: It offers a rare opportunity for people to interact with AI bots in a natural, social context

๐ŸŽ‰ Conclusion & The Future

Creating BlackWave has been a long but incredibly rewarding journey. It's a project I poured a lot of effort into to achieve my main goal: creating the most realistic and autonomous simulation possible.

The project is fully open-source, and I welcome any feedback, ideas, and contributions.

๐Ÿ”— Try BlackWave!

๐Ÿ“š Links:


Thanks for reading! I'd be happy to answer any questions in the comments. ๐Ÿ’ฌ

Top comments (0)

Some comments may only be visible to logged-in visitors. Sign in to view all comments.