Technology choices follow boundaries
Five projects, four implementation languages and several agent runtimes. That is not a lack of standardisation. Each choice serves the boundary its project is about. The ideas carry over to other stacks. The point of this chapter is which property each choice was bought for, so you can buy the same property elsewhere.
| Boundary | Choice | Property it buys | Where |
|---|---|---|---|
| Identity at the edge | Rust gateway (BFF) with Keycloak OIDC + PKCE | small, memory-safe, auditable code at the most exposed hop; opaque sessions | Parts I, III |
| Capability surface | MCP servers in a separate process (Rust rmcp; AshAI in Elixir) | the tool list is the capability; the credentials for the data stay in the tool service, while the agent runtime holds only a service credential the model never sees | Parts I, III, IV, V |
| Agent loop | Rig + Rust in Part I; NAT + Python in Part III; LangGraph.js in Part II | different orchestration implementations behind explicit application boundaries | Parts I–III |
| Deterministic tool policy | explicit Rust schemas and ToolPolicy | model calls are proposals; ordinary code decides whether a call is allowed, approval-gated or denied | Part I |
| Deterministic policy | Rust interpreter over a JSON specification | policy reviewed as data, validated at boot; exhaustive matching | Part III |
| Domain authority | Elixir + Ash: declarative resources, actions, policies, AshStateMachine | one definition of who may do what, enforced identically for UI, REST and AI | Part V |
| Secret handling | Rust with purpose-typed keys, zeroisation, SQLCipher | misuse of one key for another purpose does not compile; bounded secret lifetimes | Part IV |
| Durable runtime | TypeScript, LangGraph.js, SQLite, one Node process | small enough to read end to end; explicit graph, checkpoints in one file | Part II |
| Invariants | PostgreSQL constraints, unique indexes, row locks, triggers | guarantees that hold even if application code is wrong | Parts I, III, V |
| Observability | OpenTelemetry as the boundary; MLflow is the current Part I/III backend | one trace per request without tying instrumentation to the agent framework | Parts I, III |
Part I is especially instructive because one row of this table already changed. The agent was originally Python on NVIDIA NeMo Agent Toolkit and is now Rust on Rig. The gateway, MCP server, service contract, approval verifier, evaluation specification and OpenTelemetry boundary did not need to become framework concepts. The migration is therefore evidence that the boundaries were designed at the right level.
Keeping credentials from the model is not keeping them from the runtime
It is tempting to read "the model holds no credentials" as "the agent process holds no credentials". They are different claims, and only the first is true in these projects:
- In Part I, the trusted Rust agent runtime holds
MCP_API_KEY, and with approvals enabled it also holdsHITL_APPROVAL_SECRETto mint approval tokens. The model sees neither secret. - In Part III, the trusted NAT runtime holds its MCP service credential and the shared approval-signing secret.
- In Parts IV and V, the MCP client that the agent runs in holds an API key
(Arktos's
X-API-KEY, a Tauros agent key). Whoever holds that key acts as that wallet owner or that agent.
So the rule these systems follow is narrower and more precise:
- Secrets stay out of model-visible context and tool arguments. No prompt, tool description, tool result or model-proposed argument carries a credential. Part I's telemetry code also prevents credential headers from entering exported spans.
- Trusted runtime components hold the credentials their responsibility needs. The agent runtime authenticates to the tool service. The approval signer signs. The tool service holds the database or key material.
- Prompt injection and runtime compromise are different threats. An injection changes what the model says and requests. Capability surfaces, deterministic policy and point-of-mutation checks contain it. A compromise of the runtime process or its environment changes what trusted code does. An attacker there can call tools with the runtime's credential. In Parts I and III they can also mint approval tokens because the HMAC secret is shared by signer and verifier.
- Backend verification has a defined trust model. The MCP server recomputes state, checks policy and enforces single use. A forged token therefore cannot apply an impossible or stale change. But the server accepts any correctly signed token as a human decision. Recomputation does not make a compromised signer harmless. (Approvals — the trust model.)
Patterns behind the choices
Put the strongest guarantee in the lowest layer that can hold it. A type that cannot be constructed (Arktos's key purposes) beats a runtime check. A database constraint (Tauros's one approval per revision) beats an application check. An application check beats a prompt instruction. Every project places at least one guarantee as low as it can go and tests it by bypassing the layers above.
Make the authority-bearing code small and boring. The gateway, MCP servers, rules engine and mutation paths are deterministic and heavily tested. The probabilistic parts are allowed to be fuzzy because nothing authoritative should depend on their unverified output.
Use a framework's abstractions, but model your own concepts. Sophos needed runs although LangGraph has threads and checkpoints. Tauros's invoice revisions are a domain concept, not an ORM version table. Part I's execution state belongs to the application even though Rig has its own runner state. A framework identifier is not a product concept.
Local-first is a property of data flows, not of where the model runs. Sophos lesson R8 enumerates the network paths that remain after the model is local. Apply the same audit to any "self-hosted" claim, including Arktos's custody model.
What the choices do not imply
- They are not endorsements of a single stack for production. Each project documents what it would need to change before production.
- Rust does not make a component secure. In Arktos, for example, the server listens on plain HTTP and expects TLS from the deployment.
- MCP is a protocol, not a security model. Its safety comes from what you expose and how callers are authenticated and authorised.
- A framework migration that succeeds once is not proof that every replacement is safe. It gives you a set of invariants and tests to carry into the next migration.
Buying the same property elsewhere
Every row of the table above names a property and one way to buy it. Most of those properties can be bought in other ways too: from a different framework, a policy engine, a managed cloud service, an open protocol or code you own. Part I gives a real example: the NAT → Rig/Rust migration changed the framework while preserving the architectural boundaries.
When you substitute a component, the questions do not change:
- Which property did the original choice provide, and which trust boundary does it belong to?
- Does the replacement provide that property, provide something adjacent to it, or leave it to you?
- What new trust does the replacement ask for? A managed service, a policy engine or a wallet provider becomes part of your trusted computing base.
Where CognoKratos fits maps the boundaries to external projects, and each part ends with a chapter on what must survive such a substitution.