Session 07 / Build your first agent
Your first
agent, for free.
A Telegram assistant for Oslo that answers, checks live data, remembers you, and messages you first. No API key. No card. Tonight.
Session 07 / Build your first agent
A Telegram assistant for Oslo that answers, checks live data, remembers you, and messages you first. No API key. No card. Tonight.
No one codes alone.
The shift
Same model. Different setup around it.
The plan
A message in, a message out. This is a chatbot.
model.ts, telegram.ts
Departures and weather. It chooses which to call.
tools.ts
SQLite. Your stop, your habits, your reminders.
memory.ts
A cron wakes it up. It messages you unprompted.
reminders.ts
We add one layer at a time and test after each.
The stack
| Piece | What we use | Free limit |
|---|---|---|
| Model | Val.town's built-in model, gpt-5.4-nano. No key. | Free accounts, cheap models only |
| Host | Val.town: an HTTP endpoint, a cron, a database, all in the browser. | 100,000 runs a day, 10 MB storage, cron every 15 min |
| Data | Entur departures and Yr weather. Open Norwegian data. | Free, just identify your app |
| Channel | Telegram Bot API. | Free, unlimited bots |
Fallback model: OpenRouter free tier, 50 requests a day, one environment variable to switch.
Laptops out
The full write-up with every URL is at oslovibecoding.tech/agent/
Layer 01
A message in, a message out. This is a chatbot.
model.ts, telegram.ts
Departures and weather. It chooses which to call.
tools.ts
SQLite. Your stop, your habits, your reminders.
memory.ts
A cron wakes it up. It messages you unprompted.
reminders.ts
Telegram sends a POST. We send the text to the model. We send the answer back.
Layer 02
A message in, a message out. This is a chatbot.
model.ts, telegram.ts
Departures and weather. It chooses which to call.
tools.ts
SQLite. Your stop, your habits, your reminders.
memory.ts
A cron wakes it up. It messages you unprompted.
reminders.ts
The model never runs code. It replies "please call oslo_departures with Jernbanetorget", and our loop does it.
The loop
Ask, act, feed back, repeat. Stop when it answers or the budget is spent.
Live demo
Two tool calls it was never told to make. That is the difference from a script.
Layer 03
A message in, a message out. This is a chatbot.
model.ts, telegram.ts
Departures and weather. It chooses which to call.
tools.ts
SQLite. Your stop, your habits, your reminders.
memory.ts
A cron wakes it up. It messages you unprompted.
reminders.ts
remember, recall and set_reminder are just three more tools.
Live demo
Three tools, chosen in the right order, from a one-line question.
Layer 04
A message in, a message out. This is a chatbot.
model.ts, telegram.ts
Departures and weather. It chooses which to call.
tools.ts
SQLite. Your stop, your habits, your reminders.
memory.ts
A cron wakes it up. It messages you unprompted.
reminders.ts
A trigger that is not a person. That is the line between chatbot and agent.
Rails
The tools list is the permission list. Nothing not on it can happen.
Build
Ask an AI to add the tool. Read what it writes. Then paste it.
The track
Val.town can run a file when mail arrives at something@valtown.email. Forward it a newsletter or a receipt; it summarises, pulls out dates, files to memory, and sends a weekly digest.
Free plan mails only youA watchdog: hand it a URL and a question. Every hour it fetches, compares with memory, and messages only when the answer changed. Tickets, prices, a page you are waiting on.
Same loop, one new toolChat, tools, memory, autonomy: every agent you meet is these four.
Before you close the laptop
No one codes alone. oslovibecoding.tech/agent