An enterprise-grade, asynchronous AI agent orchestration platform built from scratch. This system allows users to programmatically register autonomous AI agents with customized granular configurations (personalities, models, memory behavior, and execution limitations) and assemble them sequentially into collaborative multi-agent workflow pipelines.
The platform provides dual consumer access points: a high-utility management dashboard for visual analytics and an external messaging channel interface via a Telegram Bot.
The platform implements a clean, decoupled, multi-tier architecture separating the Presentation layer, Business Logic layer, and Data Storage layer to ensure vertical scalability and non-blocking runtime properties.
[ User Interfaces ] [ Backend Core Engine ] [ Storage Layer ]
βββββββββββββββββββββ βββββββββββββββββββββββββ βββββββββββββββββββ
β Streamlit Admin ββββββββββΊβ FastAPI Router EnginesββββββββββΊβ SQLAlchemy ORM β
β Dashboard β SSE β (Async Request Pool) β β Data Mapping β
βββββββββββββββββββββ βββββββββββββ¬ββββββββββββ ββββββββββ¬βββββββββ
β β
βββββββββββββββββββββ βΌ βΌ
β Telegram Channel βββββββββββββββββββββββ΄ββββββββββββββββββββββββββββββΊβ SQLite Database β
β Bot Interface β Webhook β (platform.db) β
βββββββββββββββββββββ βββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββ
β LangGraph Orchestratorβ
β (Dynamic StateGraph) β
βββββββββββββ¬ββββββββββββ
β
βΌ
βββββββββββββββββββββββββ
β OpenAI GPT-4o Engine β
βββββββββββββββββββββββββ
- Configuration: Admin profiles and linear step pipelines are defined via the Streamlit interface and securely stored as stringified state maps inside SQLite.
- Ingress Call: An execution trigger arrives via an HTTP stream call or a Telegram Bot webhook.
- Graph Assembly: The FastAPI engine intercepts the call, fetches the assigned configuration sequence from the database, and feeds it into a Dynamic LangGraph Graph Factory.
- Stateful Execution: LangGraph provisions a stateful thread model wrapper that compiles nodes programmatically. Each node references a distinct database agent prompt.
- Real-Time Streaming: As the agents process their tasks sequentially, telemetry events and word chunks are pulled out using LangGraph's
astream_eventsprotocol and pushed to the UI via a persistent Server-Sent Events (SSE) channel.
| Architectural Layer | Selected Technology |
|---|---|
| Backend API Engine | FastAPI (Python 3.11) |
| Orchestration Runtime | LangGraph (LangChain Ecosystem) |
| User Interface Portal | Streamlit |
| Database Core | SQLite + SQLAlchemy ORM |
| External Channel Wrapper | Telegram Bot API Wrapper |
| Real-Time Log Streamer | Server-Sent Events (sse-starlette) |
| Deployment Standard | Docker & Docker Compose |
- The Choice: LangGraph was selected as the AI execution engine.
- The Reason: Frameworks like CrewAI rely heavily on black-box, unpredictable agent behaviors. LangGraph models multi-agent interactions explicitly as state machines (graphs, nodes, and edges). This provides deterministic control over execution ordering, predictable memory management via persistent state schemas, and native asynchronous streaming support (
astream_events), which is required for enterprise logs.
- The Choice: Streamlit was prioritized for the management portal interface.
- The Reason: While React Flow provides interactive canvas features, it introduces heavy frontend dependencies, state synchronization boilerplate across WebSockets, and slow development cycles. Streamlit allows for building a data-dense configuration dashboard using pure Python. This allowed development time to be reallocated toward refining the core AI orchestrator, ensuring memory isolation, and implementing execution limits.
- The Choice: HTTP Server-Sent Events (SSE) via
sse-starlette. - The Reason: WebSockets require complex bidirectional handshake management, state tracking, and are prone to disconnecting through corporate firewalls. Because agent telemetry logs and token streams are strictly unidirectional (Backend (\rightarrow) Frontend), SSE is the most efficient choice. It operates over standard HTTP, includes automatic reconnection out of the box, and keeps resource consumption minimal.
- The Choice: Local SQLite running in Write-Ahead Logging (WAL) mode.
- The Reason: SQLite eliminates the need to run an external database container during early testing, keeping deployment fast and single-command simple. By using SQLAlchemy ORM, the database access code remains completely independent of the underlying engine. If needed, the entire data layer can be migrated to production PostgreSQL by modifying a single line in the configuration string (
DATABASE_URL).
The platform is fully containerized to run smoothly on any machine with zero local dependency management.
- Ensure Docker Desktop is installed and running on your laptop.
Create a file named .env in the root directory of the project and paste your credentials:
OPENAI_API_KEY=your_actual_openai_api_key_here
TELEGRAM_BOT_TOKEN=your_official_telegram_bot_token_hereOpen your Windows PowerShell or local terminal inside the project root and run:
docker compose up --buildDocker will automatically create an isolated network bridge, build the backend engine and frontend dashboard images, map your database persistence paths, and spin up both layers simultaneously.
- FastAPI Backend (Swagger Docs): http://localhost:8000/docs
- Streamlit Admin Management Dashboard: http://localhost:8501
- Open the Admin Dashboard at
http://localhost:8501and navigate to the π§βπ» Agent Admin Registry tab. - Fill out the configuration fields:
- Agent Name:
Triage Analyst - System Base Instructions:
Extract the core technical problem from this message. Output as a short summary. - Personality:
Highly professional, cold, and factual. - Memory: Check the box to enable memory.
- Max Generation Tokens Limit:
1500
- Agent Name:
- Click Deploy Agent Blueprint.
- Repeat this step to register a second agent named
Resolution Expert(System Instructions:Take the technical summary and draft an email solution assuming the server will reboot in 20 minutes.).
- Navigate to the βοΈ Sequential Workflow Builder tab.
- In the form field, type a unique matching pipeline name identifier:
server_escalation. - Map the order of operations:
- Set Sequence Step Index to
1and selectTriage Analystfrom the dropdown. Click Link Step. - Set Sequence Step Index to
2and selectResolution Expertfrom the dropdown. Click Link Step.
- Set Sequence Step Index to
- View your updated execution path in the right-hand panel to confirm the pipeline is wired correctly (
Step 1 βββΊ Step 2).
- Move over to the πΊ Live Log Console Monitor tab.
- Enter the target pipeline profile name to run:
server_escalation. - Provide an inbound trigger prompt: "Our core API production cluster crashed at 3 AM due to a database out-of-memory lock error!"
- Click Fire Pipeline & Stream Output Link.
- Watch the real-time logs stream in: The dashboard will display info alerts as the pipeline wakes up, print execution events as the runtime transitions between nodes, and render text responses token-by-token.
- Open your Telegram application and start a conversation with your registered bot.
- Type the platform runtime command syntax to trigger your pipeline remotely:
/run server_escalation The database is locked and everything is slow! - Your bot will send an immediate response confirming the task has started, pass processing duties across your database agents in the background, and message you the final response directly inside the chat window.
Link: https://drive.google.com/file/d/1Mo7J7j1Lcfd7Rkge06SySz1BuaoK5AKb/view?usp=drive_link