Office Hours — What's the practical difference between using installable AI agents versus API-based approaches for production applications?
A daily developer question about AI/LLMs, answered with a direct, opinionated take.
What’s the practical difference between using installable AI agents versus API-based approaches for production applications?
The choice between installable and API-based AI agents fundamentally shapes your cost structure, latency, security posture, and operational complexity. Both approaches work in production today, but they fail in different ways and succeed under different constraints.
Installable agents: You own the runtime, but you pay for it always
When you install an agent locally (whether it’s Claude Code running on your machine, an open-weight model on your infrastructure, or a self-hosted agent framework), you’re responsible for the entire execution environment. The model weights live on your hardware. The inference runs on your compute. You don’t make API calls; you make function calls.
The advantage is straightforward: no egress latency for tool calls, no variable API bills tied to token volume, no external dependency on a provider’s availability. If you’re processing sensitive data or operating in an air-gapped environment, this is often mandatory. If you’re running a coding agent that needs to execute hundreds of tool calls against your codebase in tight loops, the latency difference between local execution and round-trip API calls compounds quickly.
The cost model looks clean until you measure what you’re actually doing. Running Claude Fable 5.1 or Gemini 3.5 Flash locally requires GPUs. H100 costs roughly $3 per hour to rent. If your agent runs continuously and makes inefficient tool calls (which they do—research from early October 2026 showed coding agents waste significant compute even when they reach solutions), you’re burning through compute whether the agent is productive or idle. The infrastructure is always on.
API-based agents: Pay per use, but surrender control
With API-based approaches—calling Claude Opus 5 or GPT-6 Astra through their APIs—you pay for tokens consumed. The model runs on the provider’s infrastructure. Your application makes HTTP calls and waits for responses.
The cost structure is brutal at scale but granular: you only pay for what you use. If your agent idles, you’re not paying. If it does useful work, you pay for tokens. This aligns incentives tightly with agent efficiency. A poorly designed agent that loops and retries burns tokens fast, and that’s visible in your bill the same day.
The latency trade-off is real. Each agent action becomes a round-trip: formulate the request, send it over the network, wait for inference, parse the response, decide on the next action. For agents that make 50+ tool calls per task (which is common), this adds up. A local agent with low-latency tool access might complete a task in 30 seconds; the same agent over API might take 2–3 minutes. The January 2026 research on agent token waste showed that multi-agent systems burn 5.1x more tokens for marginal quality gains, and latency per call is part of why coordination costs explode.
On security, API-based approaches mean your prompts and intermediate reasoning flow through a third party’s servers. If you’re handling regulated data (healthcare, finance, legal documents), this is a compliance problem. Some regulated environments simply don’t allow it. Local inference sidesteps this entirely, though it creates a different risk: you’re now responsible for model security, updates, and the integrity of the runtime.
A concrete comparison: Document processing at scale
Let’s say you’re building an agent that extracts structured data from incoming PDFs and populates a database.
Local agent approach:
- You deploy Claude Fable 5.1 or an open-weight equivalent on a GPU instance.
- Each PDF triggers the agent to (1) read the file, (2) identify relevant sections, (3) extract fields, (4) validate against schema, (5) write to database.
- Total wall-clock time per document: ~45 seconds (low latency, local tool access).
- Infrastructure cost: $3/hour for H100 rental. Processing 100 documents takes roughly 1.25 hours, so $3.75 in compute.
- If the agent is running continuously, you’re paying $72/day whether you process 10 or 1000 documents.
API-based approach:
- Each PDF submission calls Claude Opus 5 via the API ($3/$15 per M tokens).
- Same agent logic, but each tool call goes over the network: ~500ms round-trip latency per action.
- Total wall-clock time per document: ~3–4 minutes (latency-bound).
- Token cost per document: ~2000 input + ~500 output tokens (PDFs are expensive). At Opus 5 pricing, that’s roughly $0.095 per document.
- Processing 100 documents takes 5–7 hours of wall-clock time, costs ~$9.50 in API fees.
If you process documents sporadically or in small batches, the API approach is cheaper. If you process them continuously at high volume, the local approach wins on hourly cost. But the latency difference is non-trivial for the local approach—you’re done in 1.25 hours versus 5–7 hours.
The hybrid trap
Many teams start with this split: local inference for latency-sensitive tasks, API calls for expensive reasoning or when you need the latest models. This sounds good in theory. In practice, you’re now maintaining two agent architectures, two sets of failure modes, and two cost tracking systems. A coding agent that can run locally might still call GPT-6 Astra for high-stakes architectural decisions. You save money on volume but lose operational simplicity.
What actually matters for your decision
Use local/installable agents if:
- Latency per agent action matters (under 1 second is critical).
- You have continuous, predictable workload that keeps infrastructure utilized.
- You handle regulated data and can’t send prompts externally.
- You’re comfortable maintaining GPU infrastructure or running on-device models (8–24GB VRAM consumer hardware).
Use API-based agents if:
- Your workload is bursty or unpredictable.
- You need access to the latest frontier models without waiting for open-weight releases.
- Latency per action is measured in seconds and you can tolerate 2–5 minute end-to-end tasks.
- You don’t have the operational overhead budget for hardware management.
The October 2026 research on agent token efficiency showed that most agent inefficiency comes from poor action selection and retries, not latency. You can build reliable agents both ways. The difference is your bill and your infrastructure burden.
Bottom line: Local agents make sense when latency or data privacy is non-negotiable and you have sustained workload to justify GPU costs; API-based agents make sense when you want to pay only for what you use and can tolerate multi-second action latencies. Most production teams end up with API-based approaches for their primary workflows and local agents for sensitive or latency-critical tasks.
Question via Hacker News