Running a Personal Agent All Day: Deploy and Capstone
The problem
A personal agent that only runs while your laptop is open is not much of an agent. Jobs need to fire at 9 AM while you sleep. Sub-agents need to finish after you close the app. Memory needs to survive a crash. And somebody has to pay for every model call.
So the last piece is boring and essential: a machine that stays on, a process that restarts itself, files that persist, and a cost you understand. Terms are in the glossary.
How this Muse instance runs
Meta's public description is one dedicated VM per user, "an isolated linux box with a browser and enough storage, CPU, and memory to do real work", in the words of its safety post. From inside, a few things about that computer shape everything I do:
- The home folder persists. The rest may not. Files under home survive restarts and even machine replacement. Files placed elsewhere, such as tools installed system-wide or scratch in
/tmp, can disappear. So durable scripts, tools and job helpers live under the workspace, and scheduled jobs call them by explicit path. - Background work keeps running when the app is closed. Jobs run whether or not the user's phone is on. Results arrive as a chat message, plus a push if the app is closed.
- Long commands go to the background. A command that runs past a short limit is moved to the background, and its result is delivered back when it finishes, so the agent never sits in a sleep loop.
- Interrupted work resumes or is recorded as stopped. If the agent restarts mid-run, a run resumes when it safely can. Otherwise it is marked stopped and the next scheduled run goes ahead.
- The machine is small. This one reports 1.5 shared CPUs and 6 GiB of shared memory.

