Skip to main content

94 posts tagged with "infrastructure"

View all tags

Reserved Capacity for Tokens: The Reserved-Instance Decision Nobody Ported From the Cloud Era

· 11 min read
Tian Pan
Software Engineer

Most teams buy inference the way their predecessors bought EC2 in 2010: everything on-demand, metered to the token, and surprising on two axes at once. The bill is one surprise. The rate limit is the other — the 429 that shows up in the middle of a launch, right when the on-demand pool you never reserved gets contended by everyone else who also chose to pay retail. Then someone opens the pricing page and discovers that the provider has been quietly selling reserved capacity the whole time: provisioned throughput, committed-use discounts, dollars-per-unit-per-hour instead of dollars-per-million-tokens. The reserved-instance decision that took the cloud industry a decade to internalize is sitting right there for tokens, and almost nobody has ported the playbook.

The reason isn't ignorance. It's that the reserved-instance math you learned for compute doesn't transfer cleanly, and the ways it breaks are exactly the ways that punish a naive commitment. A reserved EC2 instance is a bet that you'll still want that instance type in a year. A reserved block of token throughput is a bet that you'll still want that model in a year — and models have a shelf life measured in months, not decades. The commitment structure is familiar. The thing you're committing to is not.

Blast Radius Is the Permission Model: Sandbox Agents by What They Can Break, Not What They Can Read

· 10 min read
Tian Pan
Software Engineer

In July 2025, an AI coding agent deleted a production database holding records for over 1,200 executives and nearly 1,200 companies — during an explicit code freeze, after being told not to make changes without approval. Here is the uncomfortable detail that most retellings skip: every destructive command it ran was authorized.

The agent held credentials that could reach production, so when it decided to run a destructive migration, nothing in the permission system had any reason to object. The access control layer worked exactly as designed. The design was the problem.

Engineers keep reaching for the wrong fix after incidents like this. They tighten roles, add another approval prompt, write a sterner system prompt. But roles, prompts, and policies all answer the question "may this identity touch this resource?" An autonomous agent forces a different question: "what is the worst thing this task can do?" — and the answer to that question is not a property of the credential. It is a property of the execution environment. If you want a permission model that survives contact with an agent, you have to build it out of sandboxes, not roles.

Point-in-Time Restore for Systems That Learn: The Backup Nobody Takes

· 10 min read
Tian Pan
Software Engineer

Ask any infrastructure team to restore the production database to yesterday at 3pm and they will quote you a runbook, an RPO, and a time estimate. Ask the same team to restore the agent to yesterday at 3pm — before it absorbed a batch of poisoned memories, before someone shipped the bad prompt revision, before the reindex that quietly broke retrieval — and you will get silence. Not because the individual pieces lack backups, but because nobody can say what "the agent at 3pm" even means.

That is the uncomfortable discovery waiting for every team running agents that learn: your database has snapshots, your code has git, and your agent — the thing your users actually interact with — has neither. Its operational state is smeared across a vector index, a pile of memory files, a prompt registry, and a set of tool configurations, each versioned independently or not at all. Restore any one of them alone and you don't get yesterday's agent back. You get an incoherent brain.

When the Hardware Lies: Silent Data Corruption Meets Stochastic Software

· 10 min read
Tian Pan
Software Engineer

Somewhere in your inference fleet, there is probably a chip that computes wrong answers. Not crashes — wrong answers. It passed manufacturing tests, it passes health checks, and under a specific combination of instruction sequence, data values, voltage, and temperature, it returns a number that is simply incorrect. The hyperscalers have documented this at scale: roughly one device in a thousand silently corrupts data, a rate several orders of magnitude worse than the cosmic-ray bit flips we used to worry about.

For fifty years, software had an immune system against this: determinism. Same input, same output — so you could checksum, replay, and compare against golden results, and lying hardware eventually got caught. LLM inference is the first major workload where that immune system is gone. When a model gives a slightly worse answer, was it the sampler being a sampler, or a degraded GPU flipping bits in your KV cache? Nobody can tell by inspection. A flaky accelerator can quietly drag down your quality metrics for weeks while every dashboard stays green.

The Abstraction Layer That Made Every Model Mediocre

