Build Logs · 3 min read

An Agent Built Around Cost

How tiered models, free compute and persistent memory kept an always-on agent at a few dollars a month, and why that did not hold.

CostModel routingPersonal AI agentTelegram

View as Markdown llms.txt For agents

April 2026 design: Telegram feeds an agent on a macOS virtual machine that picks a model per task, with a free model first, fallbacks, Claude for hard reasoning and Workers AI for background work, and a knowledge base searched before each reply

Most people use AI the same way: type into a chat box, copy the answer, close the tab, and start again tomorrow. The tool does the thinking, but the person does all the remembering, and nothing happens unless they ask.

In early 2026 I built Agu, a personal agent that works the other way round. He runs all the time, takes actions instead of only answering, and remembers what he is told. The constraint I set was cost: it had to be cheaper than a single paid AI subscription.

This post describes the design as it stood in April 2026, when it cost between two and five US dollars a month, and what changed afterwards.

Requirements

  • Always on, reachable from a phone.
  • Takes actions: browsing, filling in forms, reporting back.
  • Remembers preferences and context across conversations.
  • Costs less than a subscription, with expensive models used only when they earn it.

The design

  • Interface. Telegram, for text, voice notes and images.
  • Agent runtime. OpenClaw on a macOS virtual machine at home.
  • Models in tiers. A free model for everyday conversation, fallbacks behind it, and a stronger paid model reserved for hard reasoning.
  • Free compute for background tasks, research and summaries.
  • A knowledge base searched before each reply and written to after meaningful conversations.

Principles

Tier models by task, not by habit

Most tools charge premium rates for every request, including trivial ones. Here the everyday path used Gemini 2.5 Flash through Google’s free tier, called directly, which at the time allowed 1,500 requests a day. Claude was called only for serious reasoning, a few times a week. Background work ran on free Workers AI capacity. Cost follows the task, not the default.

Put the browser somewhere stable

The first version ran in Docker, and browser automation dropped its connection mid-task with no error. Moving the agent into a full macOS virtual machine, with a real network stack and a real browser, removed the problem. Some forms still would not respond to the framework’s built-in browser actions, so those interactions went one level lower and spoke to the browser directly. The details are in Browser Agents in a macOS VM.

Make memory the core feature

Without memory every conversation starts from zero, and the user spends the first minutes re-explaining context. The knowledge base changes that: the agent searches it before answering and records what it learned afterwards, so it improves week by week. Memory, more than any model choice, is what separates an agent from a chatbot.

The result in April 2026

The agent ran continuously for two to five dollars a month, and in some months close to nothing. A typical request: late one night I asked him on Telegram to register my car for visitor parking. He opened the building’s management portal, filled in the details, submitted the form and sent back a screenshot as confirmation.

What this design does not claim

  • The figure is specific to April 2026 and is not itemised. It did not hold: in February the agent used about nineteen dollars of gateway credit in roughly a week, and on June 1 a scheduled check that looped overnight drained the gateway credits entirely.
  • Free tiers move. By the end of May, Gemini’s free tier allowed roughly 20 requests a day rather than 1,500. Check current quotas before designing around one.
  • It depended on a machine at home staying on, which became one of the reasons for the later move.

What happened next

In September the agent moved from the virtual machine to Cloudflare Workers and Durable Objects, with shared memory and a persistent browser on a home server. That architecture is described in A Serverless Personal Agent.

For agents

Summary: A cost-first design for a personal AI agent (April 2026): a free model for everyday conversation, paid models only for hard reasoning, free compute for background work, a stable browser in a virtual machine, and a knowledge base searched before every reply.

Prerequisites

  • An agent framework (the post used OpenClaw) and a Telegram bot
  • A free model tier for everyday work and API access to a stronger model for hard tasks
  • A searchable knowledge base the agent reads before answering

Steps

  • Run the agent on hardware you own
  • Send everyday conversations to a free model and escalate hard reasoning to a stronger one
  • Move background tasks and summaries to free compute
  • Search the knowledge base before each reply and write to it after meaningful conversations

Diagrams, in words

  • Telegram feeds Agu, an OpenClaw agent on a macOS VM. Agu picks a model per task: Gemini 2.5 Flash first (free, direct key), GPT-4 mini and Llama 8B as fallbacks, Claude only for serious reasoning, and Workers AI for background work. A knowledge base (gbrain) is searched before each reply and written to afterwards. A dashed box shows the April monthly bill of $2 to $5, with a note that limits and prices changed later.

Descriptions reflect the author's own deployments using generally available services and public documentation.

This post contains no credentials. Do not put tokens, API keys, service-token secrets or one-time codes into prompts or commits; use environment variables or secret stores.