Autonomous agents · a practitioner's build
बालमुकुंद

An autonomous email-to-calendar executive assistant.

It wakes on a schedule, reads the inbox, decides what actually needs a human, writes the commitments it finds into a calendar, and emails one briefing — then goes back to sleep. No app to open. No prompt to type.

400k+MESSAGE MAILBOX
~3,000LINES OF PYTHON
7MODULES, NO FRAMEWORK
1EMAIL A DAY
01 — The problem

The inbox is a queue of other people's priorities.

Email is where commitments are born, and where they quietly die. A request lands, you mean to act on it, and three messages later it is buried. The cost is rarely a dramatic miss — it is the steady tax of re-reading, re-deciding, and hand-copying details from a paragraph into a calendar.

The friction was never reading email. It was the translation step. So the goal became sharper: the translation should already be done before the day starts. Current inbox tools stop one step short — they summarise, they label, they draft. Then they hand the work back and ask you to open something.

02 — Architecture

One run, end to end, with no human in it.

A batch pipeline that runs once and exits — not a service, not a daemon, not an event loop. Between runs, nothing of it is running at all. Every external service taps off exactly one stage, which is why any stage can be replaced without touching the ones around it.

Architecture diagram: seven Python modules in a vertical pipeline inside a self-hosted VPS, with the mail provider, LLM, calendar API and SMTP each tapping off one stage

Each external service touches exactly one stage. The model is a component, not the foundation.

03 — The product

The whole system exists to produce one email.

Everything upstream is plumbing. This is the only surface a human touches — rendered by the real renderer, driven by fabricated data. Every sender, merchant and amount below is invented.

Digest header with a five-stat strip, followed by a grid of action-required cards

Five stats, then only the things needing a decision — each with a plain-language briefing, one imperative action, and the rule that classified it.

Money spent section with multi-currency rows, a seven-day trend chart, and declined transactions

Money reconciled across currencies with a seven-day trend. Declined charges shown separately and never counted as spend.

Every figure above is invented. The renderer is the production one; the data driving it is a fixture written for this page. → Open the full digest
04 — The idea worth stealing

Where the intelligence is allowed to live.

The interesting decision is not the model. It is the boundary: anything with a correct answer is code; anything requiring judgement is the model. Timezone arithmetic has a correct answer, so no model touches it. Whether an email is a bill you owe or a course someone wants to sell you does not, so no regex attempts it.

Deterministic Python

  • Timezone windowing and the IMAP BEFORE ceiling
  • Connection recovery after an interrupted fetch
  • Newest-first traversal under a wall-clock budget
  • Security-alert collapse before any API call
  • Persistent event fingerprinting across runs
  • Date sanity bounds
  • Known billing cycles the model cannot see

Left to the model

  • Needs a human, is money, or is noise
  • What the email actually means, in one or two lines
  • The single next action, as an imperative
  • Transaction type, amount, currency, card, merchant
  • An obligation you hold versus a deadline someone invented
  • What kind of obligation — payment, maturity, action, deadline
  • Inferring a first charge date from an activation notice
That boundary is what makes the model swappable. It is one stage in a pipeline rather than the foundation of the system, so a change of provider is a config change — and everything around it stays valuable when a better or cheaper model appears.
05 — Engineering log

Three failures, and the plausible answer that was wrong each time.

In all three, an obvious cause was available immediately, was cheap to act on, and was wrong. Each was settled by measuring the thing everyone had assumed.

FAILURE 01

The poisoned socket

A folder-select command answered with a fragment of HTML. Assumed: a flaky provider. Actually: a fetch timeout fired mid-stream and left unread bytes on the socket; the next command read the previous response. Proven by A/B, fixed by returning session validity.

FAILURE 02

Never in the prompt

Four emails summarised without their amounts. Assumed: weak model reasoning. Actually: a 3,000-character body window ended mid-CSS — the figures sat at characters 3,205 to 8,107. The model was telling the truth.

FAILURE 03

The calendar that filled itself

One charge duplicated six times, a subscription twenty-seven. Assumed: weak dedup. Actually: four distinct causes, including a feedback loop through the calendar's own notification emails, and dedup keyed on model-generated titles that drift every run.

The through-line: a retry loop is what you write when you don't know why something failed. It is a fine backstop and a terrible explanation. → Read all three in full
06 — Documentation

Written to be copied.

The architecture is intentionally modest: a small server, a scheduler, a swappable model, local JSON state and a couple of integrations. The hard part was never the technology — it was deciding what the assistant should be allowed to do without asking.