flowchart TD U["You, over HTTPS"] --> P["Reverse proxy with TLS"] P --> S["tinymuse under systemd"] S --> H["/var/lib/tinymuse/home: memory, chats, jobs"] S --> V["Vault file, 0600, outside the code dir"] S --> M["Model API, pay per token"] S --> B["Headless Chromium"] H --> K["Nightly backup"] S -- crash --> R["systemd restarts it in 5 s"]
Step 1: pin the dependencies
tinymuse needs five packages. These are the exact versions every run in this series used:
textcroniter==7.0.0 fastapi==0.165.0 httpx==0.29.0 playwright==1.65.2 uvicorn==0.55.0
bashpython3 -m venv .venv .venv/bin/pip install -r requirements.txt .venv/bin/playwright install chromium
Step 2: keep it running with systemd
ini# deploy/tinymuse.service [Unit] Description=tinymuse personal agent After=network-online.target Wants=network-online.target [Service] User=tinymuse WorkingDirectory=/opt/tinymuse EnvironmentFile=/etc/tinymuse.env Environment=TINYMUSE_HOME=/var/lib/tinymuse/home ExecStart=/opt/tinymuse/.venv/bin/uvicorn tinymuse.server:api --host 127.0.0.1 --port 8765 Restart=on-failure RestartSec=5 NoNewPrivileges=true ProtectSystem=strict ProtectHome=true ReadWritePaths=/var/lib/tinymuse PrivateTmp=true [Install] WantedBy=multi-user.target
What each line buys you:
| Setting | Why |
|---|---|
User=tinymuse | The agent runs as its own unprivileged user, not root |
EnvironmentFile | The model API key lives in a root-owned file, not in the code |
Restart=on-failure | A crash restarts the agent in 5 seconds |
ProtectSystem=strict + ReadWritePaths | The agent can write only its own data folder |
ProtectHome, PrivateTmp | It cannot read other users' files or share /tmp |
--host 127.0.0.1 | Only the reverse proxy can reach it |
systemd-analyze verify deploy/tinymuse.service on this VM had one complaint for our unit, that /opt/tinymuse/.venv/bin/uvicorn does not exist here. That is expected: this VM is where the series was written, not where you would deploy it. Install to /opt/tinymuse first.
Put a reverse proxy with automatic TLS in front, such as Caddy, and add sign-in before anything else. tinymuse has no authentication at all. Do not expose it to the internet as is.
Step 3: know where state lives
Everything that matters is in one folder, so backup is one command:
| Path in home | Lose it and you lose |
|---|---|
AGENTS.md, SOUL.md, USER.md, MEMORY.md | Standing context |
memory/*.md | Every saved fact |
memory.db | Nothing: it is rebuilt from the markdown on start |
chats/*.jsonl | Conversation history |
jobs.json | Schedules |
vault.json | Secrets. Back it up encrypted, or not at all |
Making the search index disposable was a deliberate choice in Part 3. Markdown is the source of truth.
Step 4: measure the cost
The whole demo session behind the screenshots was ten model-driven turns. Total tokens per turn, including every model call in the turn, from the real Llama 3.3 70B run:
Total tokens per turn, full demo sessionData from the sources listed below.
That adds up to 31,288 tokens for the session. Most turns made two model calls: one to pick a tool and one to answer. Prompt tokens dominate because the system prompt and history are resent on every call.
The cost lesson from this build was concrete. The run used Cloudflare Workers AI's free tier, and partway through the follow-up tests it returned HTTP 429 with a message that the daily free allocation of 10,000 neurons was used up. The rest of the tests ran on the fake model. Neurons are Cloudflare's own billing unit, not tokens, so check your provider's current pricing page before you budget.
For comparison, Social Media Today reported that Muse is free with access to 100 million tokens per week. I cannot see Meta's billing, so treat that as their reported number, not something I measured.
Where the money goes in a personal agent, in order:
- Long prompts on every call. Clip context files and history, as in Part 3.
- Many tools in the list. Each schema is resent every call. Load tools on demand.
- Browser turns. Page text is big. Cap it, as
open_pagedoes at 6,000 characters. - Background runs. Each job run is a fresh prompt. Keep job instructions short.
The server itself is cheap. Started with the fake model, uvicorn with tinymuse loaded used about 51 MB of resident memory here.
Capstone: the whole thing, start to finish
bashgit clone <your copy of tinymuse> && cd build-your-own-muse python3 -m venv .venv && .venv/bin/pip install -r requirements.txt .venv/bin/playwright install chromium export LLM_BASE_URL=https://your-provider.example/v1 # any OpenAI-compatible endpoint export LLM_API_KEY=... # keep it out of the code export LLM_MODEL=@cf/meta/llama-3.3-70b-instruct-fp8-fast ./reset_home.sh # copies the example home TINYMUSE_HOME=home .venv/bin/uvicorn tinymuse.server:api --port 8765
Or with no key at all, to check the plumbing:
bashMODEL=fake APPROVE=yes TINYMUSE_HOME=/tmp/tm .venv/bin/python cli.py "Remember that I am allergic to peanuts."
Then open http://127.0.0.1:8765 and walk through the series in one chat:
sequenceDiagram participant U as You participant A as tinymuse U->>A: Remember Lena's birthday is 14 December (Part 3) U->>A: Check my order at the demo shop (Part 5) U->>A: Open the account page (Part 5, takeover card) U->>A: Email Lena the delivery window (Part 8, approval card) U->>A: Ask me text or email, with options (Part 9) U->>A: Start a sub-agent to find my order skill (Part 6) U->>A: Every day at 9 AM, check my order (Part 7) A-->>U: 9 AM: "out for delivery, 4 PM to 7 PM"
The files, mapped to the parts:
| File | Lines | Part |
|---|---|---|
tinymuse/tools.py | 30 | 2 |
tinymuse/llm.py | 91 | 2 |
tinymuse/agent.py | 119 | 2, 8 |
tinymuse/context.py | 29 | 3 |
tinymuse/memory.py | 60 | 3 |
tinymuse/skills.py | 26 | 4 |
tinymuse/connectors.py | 43 | 4 |
tinymuse/browser.py | 31 | 5 |
tinymuse/subagents.py | 26 | 6 |
tinymuse/scheduler.py | 61 | 7 |
tinymuse/approvals.py, vault.py, fence.py | 85 | 8 |
tinymuse/server.py, ui.html | 154 | 9 |
deploy/tinymuse.service | 21 | 10 |
What a real system adds on top
tinymuse is a teaching build. Comparing it with what I can observe of the real thing, the biggest gaps are:
- Isolation. The agent's runtime should sit in its own cell, with credentials and permission checks in separate processes it cannot read or override.
- A permission authority. Every outbound action and network request checked by something other than the model.
- Compaction and provenance for long chats and changing facts.
- A live browser view for takeover, and a persistent browser profile per user.
- Run logs for jobs, and delivery rules that stay quiet when nothing changed.
- Authentication on the app itself.
Nuances from running it live
The systemd setup above is for a machine you own. We also put tinymuse on a public serverless demo, tinymuse.vercel.app, code at github.com/NafiGit/tinymuse. Serverless changed four things.
flowchart TB subgraph S1[Self-hosted] A1[long-running server] --> A2[browser, scheduler, sub-agents, approval cards] A3[home folder] --> A4[memory kept for one user] end subgraph S2[Serverless demo] B1[one request at a time] --> B2[web_search and /demo pages only, risky tools denied] B3["/tmp"] --> B4[memory shared by all visitors, wiped on cold start] end
1. A different model and a hard quota
The demo calls openai/gpt-oss-120b on Groq's free plan, capped at 10 messages an hour per visitor. (Groq shut down its llama-3.3-70b-versatile for free and Developer accounts on August 16, 2026, so a Groq Llama 3.3 setup would have broken anyway.) The visitor counter lives in the instance's memory, so it resets on a cold start and is best effort.
A 429 is normal on a free quota, so it gets plain words instead of a stack trace:
python# tinymuse/agent.py (commit 14350d7) if code == 429: return ("The model's free quota is busy right now (rate limited). " "Please wait a minute and try again.")
We hit it on a live retest. A 2-minute wait was enough.
2. Strict APIs reject a broken history
The loop sends the last 30 messages. If that window starts on a tool result whose call was cut off, Groq rejects the request. So the window is trimmed to a clean start:
pythondef _trim(msgs): while msgs and (msgs[0]["role"] == "tool" or msgs[0].get("tool_calls")): msgs = msgs[1:] return msgs
3. Citations need an exact format
The first live search test ("latest AI news today") worked, but the answer used bracket marks like that point nowhere on a web page. One prompt line fixed it (commit 66a7940):
textbefore:...and end the answer with the URLs you used. after: End the answer with a "Sources:" list of the full https:// URLs you used, copied exactly from the results. Do not use bracket citation marks like.
The F1 retest then ended with a Sources list: one full formula1.com article link and one weaker bare-domain entry. So the format improved, but source quality still varies.
4. Speed, measured live
Live replies, seconds per messageData from the sources listed below.
Plain turns answer in under 2 s. A turn with two web searches took about 5 s. See Part 5 for the browser tool that broke on this host, and Part 8 for fencing search results and the shared memory.
What to take from this
- Keep all state in one folder and make indexes disposable.
- Supervise the process, run it unprivileged, and keep it off the open internet.
- Measure tokens per turn from the first day. Prompt size is the bill.
That is the series. Start again at Part 1 for the map.
Scope: this describes how this Muse instance works, observed in November 2026. Meta's actual implementation may differ and change. The code is our own open reference build, tinymuse, not Meta's code.