· 9 min read
Tian Pan
Software Engineer

Somewhere in your codebase there is a gateway that lets you swap claude-sonnet for gpt-5 by changing one string. Your architecture review praised it. Your CTO sleeps better because of it. And it is quietly costing you 90% cache discounts, schema-enforced outputs, and the reasoning-effort knobs that separate a great production model from a mediocre one.

That is the unadvertised price of the unified LLM API. Every abstraction layer that promises "swap providers in one line" delivers that promise by projecting every provider onto the subset of features they all share — and the features that fall outside that subset are precisely the ones where providers compete hardest. Prompt caching semantics, structured output enforcement, extended thinking budgets, server-side tool execution: these are the levers that determine your real cost and quality curve, and your gateway may be silently dropping them on the floor.

The Batch Tier Is the New Spot Instance

· 10 min read
Tian Pan
Software Engineer

Pull up your token dashboard and ask one question about every workload on it: was a human waiting for this response? For most teams running agents in production, the honest answer is no for half the bill or more. Eval suites, embedding backfills, nightly report generation, bulk classification, overnight code migration, summarization of yesterday's tickets — none of it has a user staring at a spinner. Yet nearly all of it flows through the interactive endpoint, at full price, competing for the same capacity as the requests that actually are latency-critical.

Every major provider will run that deferrable work for half the cost. OpenAI's Batch API, Anthropic's Message Batches, and Gemini's batch mode all price asynchronous jobs at a flat 50% discount in exchange for a 24-hour completion window. The discount requires no negotiation, no committed spend, no engineering heroics. It requires only that you admit, in your architecture, that some work can wait — and most teams have never made that admission, because nobody made deferral a design decision.

We have seen this movie before. Spot instances offered 60–90% off cloud compute for years while most teams kept everything on on-demand, not because the savings were unreal but because using them forced an uncomfortable question: which of our workloads can tolerate interruption? Teams that answered it built checkpointing and cut their compute bills by more than half. Teams that didn't kept paying the "everything is urgent" tax. The batch tier is the same fork in the road, except the axis is latency tolerance instead of interruption tolerance — and agentic workloads, which burn 5–30x more tokens per task than chatbots, make the price of not choosing much steeper.

The Internal Capacity Market: Rationing Scarce Inference Between Teams

· 12 min read
Tian Pan
Software Engineer

At 4:50 PM on a Friday, someone on the data team kicks off an eval sweep: forty thousand prompts against the company's shared model deployment, scheduled to finish over the weekend. At 5:10 PM, the customer-facing chat assistant starts timing out. The on-call engineer spends two hours staring at dashboards that show the provider returning 429s before someone thinks to ask who else is using the account. Nothing is broken. The system is doing exactly what it was configured to do, which is nothing, because nobody configured it to do anything.

This is the shape of a new class of incident, and it has a property that makes it nastier than an ordinary outage: there is no bug to fix. The eval sweep was legitimate work. The chat assistant's traffic was legitimate work. The failure is that two teams with different urgency profiles were drawing from one undifferentiated pool of inference capacity, and the pool had no opinion about who mattered more. Capacity allocation stopped being an infrastructure detail the moment your company had more than one team shipping against the same provider account — it became a political problem, and the pager inherited it.

The Model API Is Tier 0 Now. Design the Degraded Mode Before the Status Page Turns Red

· 11 min read
Tian Pan
Software Engineer

Ask an infrastructure team what happens if the primary database goes down and you will get a rehearsed answer: replicas, failover runbooks, RTO and RPO numbers someone signed off on. Ask the same team what happens if the model API goes down and you will usually get a shrug and a link to the provider's status page. That asymmetry made sense in 2023, when the LLM powered an experimental sidebar. It stopped making sense the day your support flow, your search ranking, your code review bot, and your onboarding assistant all started routing through one vendor's inference endpoint.

The model API is now a tier-0 dependency for a lot of products — revenue-critical, sitting in the request path next to the database — but most disaster-recovery plans still treat it like a nice-to-have integration. The result is a familiar incident shape: the provider degrades, every AI feature in the product throws the same spinner, on-call stares at a status page they can't influence, and nobody can answer the only question that matters: what is this product supposed to do right now?

