How to Build an AI Bot That Actually Does Things (Not Just Chat)
Contents
There are a million AI chatbot tutorials on the internet. Most of them teach you to build a wrapper around ChatGPT that answers questions in a Slack channel. Congratulations — you’ve built a slightly slower version of the ChatGPT app.
That’s not what we’re building.
We’re building an AI agent that operates autonomously. One that monitors your APIs, executes trades on schedule, sends you briefings, remembers past conversations, and picks the right AI model for each task automatically. A bot that does things, not just talks about them.
The Architecture That Actually Works
Most AI bot architectures fail because they treat the bot as a request-response machine. User asks question → bot generates answer → done. That’s a chatbot, not an agent.
An autonomous agent needs five capabilities:
- Multi-channel communication — Talk to you through Telegram, Discord, or whatever you prefer
- Tool execution — Actually run code, call APIs, read files, execute shell commands
- Persistent memory — Remember what happened yesterday, last week, last month
- Scheduled automation — Execute tasks on cron without you asking
- Intelligent routing — Pick the right AI model for each task’s complexity
OpenClaw provides all five out of the box. Let’s build.
Setting Up the Communication Layer
Your bot needs a home. We’ll use Telegram because it’s fast, supports rich formatting, and works everywhere. But the same principles apply to Discord, Slack, or any channel OpenClaw supports.
Create a Telegram bot through BotFather:
- Message
@BotFatheron Telegram - Send
/newbot - Choose a name and username
- Copy the API token
Add the token to your OpenClaw configuration. Now your AI has a direct line to you — and you to it.
The key insight: this isn’t just a chat interface. It’s a command and control channel. Your AI will use this same channel to proactively alert you about important events, send scheduled reports, and request approval for sensitive operations.
Building the Tool Layer
A chatbot answers questions. An agent takes actions. The difference is tools.
OpenClaw’s tool system lets your AI:
- Read and write files on your machine
- Execute shell commands (with safety guardrails)
- Call any HTTP API through reusable helper functions
- Search the web for real-time information
- Control a browser for web automation
- Send messages across different channels
Here’s where it gets interesting. You can build a reusable API toolchain script that wraps all your services into simple function calls. Instead of your AI writing raw HTTP requests every time, it calls alpaca_get_price('AAPL') or newsapi_headlines(5).
We built a script with 9 helper functions covering trading, market data, news, GitHub, databases, payments, email, deployment, and DNS. Your AI loads this script and suddenly has hands — it can reach out and interact with any of these services.
Implementing Persistent Memory
Here’s where most AI bots fundamentally fail. They wake up with amnesia every conversation. Your AI should remember:
- What you discussed yesterday and what decisions were made
- Your preferences for communication style, risk tolerance, topics of interest
- Project context including what’s in progress, what’s blocked, what shipped
- Operational state like when it last checked email or what market positions are open
OpenClaw solves this with a file-based memory system:
MEMORY.md— Curated long-term memory, like a human’s compiled knowledgememory/YYYY-MM-DD.md— Daily logs of what happened, raw and detailedmemory/active-context.json— Current operational statememory/tasks/task-queue.json— Pending work items
Every session, your AI reads its memory files before doing anything else. It knows who you are, what’s been happening, and what needs attention. Over time, it reviews daily logs and distills the important stuff into long-term memory.
This isn’t just bookkeeping. It’s the difference between a tool and a teammate. An AI with memory can say “Last time we tried that approach, it failed because of rate limiting — let me try the alternative we discussed.”
Setting Up Cron Automation
The highest-leverage capability of an autonomous agent is scheduled execution. Things that happen without you asking.
OpenClaw’s cron system supports:
- One-shot timers — “Remind me in 20 minutes”
- Recurring intervals — “Check every 4 hours”
- Cron expressions — “Every weekday at 8 AM Central”
Each cron job can:
- Inject a system event into your main session
- Run as an isolated agent turn with its own model and timeout
- Deliver results via announcement or webhook
Example cron jobs that change your life:
Morning Briefing (8:00 AM) Pull headlines, check portfolio, summarize overnight email, send formatted briefing to Telegram.
Market Monitor (Every 2 hours, market hours) Check RSI on watchlist symbols. Alert if any cross above 70 or below 30. Log all values for trend analysis.
Evening Review (9:00 PM) Summarize today’s activity. Update project statuses. Write daily memory log. Plan tomorrow’s priorities.
Weekly Report (Monday 9:00 AM) Aggregate the week’s data. Cost analysis on AI usage. Progress report on active projects. Email the summary.
Each of these runs autonomously. You wake up to a briefing. You get alerts when markets move. You end each day with a clean summary. Zero manual effort after the initial setup.
Intelligent Model Routing
Running everything through GPT-4 or Claude Opus is expensive and unnecessary. A morning weather check doesn’t need the same model as a complex trading strategy analysis.
Configure routing tiers:
- Free tier (Gemini Flash Lite): Status checks, weather, simple lookups
- Low cost (DeepSeek V3): Parsing, summaries, cron jobs, monitoring
- Standard (Claude Sonnet): Research, coding, analysis, writing
- Premium (Claude Opus): Strategy, architecture, complex reasoning
Your AI selects the appropriate tier based on task complexity. Set a daily budget with warning thresholds. When spending hits 80%, non-critical tasks automatically downgrade to cheaper models.
This isn’t just about saving money (though you’ll save 60-80%). It’s about sustainability. An automation system that costs $100/day isn’t viable for most people. One that costs $5-15/day with the same capability? That’s a rounding error.
Putting It All Together
When all five layers work together, you get something qualitatively different from a chatbot:
-
You send a message at 2 AM asking about a stock → Your AI checks live data, pulls historical RSI, cross-references with recent news, and gives you a technical analysis with a recommended position size. Cost: $0.03.
-
You wake up at 8 AM → A formatted briefing is already waiting in Telegram with headlines, portfolio status, calendar events, and weather. You didn’t ask for it. It just runs.
-
A stock on your watchlist hits an RSI threshold at 1 PM → You get an immediate alert with analysis. You reply “execute paper trade.” Your AI places the order through Alpaca. Total elapsed time: 12 seconds.
-
At 9 PM → Your AI writes a daily log, updates project statuses, and sends you a quick evening summary. You reply with tomorrow’s priorities. They’re queued and waiting.
That’s not a chatbot. That’s an AI workforce.
Start Building
The hardest part is starting. Everything after that compounds. Every API you connect, every cron job you create, every memory file your AI writes — it all accumulates into a system that gets more valuable over time.
The Erronatus Blueprint covers every step in detail, with tested configurations and real-world examples. But even without it, the architecture above will get you 80% of the way there.
Stop building chatbots. Start building systems.
Automation Insights Weekly
Get deep dives like this delivered to your inbox every Friday.