UXIN3D Selected work / Case study ← All work
Case study · 2026

Personal AI
Assistant

A private Telegram assistant for calendar, reminders, documents, current answers, images and cloud costs — built because I wanted AI to do real work without handing over control of the stack.

Role
Design, implementation, deployment and operation
Stack
Python 3.13, FastAPI, LangGraph, Postgres 17 + pgvector, Google Cloud
Status
Deployed and operated for one allow-listed user
Guardrail
Argument-bound approvals and a €5/month target
Recreated iPhone Telegram interface, not a runtime capture. Personal details from the real conversation have been removed; the profile deliberately presents the assistant as a robot version of its user.
01 · Why
Illustrated robot version of Esteban smiling and holding a Telegram badge, surrounded by chat, calendar and document icons
My robot collaborator

A robot version of me, built to collaborate.

Muse was not available in Europe. A hosted assistant would also mean accepting Meta’s account, storage and product roadmap. I wanted the assistant, the data path and the bill under my control — so I built it.

The portrait is how I present the assistant to myself: a version of me that can collaborate on my needs rather than a faceless utility. When a capability is missing, I extend it in code — a new tool, a risk level, an approval rule and a test.

The result is deliberately not a product for everyone. It is a private Telegram bot with one authorised user, a small allow-list and a narrow set of jobs. That constraint is the point: the interesting problem is not connecting another model to another chat box. It is making an agent dependable when its actions have consequences.

DecisionMuseThis assistant
Data pathAccount, storage and retention are controlled by Meta’s product.Telegram transports messages; Cloud Run, Postgres and documents run in services I choose. Model turns go only to the provider I configure; Meta is not in the loop.
Cost modelFree tier; Power $20/month; Maximum $100/month. Additional tokens cost extra.Metered Google Cloud and model usage, with a €5/month target and alerts at 50/80/100%.
Cost controlI can change plans; I cannot change the architecture that produces the bill.Scale-to-zero, one 15-minute dispatcher instead of four queue jobs, single-region secrets with one version each, and a bill I can query.
CapabilitiesFollow the provider’s roadmap.I add a tool, choose its risk level, define its approval rule and write the test.
ExitMigration depends on what the provider exports.Code, schema, documents and deployment stay in repositories and accounts I control.

Muse prices are Meta’s published US prices (Meta Help Center); regional availability and local pricing vary. The €5 is my target, not an observed bill or a guarantee. Cheaper here means: no always-on service, fewer scheduled container starts, one replica per secret and a metered bill I can inspect. The trade-off is that I own the operations.

02 · What it does

Five capabilities, one conversation.

01

Calendar

Reads the agenda and free time, then prepares events with guests, location and Meet links. Only the write needs approval.

02

Reminders & digest

Creates durable reminders with server-resolved dates and delivers them through a scheduled job. A separate daily digest covers cloud spend.

03

Documents

Indexes PDF, Markdown and plain text into pgvector, then answers with the document and page that support the answer.

04

Current answers

Searches the web and cites sources for changing information; vision answers questions about JPEG, PNG or WebP images without storing them.

05

Cloud costs

Reports Google Cloud spend on demand with /gastos and sends a daily digest from the BigQuery billing export.

One boundary worth stating: image turns describe or answer questions, but do not execute tools. A reminder or event must be requested in a text turn. The assistant does not pretend the capability is broader than it is.
03 · The three hard problems

Approval, consistency and visibility.

I

An approval has to mean something

A checkbox is not an approval. The button has to be bound to the exact arguments the user saw, expire after a short window, and execute at most once even if two taps arrive together. Here the approval carries a hash of the canonical arguments; a database trigger protects immutability, and the application re-verifies the hash inside the execution transaction. A stale or mutated action is refused, not interpreted.

II

A calendar write must not guess

