How I built a 14-command Telegram AI agent with image generation, live web research, and 8 autonomous sub-agents — without paying for hosting, a database, or compute.
Ultimate AI Agent is a multi-agent AI system I built that runs entirely through Telegram — no dashboard needed day to day — and it costs me zero rupees a month to keep running.
I'm a diploma CS student, self-taught mostly through docs and just breaking things until they work. I wanted to see how far I could push a real AI system without spending a rupee on hosting. This is what I ended up with.
14+ Telegram commands, and it remembers recent conversation context instead of treating every message as a one-off
Image generation — FLUX as the primary model, with Pollinations AI as a fallback so a single API going down doesn't kill the feature
Live web research pulled in through Tavily and Jina
Cross-session memory running on Cloudflare KV
8 sub-agents running on autopilot via scheduled GitHub Actions — things like daily news briefings and YouTube trend reports, no manual trigger needed
Cloudflare Workers, GitHub Actions, Node.js, the Telegram Bot API, D1, and Cloudflare KV. That's it. No paid database, no paid compute, no paid queue.
Everyone assumes the hard part of running an AI agent for free is compute. It's not. It's that every free-tier LLM API has a rate limit, and you'll hit it faster than you expect once the agent is actually being used.
The fix was chaining providers instead of relying on one: Mistral → Cerebras → Groq → OpenRouter → Gemini. If one gets rate-limited or errors out, the request just falls through to the next one in the chain. The agent never goes down — it just gets slightly slower on a bad day.
Same logic applies to image generation: FLUX 1 Schnell first, Pollinations AI as the fallback.
Cloudflare KV and D1 together handle almost everything you'd normally reach for a paid database for — if you're deliberate about how you structure reads and writes. KV holds a 5-minute conversation memory window so the bot has short-term context without needing a full session store. D1 handles logging and command history for the dashboard.
This is the most underrated part of the whole build. GitHub Actions cron jobs let the 8 sub-agents run on schedule throughout the day — no server sitting idle, no always-on process to pay for. It's a genuinely solid pattern for anyone trying to run automation without renting a box for it.
Since the agent does live web research through Tavily and Jina, it's fetching content it doesn't control — which raises the obvious question of prompt injection. Right now the approach is to treat anything fetched from the web strictly as data, never as instructions, enforced through tool schemas and model-level instructions rather than trusting the content itself. There's no dedicated HTML sanitization layer yet — that's the next thing on the list, not something I'd call solved.
The code is public: github.com/basavarajpatil660/Ultimate-Ai
More build logs and other projects are on basavaraj.dev.
If you're trying something similar on free-tier infra and hit a wall, feel free to reach out — happy to talk through what worked and what didn't.