The AI Operating Stack for Apps, Data, and Machines
TL;DR
Start with a TypeScript app, Postgres, object storage and one durable runner, using Python for workloads that need its libraries. Assign state ownership before adding components. Test replay, backups and cost per accepted result on the actual task.
Assign each kind of state to an owner and choose a machine and workflow engine from measured work.
Suppose a creator uploads a workshop recording and leaves for the night. The capture completes. Transcription starts. The application restarts halfway through. In the morning, the creator should find the intact source, a legible status, and a way to retry the failed work without uploading again or paying twice for a completed stage. That is a more useful architecture prompt than asking which agent framework to adopt.
This is the technical companion to Build the Systems You Need. The public First Agent Primer gives you a smaller starting point. Add the pieces below as your own work exposes the need.
Give every kind of state an owner
| Responsibility | Practical default | Reason to move |
|---|---|---|
| App and review screen | TypeScript, Next.js, Vercel for an existing Next.js estate | Move a route when measured latency, cost, residency or runtime limits justify the migration. |
| Business records | Managed Postgres, with SQL migrations and explicit tenant policies | Use a separate data system when a measured access pattern or isolation requirement exceeds what you can operate safely in Postgres. |
| Originals and renditions | R2 or equivalent object storage, with metadata and rights in Postgres | Change when delivery, residency, retention or migration cost changes the decision. |
| Long-running work | One durable runner per workflow. Cloudflare Workflows for Cloudflare-owned actor flows, or the existing platform-native runner for app-owned jobs | Choose Temporal for a broader orchestration requirement when the team can operate and test its workflow semantics. Keep n8n where connector work benefits from a visual workflow. |
| Model output and media processing | TypeScript for domain contracts. Python for ML and media libraries | Add a service or language when library fit, resource isolation or measured workload demands it. |
| Source and delivery | GitHub for contracts, migrations, policy and release history | Keep secrets in a managed secret store and use short-lived workload credentials where supported. |
A typical upload creates the asset reference, job and outbox record in one database transaction. A dispatcher can publish the outbox entry more than once. Give the consumer a stable key and reconcile each externally visible effect against its own receipt. Keep actor coordination state local to the actor. Store canonical business facts in Postgres, large binary objects in storage, and model-produced observations with their provenance and review status. Enforce tenant policies with scoped roles and review any service role that bypasses them. Test both recovery of the database and that restored references resolve to the right stored objects. AWS outbox pattern · Supabase RLS · Supabase backups · Cloudflare R2 · GitHub OIDC
Give autonomy a specific job
Anthropic’s engineering guide distinguishes workflows with prescribed paths from agents that direct their own tool use. The distinction matters at the point where work becomes an effect. An agent can choose how to find a supporting excerpt. A publication step takes a particular revision, an authorized reviewer and a recorded action. A rejected or superseded revision stays visible to the operator. Anthropic engineering
Cloudflare describes persisting step progress, attempts and completion for durable execution. Temporal documents replay of workflow history. n8n documents a queue execution mode with workers for a different operational fit. The choice is which system should own retries and recovery for this job. A durable workflow will still reach a provider call whose outcome may be unknown after a timeout. Design that step to look up the result, reconcile it or ask for help before resending. Cloudflare Workflows · Temporal · n8n queue mode
Buy a machine for a workload you can describe
Start with the computer you have. Use local storage and local models for a sample of privacy-sensitive or repetitive work when the full data path can stay local. Keep a hosted model available for tasks where it materially improves the result. Rent a GPU to test heavier batch work before committing capital. The shape of the workload matters: Apple’s MLX targets Apple silicon, while llama.cpp supports several hardware backends. Benchmark the model, quantization, input length and concurrent work you expect to run. Confirm where raw files, telemetry and backups travel before calling a job private. MLX · llama.cpp
Compare cost per accepted result, queue delay, reviewer minutes, uptime needs and what it takes to restore the machine or move the job. Count electricity, depreciation and operator time for a local box. Count storage, idle capacity, transfer and failed runs for cloud. Run the same permitted sample through both. The machine is a good purchase when the evidence survives a representative week of work.
Keep a scorecard per workload. Divide the full cost of attempts and review by the number of outputs an operator accepted against the same criteria. Keep time-to-usable-result beside it, with the slowest runs visible. For a workshop packet, an accepted result might require referenced excerpts, usable captions, a clean export and a reviewer’s sign-off. A cheaper transcript that takes longer to repair costs more in the metric that matters.
Make a failure part of the demo
Use one permitted recording, then run the workflow twice. Interrupt a worker while a result is pending. Restore a backup in an isolated environment. Verify that a different workspace cannot see the record. Check that the original file, accepted output and status history can be exported. Trace the job from intake to receipt with a stable run ID and agree on how long an operator can tolerate a stalled item before an alert. Collect the baseline before adding architectural complexity. OpenTelemetry conventions · Google SRE
Continue to wallets, money and operating authority · Explore FrankX AI architecture
Read on FrankX.AI — AI Architecture, Music & Creator Intelligence
Stay in the intelligence loop
Field notes on AI systems, production patterns, and builder strategy.
Continue Reading

Wallets, Ledgers, and Authority in an AI Business
Design checkout, wallets, accounting and agent authority as separate controls, with a practical reconciliation loop and clear human ownership.
Read article
Cyber Monday for AI Developers: Cut LLM Spend Without Flash Sales
Claude Code, Cursor, and Vercel rarely discount on Cyber Monday. Cut engineering token spend 50-80% with prompt caching, Batch API, and model routing.
Read article
How to run an Apify Actor and verify its dataset
Run a one-page Apify Actor, retrieve its dataset through the API, and check the source before handing the output to an agent or a teammate.
Read article