Creation uses deterministic event IDs, so a retry reconciles with the event that already exists. Updates and cancellations read the event first and check an expected summary and start time before touching it. If an external call times out, the outcome is recorded as unknown — never silently retried as if nothing happened.

III

Cost has to be visible where I work

The assistant is also the interface to its own bill. A daily job reads the billing export after the morning refresh, reports the previous complete day in three decimals, and lists every positive-cost service. On demand, /gastos answers with the same numbers. The project has a €5/month cost target with alerts at 50, 80 and 100 percent.

Telegramwebhook · allow-list
FastAPIrequest budget
LangGraphmodel · tools · approval
Postgresstate · RAG · ledger

Also: one Cloud Run dispatcher plus the billing job, single-region Secret Manager, Cloud Storage, Vertex AI, Ollama Cloud and Google Calendar. State survives scale-to-zero.

04 · What broke

The useful part of the story.

The first version looked finished before it was. These are the failures that changed the design — all recorded in the project’s final report, not reconstructed afterwards.

Billing · wrong shape

The export existed. The job said it was missing.

The BigQuery cost report read tableId from the top level of the table metadata. The real field is tableReference.tableId. The result was not a crash: it was a confident export_missing response. A test now fixes the real response shape, so the next provider quirk cannot quietly turn into a false negative.

Deployment · stale workloads

The code was new. The job was not.

The deploy script only created missing Cloud Run jobs; it did not update existing ones. After a redeploy, the billing job kept running the previous image. The fix updates every job and checks the revision that is actually serving traffic. A rollback had also left traffic pinned to an old revision, so a later deploy appeared healthy while serving stale code. The deploy now forces --to-latest and verifies the served revision.

OAuth · time bomb

A seven-day token that looked permanent.

Google’s OAuth consent screen was in Testing mode, which expires refresh tokens after seven days. The deployment was not broken; it was scheduled to break. Publishing the consent screen to production removed that expiry, and the refresh token lives in Secret Manager with the access tokens kept in memory.

Calendar · live model bug

“This Saturday” became the wrong day.

The first real calendar query exposed two model-level defects: a tool call written as prose, and a relative date calculated three days early. The fix was architectural, not a stronger prompt: relative dates are resolved on the server, the model receives the resolved range, and invalid or past dates are rejected with a typed error.

05 · What it costs

A target, not an anecdote.

Muse publishes its paid plans at $20/month for Power and $100/month for Maximum. I set €5/month as the target for this assistant, with alerts at 50, 80 and 100 percent — roughly a quarter of Muse’s entry paid plan before currency conversion and taxes.

That is deliberately a target, not a guarantee. I am not quoting an observed spend: the billing console is the source of truth, and the export can lag by about a day. The point is that the cost is metered, visible and something I can tune, rather than a subscription price set elsewhere.

Architecturally, the service scales to zero and the work runs as bounded one-shot jobs. A single 15-minute dispatcher now handles reminders, document ingestion and interrupted turns instead of three separate scheduled containers. Secrets are single-region with one active version each, and the daily report excludes the current day so it cannot mistake a partial export for a finished one.

That is the real cost comparison with a hosted subscription: one is a price set by the provider; the other is a bill I can inspect, explain and tune. The trade-off is that I own the operations. The database is still the weak point: the free tier can pause and has no backups, so a paid plan remains the honest next step.

Not promisedAlways-on availability or disaster recovery while the database remains on a free tier.
Not hiddenThe daily cost digest and /gastos make the bill part of the product, rather than a console ritual.
06 · What’s next

The unfinished parts stay visible.

The next useful changes are operational: move the database to a plan with backups, define a retention and purge policy, and exercise a restore rather than only a code rollback. Hybrid retrieval stays a deferred engineering decision, with a recall trigger written down, instead of a feature added because it sounds modern.

There is also a boundary I want to keep: no voice, no WhatsApp, no Gmail and no invented booking provider. The assistant is narrow enough to explain, test and operate. That is more valuable to me than a longer feature list.