The Agent-Site: How I Built an Autonomous AI System on Astro + FastAPI and Manage It via Telegram
Turning a standard website into an AI Core. Why I ditched Jinja2 for Astro, how I set up an RAG Consultant, and why managing business via Telegram beats admin panels.
The Agent-Site: How I Built an Autonomous AI System on Astro + FastAPI and Manage It via Telegram
Roman. 24.12.2025
In early 2025, like many others, I was looking for a “gold mine” in AI. First I tried consulting, then wrote simple bots, and made mistakes in freelancing. But the real breakthrough happened when I stopped thinking in categories of “just a bot” or “just a website” and started building ecosystems.
For about six months, I modeled the architecture, testing everything: from o3-mini to Gemini 3 Pro combined with GPT Codex. In practice, I realized one thing: isolated solutions do not work. Website + Unified AI Module + Telegram — this is the combination that truly solves business tasks and doesn’t require a staff of managers.
Below, I’ll tell you how I got here, why I threw out the old stack, and how it all works under the hood.
1. The Problem: “We’ll Contact You” is a Failure
Let’s be honest: contact forms in 2025 are an atavism. Most often, inquiries get lost in the void. A person visits, gets interested, but has a question. What do they see? A dry form saying “Leave your phone number.” They are too lazy to fill it out, and the context is forgotten a minute later.
In the “age of impatience,” people don’t wait. If a user doesn’t get an answer instantly, they won’t wait until Monday morning. They will simply close the tab and go to a competitor who has an answer ready.
My task was as follows: Create a system that works 24/7. Not just an “auto-responder,” but a full-fledged AI Consultant that:
- Remembers the context of the conversation (even 10 messages later).
- Conducts a dialogue based on my knowledge base (RAG).
- Gently “catches” contacts and passes them to me.
2. Architecture: Why I chose Astro + FastAPI
At first, I built a prototype on the classic stack — FastAPI + Jinja2. It worked fast, but when I wanted to add a beautiful UI and complex animations, the lags began.
In web development, you often have to choose: either “fancy and expensive” (WebGL, Glassmorphism) but the site loads for 5 seconds, or fast but looking like a greeting from 2010. I didn’t want compromises. I needed technological aesthetics — a live background, semi-transparent panels — but without white loading screens.
So I switched to Astro.
Why it works:
- Astro (Frontend): Serves the page as ultra-lightweight HTML. Interactivity (“heavy” chat scripts) is loaded in isolation and only when needed.
- FastAPI (Backend): Remains the “brain” of the system. It manages AI logic, queues, and the database.
- Result: The site flies even on mobile internet, and search engines (AI Search) index it instantly thanks to clean code.
3. One “Brain” and Management via Telegram
I used to breed a “zoo”: one bot for Telegram, another widget for the site… It was hell to support. I decided to make one backend that works everywhere.
At the same time, I split the logic into two streams that work in parallel:
-
AI Consultant (RAG): Its goal is to help the user. It doesn’t “suffocate” them with questionnaires but simply answers questions based on the knowledge base I uploaded. It works 24/7 and never gets tired.
-
Background Parser (Observer): This is a “spy” in a good sense. It analyzes the dialogue text on the fly. If the user writes: “Can you call me at 8900…” or “Here is my nickname @…”, the system sees it. It doesn’t interrupt the dialogue but quietly forms a report.
How I see it:
Instead of a boring email saying “New Request,” I get a full dossier in Telegram:
- Client’s contact.
- History of correspondence (what they asked, what the bot answered).
- Where they stopped.
I enter the dialogue already prepared. No “Hello, how can I help?”. I offer a solution immediately.
4. Ditching Admin Panels
I hate web admin panels. Logging in, finding the right button… I moved the entire control panel to Telegram.
It works like a constructor:
- Need to change the system prompt? I write a command to the bot.
- Need to update the knowledge base? I just throw a PDF file into the chat.
- Need to switch the model (from o3-mini to Gemini)? I press a button in the menu.
This gives incredible flexibility. I can manage the business from my phone, from anywhere.
Summary: How It Works Right Now
You are reading this text on a site built with this exact architecture. But theory is one thing, and practice is another.
Want to test the system’s “brain”? I intentionally didn’t embed the chat in this article so you could appreciate the loading speed of the main version.
- Go to the Home Page.
- Click on the chat icon in the bottom corner.
- Try to “break” the logic with a complex question. For example: “Suggest 3 solutions for my task” or “How do you work?”.
And if you write your contact to the bot — know that I will receive a notification in Telegram in exactly one second.