MVP Agente
Multi-agent orchestrator in Python with a REST API, Telegram and Discord bots, short- and long-term memory, and LLM provider switching without changing the agents.
- Context and goal
- An assistant that works over Telegram, Discord, the terminal and a REST API, with persisted history, a relational database and a tool catalog (search, email, image and audio forensics).
- Problem
- Bring multiple channels and multiple LLM providers into a single core, without coupling the agents to any one provider, while keeping per-user memory across restarts.
- Technologies
- pythonfastapipydanticsqlalchemypostgresqlchromadbmemcachedjwtdockerpytestreacttypescript
Architecture
- telegram · discord · api
- manager
- planner
- executor
- tools registry
- llm strategy
- postgres · chromadb
Agents
Manager handles the conversation and orchestrates; Planner builds an action plan (JSON pipeline) from the tool catalog; Executor runs the specified functions.
Channels
Discord bot; Telegram webhook and a chat REST API via FastAPI, with JWT authentication.
LLMs (Strategy)
OpenAI, Anthropic, Google Gemini and Ollama (local models) behind the same interface.
Memory
Short-term in PostgreSQL (reloaded after a restart); long-term with RAG in ChromaDB, filtered per user; caching in Memcached.
Tools
Registry with auto-discovery: web search, SMTP and notifications with an allowlist of recipients, Fernet encryption, image processing and audio analysis.
Technical decisions
And the trade-off behind each one.
- Strategy pattern for LLMs: switching providers doesn't change the agents.
- Dependency injection between agents, and a tool registry with auto-discovery.
- Embeddings generated locally by ChromaDB (all-MiniLM-L6-v2), so they work with any LLM.
- ChromaDB and Memcached are optional: if they're down, the agent continues with recent history only.
- Memcached deduplicates Telegram webhooks and stores the detected intent for 1 hour, saving LLM calls.
- Email and notification tools restricted to explicitly allowed recipients.
Challenges faced
What were the hard problems? What didn't work on the first try?
Results achieved
Measured results (time, cost, users, lessons learned). Prefer numbers.