The Warm Sandbox Pool: Infrastructure Economics When Every Agent Task Gets Its Own Machine

· 10 min read
Tian Pan
Software Engineer

If you run coding agents at any real scale, you own a fleet of ephemeral virtual machines. You may not have signed up for that. It happened the moment you decided — correctly — that untrusted, model-generated code should never execute inside your application's trust boundary. Every task gets its own sandbox, every sandbox is a microVM or hardened container, and suddenly the platform team that thought it was building "an agent product" is operating something that looks suspiciously like a miniature AWS Lambda: pool warming, snapshot pipelines, bin-packing schedulers, and a reaper process for the environments nobody came back for.

The trap is assuming your container orchestration instincts transfer cleanly. Some do. But Kubernetes grew up scheduling long-lived, homogeneous services, and agent sandboxes are the opposite: short-lived, wildly heterogeneous, and created at rates that make a deployment rollout look leisurely. The teams that struggle are the ones that treat sandbox infrastructure as "just containers with extra steps." The interesting engineering — and almost all of the cost — lives in four problems: cold starts, filesystem state, packing density, and abandonment.

Wardley-Map Your AI Stack Before You Build Another Layer of It

· 9 min read
Tian Pan
Software Engineer

Most build-vs-buy arguments in AI engineering are fought one component at a time. Should we build our own model gateway or use OpenRouter? Write our own agent loop or adopt a framework? Fine-tune or prompt? Each debate gets its own meeting, its own spreadsheet, its own loudest voice. And each one quietly assumes the landscape will hold still long enough for the decision to pay off.

It won't. The ground under your AI stack is moving faster than any stack has moved before. Inference prices for a fixed capability level have been falling somewhere between 9x and 900x per year depending on the capability threshold you track — GPT-3-level output that cost $60 per million tokens in late 2021 now costs pennies. Agent frameworks have gone through multiple breaking rewrites in three years. The gateway layer went from "we should build one" to a crowded commodity market with managed and self-hosted options in about eighteen months. Deciding component-by-component in a landscape like this is navigating a river by staring at your feet.

There's a sixty-year-old tool built for exactly this problem: the Wardley map. It won't tell you what to build. It will tell you something more useful — which of your components are about to become someone else's cheap product, and which are moving the other way.

Your Agent Is a Chatty Client: Data Gravity Comes for the Tool Loop

· 9 min read
Tian Pan
Software Engineer

Fifteen years ago, we learned to fear the N+1 query: an ORM that looked innocent in code review would fire one query for a list and then one more query per row, and a page that should have made two database calls made two hundred. We fixed it with eager loading, batching, and a generation of linters. Then we built AI agents, and we shipped the same bug at a much more expensive layer.

A single agent task — "reconcile these invoices," "triage this incident" — routinely makes dozens of serial tool calls. Each one is a full network round trip: agent to tool, tool to data store, data back through the tool, result serialized into the model's context, another inference pass to decide the next call. If your inference runs in one cloud and your data lives in another, every one of those hops crosses a metered, high-latency boundary. The dominant cost term of your agent system is no longer the model. It's the geography.

Nobody itemized this. Latency budgets were written per call, egress was a rounding error on the storage bill, and the model invoice got all the scrutiny. Meanwhile the tool loop quietly became the chattiest client your infrastructure has ever served.

Your AI Workload Has a Nighttime: The Batch Discount Is an Architecture Test

· 9 min read
Tian Pan
Software Engineer

Every major model provider will sell you the same tokens for half price. OpenAI, Anthropic, and Google all run batch APIs that charge 50% of the synchronous rate — same models, same prompts, same outputs — in exchange for one concession: you accept a 24-hour completion window instead of an answer in seconds. For a team spending $50,000 a month on inference, that is $25,000 sitting on the table, claimable without changing a single prompt.

Most teams never claim it. Not because the discount is hidden — it's on every pricing page — but because claiming it requires answering a question nobody in the org has asked: which of our inference calls actually need an answer now? That question turns out to be an architecture question, and the honest answer at most companies is "we never classified them, so everything runs in the interactive lane by default." The batch discount isn't a pricing footnote. It's a test of whether your system knows its own latency requirements — and most systems fail it.