<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Agentd on Mini Fish</title>
    <link>https://blog.minifish.org/tags/agentd/</link>
    <description>Recent content in Agentd on Mini Fish</description>
    <image>
      <title>Mini Fish</title>
      <url>https://blog.minifish.org/android-chrome-512x512.png</url>
      <link>https://blog.minifish.org/android-chrome-512x512.png</link>
    </image>
    <generator>Hugo -- 0.165.0</generator>
    <language>en-US</language>
    <copyright>Mini Fish 2014-present. Licensed under CC-BY-NC</copyright>
    <lastBuildDate>Sat, 19 Sep 2026 18:00:00 +0800</lastBuildDate>
    <atom:link href="https://blog.minifish.org/tags/agentd/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Inside My GMK and Lightsail Homelab</title>
      <link>https://blog.minifish.org/posts/gmk-lightsail-homelab-architecture/</link>
      <pubDate>Sat, 19 Sep 2026 18:00:00 +0800</pubDate>
      <guid>https://blog.minifish.org/posts/gmk-lightsail-homelab-architecture/</guid>
      <description>An architecture tour of my GMK and AWS Lightsail homelab: Tailscale, agentd, Tailgate, local-ai, Matrix, World Loom, Sentinel, Beszel, and NAS backups.</description>
      <content:encoded><![CDATA[<p>The projects on this blog often look independent: an agent runtime, a cycling route planner, an AI gateway, a browser game. In daily use, several of them share the same small infrastructure.</p>
<p>At home, a <strong>GMK M5 Ultra</strong> runs the applications that need memory, persistent storage, or local compute. A small <strong>AWS Lightsail instance in Singapore</strong> supplies the public entry point and runs lightweight network services. <strong>Tailscale</strong> connects them. A NAS stores encrypted backups, and a Cloudflare Worker watches the system from outside both machines.</p>
<p>That division lets me keep the cloud instance small while giving my projects a place to run continuously. The interesting part is how the pieces fit together: where requests enter, where state lives, which services remain private, and what happens when one machine disappears.</p>
<p>This is a snapshot of the running system on <strong>September 19, 2026</strong>, checked against the live hosts and deployment configuration. Repository links appear throughout; repositories marked <strong>private</strong> require access. Repository visibility was updated on <strong>September 22, 2026</strong>, when Canopy, Tailgate, the X adapter, and World Loom server were opened to the public.</p>
<h2 id="the-architecture">The architecture</h2>
<p><a href="homelab-architecture.png"><img alt="Architecture of the Minifish homelab. Lightsail handles public ingress, transport adapters, and model routing. Tailscale connects it to GMK applications and local inference. Private clients reach GMK directly. Cloudflare hosts the World Loom frontend and the independent Sentinel monitor; encrypted backups go to a NAS." loading="lazy" src="/posts/gmk-lightsail-homelab-architecture/homelab-architecture.png"></a></p>
<p><a href="homelab-architecture.png">Open full resolution</a> · <a href="diagrams-source.zip">Download editable SVG diagrams</a></p>
<p>The diagram groups related services; it is not a map of every listening port. The two most important boundaries are the public/private network boundary and the separation between application state and its recovery copies.</p>
<table>
	<thead>
			<tr>
					<th>Location</th>
					<th>What lives there</th>
					<th>Why it belongs there</th>
			</tr>
	</thead>
	<tbody>
			<tr>
					<td>GMK M5 Ultra</td>
					<td>agentd, Canopy/GraphHopper, local-ai, Matrix/RTC, World Loom, Beszel</td>
					<td>Local compute, memory, and persistent application data</td>
			</tr>
			<tr>
					<td>Lightsail, Singapore</td>
					<td>Nginx ingress, Telegram/X adapters, Tailgate, SimpleX, network utilities, Durvo server</td>
					<td>Public reachability and lightweight services that can stay up independently of GMK</td>
			</tr>
			<tr>
					<td>Tailscale network</td>
					<td>Host connectivity, private HTTPS endpoints, administration</td>
					<td>One private network across devices and locations</td>
			</tr>
			<tr>
					<td>Cloudflare</td>
					<td>World Loom static frontend; Sentinel Worker, D1, and Access</td>
					<td>Static delivery and an observation point outside the two hosts</td>
			</tr>
			<tr>
					<td>NAS</td>
					<td>Encrypted Restic snapshots</td>
					<td>Recovery data on a separate storage system</td>
			</tr>
	</tbody>
</table>
<p>The GMK has a Ryzen 7 7730U, 64 GB of installed RAM—about 62 GiB visible to Linux—and roughly 954 GiB of usable NVMe capacity. It runs native Debian 13 with Docker Compose. At inspection, it had eleven running application containers. The Lightsail instance has only about 442 MiB of memory visible to Linux and runs its services under systemd.</p>
<p>The memory-heavy services run at home, while small edge services can remain available independently of home power and connectivity.</p>
<h2 id="lightsail-is-the-public-edge">Lightsail is the public edge</h2>
<p>Public Matrix requests arrive at Lightsail. Nginx sends them across Tailscale to Tuwunel on GMK. MatrixRTC authentication and LiveKit signaling follow the same broad path.</p>
<p>There are two layers at the HTTPS entry point. The outer Nginx stream listener examines the TLS server name and selects a local backend. For Matrix, RTC, and Durvo, that backend is an HTTP server block that terminates TLS and proxies the request. SimpleX services have their own TLS endpoints. This uses Nginx&rsquo;s <a href="https://nginx.org/en/docs/stream/ngx_stream_ssl_preread_module.html"><code>ssl_preread</code></a> support: selecting a backend from the ClientHello does not itself terminate the TLS connection.</p>
<p>Media needs a separate path. My LiveKit deployment uses TCP 7881 and UDP 7882, which Lightsail forwards with nftables DNAT and masquerading to GMK over Tailscale. The HTTPS proxy handles signaling; the media forwarding rules handle the corresponding WebRTC traffic. LiveKit documents these as its <a href="https://docs.livekit.io/transport/self-hosting/ports-firewall/">ICE/TCP and UDP mux ports</a>.</p>
<table>
	<thead>
			<tr>
					<th>Traffic</th>
					<th>Lightsail&rsquo;s role</th>
					<th>GMK destination</th>
			</tr>
	</thead>
	<tbody>
			<tr>
					<td>Matrix client/server API</td>
					<td>HTTPS reverse proxy</td>
					<td>Tuwunel</td>
			</tr>
			<tr>
					<td>MatrixRTC authorization</td>
					<td>HTTPS reverse proxy</td>
					<td>MatrixRTC Auth</td>
			</tr>
			<tr>
					<td>LiveKit signaling</td>
					<td>HTTPS/WebSocket reverse proxy</td>
					<td>LiveKit API</td>
			</tr>
			<tr>
					<td>LiveKit media</td>
					<td>TCP/UDP forwarding</td>
					<td>LiveKit media ports</td>
			</tr>
	</tbody>
</table>
<p>This distinction matters during debugging. An HTTP health check can pass while media forwarding is broken. The migration checks exercised the HTTP endpoints, TCP connectivity, and a UDP packet traversing the forwarding path; those checks alone do not prove that a complete two-party call works.</p>
<p>The upstream projects are <a href="https://github.com/matrix-construct/tuwunel">Tuwunel</a>, <a href="https://github.com/livekit/livekit">LiveKit</a>, and <a href="https://github.com/element-hq/lk-jwt-service">MatrixRTC Authorization Service</a>. My deployment configuration and recovery tooling live in <a href="https://github.com/minifish-org/infra"><code>infra</code></a> <strong>(private)</strong>.</p>
<h2 id="a-personal-agent-request-crosses-the-boundary-more-than-once">A personal agent request crosses the boundary more than once</h2>
<p>The agent stack shows how the two machines share a workload.</p>
<p><a href="agent-request-flow.png"><img alt="Personal agent request flow. Telegram and X adapters on Lightsail submit turns to agentd on GMK. agentd calls Tailgate on Lightsail, which selects local-ai on GMK or a hosted provider. agentd can call Canopy and GraphHopper for route planning. Results are committed with an optional delivery outbox, which the adapters claim and acknowledge." loading="lazy" src="/posts/gmk-lightsail-homelab-architecture/agent-request-flow.png"></a></p>
<p><a href="agent-request-flow.png">Open the request-flow diagram at full resolution</a>. A typical request follows this path:</p>
<ol>
<li>The <strong>Telegram adapter</strong> receives a webhook, or the <strong>X adapter</strong> polls an eligible mention.</li>
<li>The adapter submits a turn to <strong>agentd on GMK</strong> through the private HTTPS endpoint.</li>
<li>agentd calls <strong>Tailgate on Lightsail</strong> using the configured model route.</li>
<li>Tailgate forwards the request to <strong>local-ai on GMK</strong> or a configured hosted provider.</li>
<li>agentd runs any permitted tools and persists the result. When delivery was requested, finalization also makes that result available through its delivery outbox.</li>
<li>The adapter claims the delivery, sends it through the platform API, and acknowledges it.</li>
</ol>
<p>The adapters own platform-specific behavior. agentd owns execution and durable run state. The adapters do not reach into its database to find replies. This keeps Telegram webhook policy, X polling, media handling, and delivery retries out of the core runtime.</p>
<p>The outbox makes the handoff inspectable, but an external send and a local acknowledgment are still separate operations. It should not be read as a blanket exactly-once guarantee for a third-party API.</p>
<p>The public repositories are <a href="https://github.com/minifish-org/agentd"><code>agentd</code></a>, <a href="https://github.com/minifish-org/agentd-telegram-adapter"><code>agentd-telegram-adapter</code></a>, and <a href="https://github.com/minifish-org/agentd-x-adapter"><code>agentd-x-adapter</code></a>. I discuss the runtime boundary in more detail in <a href="/posts/agentd-transport-neutral-runtime/">agentd: A Transport-Neutral Runtime for Personal Agents</a>.</p>
<h3 id="why-the-model-gateway-stays-on-lightsail">Why the model gateway stays on Lightsail</h3>
<p><a href="https://github.com/minifish-org/tailgate"><code>Tailgate</code></a> provides one OpenAI-compatible API with centralized provider credentials and explicit model routing. The running gateway is bound to the Lightsail Tailscale address; it is also available through Tailscale Serve. Living on a public VM does not make this API a public endpoint.</p>
<p>The configured upstreams currently include the GMK local-ai service, DeepSeek, and OpenRouter. A route such as <code>local/chat</code> identifies the local capability; other routes can select hosted models according to their configuration. Fallback behavior belongs to that policy—it should not silently turn every local request into a remote one.</p>
<p>This does create an extra trip: agentd on GMK calls Lightsail, which may call GMK again for local inference. I accept that for a shared policy point used by multiple clients. It also creates a real dependency: if Lightsail is down, agentd&rsquo;s configured model gateway is unavailable even when GMK is healthy. The direct local-ai endpoint is a separate access path, not an automatic agentd failover mechanism.</p>
<p>The earlier <a href="/posts/tailgate-private-ai-gateway/">Tailgate article</a> describes the gateway design. Its original local backend was <code>qwen-local</code> on an Apple Silicon Mac. The live Lightsail configuration now points to <strong>local-ai on GMK</strong>.</p>
<h3 id="local-inference-is-a-service-with-a-finite-budget">Local inference is a service, with a finite budget</h3>
<p><a href="https://github.com/minifish-org/local-ai"><code>local-ai</code></a> <strong>(private)</strong> exposes chat, embeddings, speech synthesis, transcription, and translation behind a compatible API. Its current deployment has an API container, a runtime container, and a separate resident chat server. The API and native chat webpage share that chat server.</p>
<p>The current chat setup runs on the CPU with six threads, one inference slot, and a 48 GiB container memory limit. Embeddings use the AMD Vulkan backend; the other capabilities retain their own backends. This is a mixed workload on one small machine, so the useful questions are concrete: what is resident, what is queued, and which requests contend for the same resources?</p>
<p>In particular, the direct chat webpage reaches the chat service without going through the API&rsquo;s cross-capability queue. It still uses the chat server&rsquo;s single slot, but that does not serialize every other workload on the host. Container memory limits are ceilings, not reservations; setting several limits does not create additional physical RAM.</p>
<h3 id="canopy-gives-the-agent-a-route-engine">Canopy gives the agent a route engine</h3>
<p><a href="https://github.com/minifish-org/canopy"><code>Canopy</code></a> is an MCP service for Singapore cycling and walking routes. It uses a local GraphHopper instance for routing, with a model that prefers PCN-like and low-traffic paths. OneMap supplies geocoding and points of interest.</p>
<p>Canopy and GraphHopper run alongside agentd on GMK without host-published ports. The agent can ask a specialized tool to plan and audit a route, then explain the returned geometry, distance, and GPX output. The language model does not have to invent the route.</p>
<p>The deployment also distinguishes durable state from reproducible data: the GraphHopper graph cache is rebuildable and is excluded from the daily application-data backups. More on the tool itself: <a href="/posts/canopy-singapore-pcn-routing/">Canopy: Local MCP Routing for Singapore PCN Loops</a>. Its routing engine is <a href="https://github.com/graphhopper/graphhopper">GraphHopper</a>.</p>
<h2 id="a-public-frontend-can-have-a-private-backend">A public frontend can have a private backend</h2>
<p>World Loom is a small shared virtual world with a browser client and an authoritative Rust server. Its static client is served from Cloudflare Pages at <a href="https://wl.minifish.org/">wl.minifish.org</a>. The live world runs on GMK.</p>
<p>The browser downloads the client from Pages, then connects directly to the GMK&rsquo;s private HTTPS/WebSocket bridge through Tailscale. Cloudflare Pages does not proxy the gameplay connection. Opening the public webpage therefore does not grant access to the world; the client device still needs the private network connection.</p>
<p>The server owns world updates and persistence, including SQLite and Anvil region files. Its MCP interface lets a client inspect or edit the live world through the server&rsquo;s update loop. That endpoint is exposed through Tailscale Serve and also requires a bearer token. The browser bridge has an explicit origin allowlist.</p>
<p><a href="https://tailscale.com/docs/features/tailscale-serve">Tailscale Serve</a> supplies the private HTTPS entry points. The World Loom endpoints use Serve without Funnel; the same host also exposes private agentd, local-ai, and Beszel endpoints. Keeping an application behind the tailnet complements its own authentication and authorization.</p>
<p>Both <a href="https://github.com/minifish-org/world-loom-client"><code>world-loom-client</code></a> and <a href="https://github.com/minifish-org/world-loom-server"><code>world-loom-server</code></a> are public. The server includes a standalone MCP build/restart/undo demo and documents its experimental security boundaries, including known upstream dependency advisories. The integration workspace <a href="https://github.com/minifish-org/world-loom-stack"><code>world-loom-stack</code></a> remains <strong>private</strong>.</p>
<h2 id="other-services-that-belong-at-the-edge">Other services that belong at the edge</h2>
<p>Lightsail also runs a few services with useful independent lifetimes:</p>
<ul>
<li><strong>SimpleX SMP and XFTP</strong> provide messaging relay and file-transfer services. Both come from <a href="https://github.com/simplex-chat/simplexmq">simplexmq</a>.</li>
<li><strong>Durvo</strong> runs its single-node control server behind Nginx. <a href="https://github.com/minifish-org/durvo"><code>Durvo</code></a> <strong>(private)</strong> is my experimental SQLite recovery project, with immutable recovery objects in managed S3 and restoration into isolated staging targets.</li>
</ul>
<p>Durvo is still a self-use experiment with unresolved capture-maturity limitations. The homelab recovery procedure described below relies on consistent snapshots and Restic; Durvo is not the protection mechanism for those application databases.</p>
<h2 id="observe-the-machine-from-inside-and-availability-from-outside">Observe the machine from inside, and availability from outside</h2>
<p>I use two monitoring layers because they answer different questions.</p>
<p><strong><a href="https://github.com/henrygd/beszel">Beszel</a></strong> runs on GMK: a containerized Hub and a native Agent. It shows CPU, memory, storage I/O, container activity, temperatures, and NVMe SMART information. The dashboard is available only through Tailscale. This is the view I use to understand whether inference is competing with other work or whether the host is running out of resources.</p>
<p><strong><a href="https://github.com/minifish-org/sentinel"><code>Sentinel</code></a> (private)</strong> has a different position. Short-lived probes on GMK and Lightsail periodically send signed reports to a Cloudflare Worker. The Worker also checks public Matrix, RTC, and Durvo endpoints, stores compact history in D1, and serves a status page protected by Cloudflare Access.</p>
<p>Lightsail can observe GMK&rsquo;s reachability and Beszel&rsquo;s HTTPS endpoint from another host. If GMK loses power, its local dashboard disappears, but the Worker and Lightsail remain separate observation points. When reports become stale, the monitor shows an explicit unknown state.</p>
<p>Sentinel&rsquo;s status page brings these observations together with incident history.</p>
<p>The useful distinction is between a process running, an application responding, and a scheduled job completing successfully. A running container does not prove that yesterday&rsquo;s backup succeeded.</p>
<h2 id="recovery-is-part-of-the-architecture">Recovery is part of the architecture</h2>
<p>The backup job runs <strong>each night</strong>. It stops the main database writers—Tuwunel, World Loom, and agentd—creates consistent archives, verifies checksums, and starts those applications again before uploading to the NAS.</p>
<p>This introduces a deliberate service interruption during snapshot creation. For this personal workload, a straightforward consistency boundary is worth that interruption.</p>
<p><a href="https://github.com/restic/restic">Restic</a> stores encrypted snapshots on the NAS over SFTP. Retention combines daily, weekly, and monthly recovery points with short-lived local staging copies. Additional hooks capture Beszel&rsquo;s consistent database backup and local-ai&rsquo;s configuration and model manifest. Model weights and rebuildable caches are excluded from the routine backup; recovering them can require downloading or rebuilding them.</p>
<p>Regular repository checks and isolated restore drills exercise the recovery path. The automated restore drill covers the original application set. Beszel has integrity checks on each backup and a separately documented manual restore drill; adding a service to the backup archive does not automatically add it to every recovery test.</p>
<p>There is also an encrypted recovery bundle containing the captured configuration, operational tooling, consistent database archives, and application images from the core migration. That bundle has its own date and scope. It needs refreshing as services and deployment details change.</p>
<p>The NAS is a separate storage target, but that alone says nothing about geographic separation or every shared failure mode. Daily snapshots also leave changes since the last successful snapshot exposed to loss. Those are properties of the design, not things a successful checksum can fix.</p>
<h3 id="a-migration-made-the-recovery-path-real">A migration made the recovery path real</h3>
<p>On September 12, I moved the core services from a Mac/Colima deployment to native Debian on the GMK. Before switching traffic, I rehearsed restoration on isolated Docker networks and checked the restored applications.</p>
<p>At cutover, the source writers and timers were stopped, final data was captured, and the Lightsail upstreams and private client endpoints were changed. On the new host, the first NAS backup, repository check, isolated restore, and a production reboot were verified. The old Colima instance was then shut down with its frozen state retained.</p>
<p>The subtle part is rollback. Once the new host accepts writes, pointing traffic back at the frozen source can discard those writes. A retained machine is useful recovery material; it is not automatically a safe failback target.</p>
<h2 id="what-this-arrangement-gives-me">What this arrangement gives me</h2>
<p>The GMK gives the projects room to work. Lightsail gives them a stable public edge and a shared model gateway. Tailscale lets private services remain reachable from my devices without turning each one into a public web application. Cloudflare supplies static delivery and an independent monitoring location, while the NAS and restore procedures make host replacement practical.</p>
<p>There are still clear failure domains. Losing GMK stops its agents, local inference, Matrix backend, and shared world. Losing Lightsail breaks the public entry path and configured model gateway. Neither machine automatically takes over the other&rsquo;s work.</p>
<p>For my current workload, the value is that I can follow a request across the system, find the state it changes, and explain how that state can be recovered. Each new project has to fit into that same model: an entry point, an execution boundary, a place for durable data, a health signal, and a recovery path.</p>
]]></content:encoded>
    </item>
    <item>
      <title>agentd: A Transport-Neutral Runtime for Personal Agents</title>
      <link>https://blog.minifish.org/posts/agentd-transport-neutral-runtime/</link>
      <pubDate>Sat, 15 Aug 2026 16:11:02 +0800</pubDate>
      <guid>https://blog.minifish.org/posts/agentd-transport-neutral-runtime/</guid>
      <description>A systems-level look at agentd, a durable single-host runtime for personal agents with scoped execution, explicit capabilities, inspectable traces, and transactional delivery.</description>
      <content:encoded><![CDATA[<p>Most personal-agent demos begin with a chat surface: receive a message, call a
model, perhaps execute a tool, and send the answer back. That is enough to show
the interaction. It does not define what should happen when two messages arrive
for the same conversation, a process restarts, a delivery attempt times out, or
a model invokes a capability with side effects.</p>
<p><a href="https://github.com/minifish-org/agentd"><code>agentd</code></a> is my attempt to put those
questions behind a small runtime contract. It is an experimental, multi-tenant,
single-agent runtime for one host. The model still decides what to do. The host
runtime owns the less glamorous parts: persistence, scheduling, scoped
serialization, capability boundaries, raw traces, and a pull delivery outbox.</p>
<p>The goal is not to build a universal agent framework. The narrower goal is to
make one turn durable and inspectable without coupling execution to Telegram,
a browser, a game, or any other user interface.</p>
<h2 id="the-boundary-starts-with-a-turn">The boundary starts with a turn</h2>
<p>External systems submit work through one transport-neutral endpoint:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-text" data-lang="text"><span style="display:flex;"><span>POST /v1/tenants/:tenant/turns
</span></span></code></pre></div><p>A request identifies an agent, a scope, a payload, and optionally a delivery
destination and <code>request_id</code>. Submission returns <code>202</code> with a queued <code>run_id</code>.
The caller can wait for the canonical result, inspect the trace, cancel the run,
or consume delivery through a separate adapter.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-text" data-lang="text"><span style="display:flex;"><span>REST turn / due schedule
</span></span><span style="display:flex;"><span>          |
</span></span><span style="display:flex;"><span>          v
</span></span><span style="display:flex;"><span>      queued run -- transactional (tenant, agent, scope) claim
</span></span><span style="display:flex;"><span>          |
</span></span><span style="display:flex;"><span>          v
</span></span><span style="display:flex;"><span>  context -&gt; model &lt;-&gt; allowed built-in/MCP tools
</span></span><span style="display:flex;"><span>          |
</span></span><span style="display:flex;"><span>          v
</span></span><span style="display:flex;"><span> transaction: output + terminal trace + context + optional delivery
</span></span></code></pre></div><p>This separation matters because a transport and a runtime answer different
questions. Telegram knows webhook authentication, chat identifiers, message
formatting, and Telegram&rsquo;s retry behavior. The runtime knows run state, context,
capabilities, and final output. Neither component needs to absorb the other&rsquo;s
failure model.</p>
<h2 id="scope-is-both-context-ownership-and-a-concurrency-key">Scope is both context ownership and a concurrency key</h2>
<p>Every run moves through five states:</p>
<table>
	<thead>
			<tr>
					<th>State</th>
					<th>Meaning</th>
			</tr>
	</thead>
	<tbody>
			<tr>
					<td><code>queued</code></td>
					<td>Durable work exists but has not acquired its execution lane.</td>
			</tr>
			<tr>
					<td><code>running</code></td>
					<td>The run owns its <code>(tenant, agent, scope)</code> lane.</td>
			</tr>
			<tr>
					<td><code>succeeded</code></td>
					<td>Canonical output and related durable state were finalized.</td>
			</tr>
			<tr>
					<td><code>failed</code></td>
					<td>Execution ended without a successful result.</td>
			</tr>
			<tr>
					<td><code>cancelled</code></td>
					<td>Cancellation won and successful finalization is no longer allowed.</td>
			</tr>
	</tbody>
</table>
<p>The tuple <code>(tenant, agent, scope)</code> is the serialization boundary. Runs for the
same tuple execute one at a time; unrelated scopes can run concurrently. The
claim is transactional, and the database also enforces that at most one run for
a scope is <code>running</code>.</p>
<p>Using scope for both rolling context and serialization is deliberate. If two
turns can modify the same conversation history concurrently, the runtime needs
a merge policy or a clear winner. <code>agentd</code> avoids inventing one: a scope has one
active owner. A Telegram chat can use <code>tg:&lt;chat_id&gt;</code>; a game can use a match and
seat identifier; another caller can define a different stable boundary.</p>
<p>This is not distributed locking. It is single-database coordination for one
host. There is no multi-process lease protocol, failover, or replication claim.</p>
<p>A process restart also has an explicit, conservative outcome. On startup,
persisted runs that were <code>running</code> become <code>failed</code> with an <code>agentd restarted</code>
error, while durable queued work remains available to the dispatcher. The
runtime does not try to reconstruct the interrupted model/tool loop or silently
execute it again. That avoids pretending an in-flight external effect is safe to
repeat, at the cost of requiring a caller or operator to decide whether a failed
turn should be resubmitted. More sophisticated recovery would need an explicit
side-effect protocol, not just a different status update.</p>
<h2 id="submission-idempotency-is-not-replay">Submission idempotency is not replay</h2>
<p>An optional <code>request_id</code> is unique within a tenant. Repeating the same
submission returns the existing run instead of creating another one. This is
useful when an HTTP client cannot tell whether its first request succeeded.</p>
<p>But request deduplication does not make the whole agent execution replayable.
During a run, the model can call tools, an MCP server can affect another system,
and a transport can deliver a message. Those effects do not become reversible
because the initial request had an idempotency key.</p>
<p>The raw <code>run_log</code> records model, tool, output, status, and error observations.
It is an inspection trace, not a deterministic re-execution engine. There is no
side-effect ledger, rollback protocol, or replay simulator. Calling these
different properties by different names prevents a comforting but false
exactly-once story.</p>
<h2 id="the-model-chooses-the-host-constrains">The model chooses; the host constrains</h2>
<p>An agent is configuration rather than executable plugin code: persona, model,
allowed capability families, limits, temperature, token budget, and context
window. The native loop sends visible schemas to an OpenAI-compatible provider,
validates the returned tool call, executes it in host code, records the result,
and continues until the model produces final JSON or reaches a boundary.</p>
<p>The public alpha has 15 built-in capabilities across artifacts, memory,
schedules, clock, bounded public-web access, and arithmetic. It intentionally
has no generic shell, arbitrary HTTP request, hidden filesystem handle, approval
queue, or operator execute endpoint.</p>
<p>MCP extends the tool catalog without changing that ownership model. Servers
belong to a tenant, discovery is explicit, exposed names must be unique, and an
allowlist can narrow the discovered catalog. Secret configuration stores the
names of environment variables rather than their values.</p>
<p>That is a capability boundary, not a sandbox. An operator-configured stdio MCP
process runs with the <code>agentd</code> OS user&rsquo;s host and network permissions. A model
can also be persuaded by a malicious prompt or tool result to call any capability
it can see. The safe rule is therefore simple: expose only side effects that are
acceptable without human approval, and isolate untrusted MCP servers outside
the runtime.</p>
<h2 id="successful-finalization-has-one-transaction-boundary">Successful finalization has one transaction boundary</h2>
<p>The most important write path happens after the model loop has produced a
successful result. One database transaction commits:</p>
<ul>
<li>the canonical output and <code>succeeded</code> run status;</li>
<li>the terminal trace event;</li>
<li>the bounded rolling context;</li>
<li>and, when explicitly requested, one pending delivery referencing the run.</li>
</ul>
<p>If cancellation has already changed the run state, successful finalization is
rejected. A cancelled run cannot leave behind successful output, updated
context, or a delivery row. A second finalization is rejected as well.</p>
<p>This transaction does not roll back external tool effects that occurred before
it. Its guarantee is narrower: readers do not observe a successful run whose
output, terminal trace, context, and delivery intent disagree with one another.
That is the consistency boundary the runtime can actually own.</p>
<h2 id="delivery-is-durable-intent-not-a-callback-hidden-in-execution">Delivery is durable intent, not a callback hidden in execution</h2>
<p>Every successful result is pullable. Delivery exists only when the caller
provides an explicit destination such as <code>tg:42</code>; scope is never silently
treated as an address.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-text" data-lang="text"><span style="display:flex;"><span>Telegram -&gt; webhook -&gt; turn with explicit tg:&lt;chat_id&gt; destination
</span></span><span style="display:flex;"><span>agentd    -&gt; atomic run finalization -&gt; delivery outbox
</span></span><span style="display:flex;"><span>adapter   -&gt; claim -&gt; Telegram API -&gt; acknowledge
</span></span></code></pre></div><p>Delivery rows reference the run instead of copying its output. An adapter
claims pending work with a random token and expiry, performs the remote side
effect, and acknowledges one of <code>delivered</code>, <code>retry</code>, or <code>failed</code>. An expired
claim can be issued again; a retry updates the same row rather than inserting a
new delivery.</p>
<p>The independent
<a href="https://github.com/minifish-org/agentd-telegram-adapter"><code>agentd-telegram-adapter</code></a>
uses exactly this interface. Its webhook path submits a turn and asks for an
explicit Telegram destination. It does not send a direct reply from the webhook
handler and does not fall back to polling run output as a second delivery path.
This removes two easy sources of duplicate messages.</p>
<p>The outbox still cannot prove that a remote system performed an effect if the
adapter crashes before acknowledgement. Claim expiry and retry make recovery
possible; they do not manufacture exactly-once semantics from an external API.</p>
<h2 id="state-is-separated-by-meaning-not-by-service-count">State is separated by meaning, not by service count</h2>
<p>The runtime uses one libSQL database. The schema separates responsibilities:</p>
<ul>
<li>runs own activation, status, canonical output, and requested destination;</li>
<li><code>run_log</code> owns raw execution observations;</li>
<li>contexts own recent messages for a scope;</li>
<li>memory owns explicit durable facts plus lexical and semantic indexes;</li>
<li>artifacts own larger payloads;</li>
<li>deliveries own remote-delivery state and retry fields;</li>
<li>schedules and MCP registrations remain tenant-scoped resources.</li>
</ul>
<p>This is intentionally less infrastructure than earlier prototypes. There is no
separate object store, vector service, audit database, or replay database. The
memory implementation keeps canonical text, an FTS5 index, and a pinned
384-dimension E5 embedding together; lexical and semantic ranks are fused with
RRF.</p>
<p>The trade-off is equally explicit: this pre-1.0 runtime does not preserve schema
or HTTP compatibility. Runtime data is treated as disposable. A schema mismatch
requires <code>--reset-data</code>, not a migration. That is acceptable for the current
personal-runtime scope, but it would not be an acceptable default for a mature
multi-user platform.</p>
<h2 id="design-claims-should-point-to-executable-evidence">Design claims should point to executable evidence</h2>
<p>The repository includes a
<a href="https://github.com/minifish-org/agentd/blob/main/docs/reliability.md"><code>reliability matrix</code></a>
that maps each important property to a named test. The current suite covers
tenant-scoped request deduplication, same-scope serialization, failed-agent lane
release, atomic finalization, cancellation races, pull-only success, delivery
reclaim and acknowledgement, MCP scoping, public-web network boundaries, memory
scoping, schema mismatch, and non-loopback authentication requirements.</p>
<p>There is also a credential-free deterministic demo:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-sh" data-lang="sh"><span style="display:flex;"><span>git clone https://github.com/minifish-org/agentd.git
</span></span><span style="display:flex;"><span>cd agentd
</span></span><span style="display:flex;"><span>./scripts/demo-e2e.sh
</span></span></code></pre></div><p>It starts a loopback OpenAI-compatible fixture, starts <code>agentd</code> with a fresh
database, creates a tenant and agent, submits a turn, waits for the result,
inspects the trace, verifies pull-only behavior, and exercises artifact storage.
The first run downloads about 448 MiB of revision- and checksum-pinned embedding
assets.</p>
<p>The fixture proves the documented runtime and API path. It does not prove model
quality, real-provider tool compatibility, prompt-injection resistance,
streaming behavior, or production latency. The release workflow separately runs
the real embedding smoke test and builds and inspects the complete container
image.</p>
<h2 id="the-gaps-are-part-of-the-design-document">The gaps are part of the design document</h2>
<p>The public alpha does not claim evidence for:</p>
<ul>
<li>process-kill fault injection at every transaction boundary;</li>
<li>multi-process or multi-host coordination, failover, or replication;</li>
<li>compatibility across database schema or HTTP versions;</li>
<li>load, soak, latency, quota, or denial-of-service limits;</li>
<li>deterministic replay or rollback of external tool effects;</li>
<li>sandboxing of operator-configured MCP processes;</li>
<li>behavior against every provider, MCP server, or transport adapter;</li>
<li>model safety or factual correctness.</li>
</ul>
<p>Its bearer token is an instance-wide operator credential, not end-user
authentication. Tenants provide resource namespaces; they do not isolate
mutually distrustful users who share that token. TLS termination, rate limits,
backups, and host-level resource isolation remain deployment responsibilities.
The full boundary is documented in the
<a href="https://github.com/minifish-org/agentd/blob/main/docs/threat-model.md"><code>threat model</code></a>.</p>
<p>Publishing these gaps is useful because an experimental system is easiest to
overstate precisely where its tests end. A reliability matrix should show both
the properties under test and the empty cells.</p>
<h2 id="what-building-it-changed-for-me">What building it changed for me</h2>
<p>My distributed-database background makes me look for ownership, monotonic
boundaries, and failure states before adding features. <code>agentd</code> applies those
habits at a smaller scale:</p>
<ol>
<li>A conversation scope needs an execution owner, not just a string in a prompt.</li>
<li>Idempotent submission, deterministic replay, and external-effect recovery are
separate problems.</li>
<li>Successful output is not complete until related durable state agrees at one
transaction boundary.</li>
<li>Transport integration belongs outside the runtime, but its delivery intent
must still participate in finalization.</li>
<li>A tool catalog is a security boundary only when the host validates it and the
deployment respects what the host cannot isolate.</li>
<li>Tests and explicit omissions are stronger project documentation than a long
feature list.</li>
</ol>
<p><code>agentd</code> remains experimental. It is not a general workflow engine, an HA agent
platform, or a sandbox for untrusted code. It is a public attempt to make one
personal-agent turn durable, scoped, inspectable, and deliverable—and to state
precisely where those guarantees stop.</p>
<p>Source, release notes, and the reproducible demo are available in the
<a href="https://github.com/minifish-org/agentd"><code>minifish-org/agentd</code></a> repository under
Apache-2.0.</p>
]]></content:encoded>
    </item>
  </channel>
</rss>
