Blog

What drives the cost of an AI agent build

The cost isn't the inference bill — it's how many systems the agent acts on, how retrievable your data already is, and how wrong it's allowed to be. Here is how those three variables compound.

Caffinix·September 15, 2026·7 min read
costengineeringarchitecturemvp

The cost of an AI agent build is set in the first week, not by the inference bill. Three variables determine the budget: how many systems the agent must act on, how retrievable your data already is, and how wrong the agent is allowed to be. Everything else — latency, observability, moderation — is downstream of those three.

A prototype can be assembled in an afternoon for a few API calls. A production system that executes actions across external services, on real data, with an acceptable error rate, is a software engineering project. The model is the cheap part.

The cost of integration surface

Every system the agent can act on is a new integration surface. Reading data is relatively cheap. Writing data, changing state, or triggering an external workflow adds a different class of complexity entirely.

Tool definitions and auth. Each integration requires a tool definition the model can call correctly. It also requires an auth story: the agent must hold a token securely, inherit the calling user's permissions, and refresh that token when it expires. For background execution — asynchronous tasks running without a user session — that means service accounts with tightly scoped permissions and audit logging.

Error and retry logic. If the agent attempts to update a record and the external API returns a conflict, what happens? Retry immediately? Fetch the updated record, merge in memory, and retry? Halt and alert? Each branch is deterministic code written around the probabilistic model. Every action the agent can take needs a handler for when that action fails.

Rate-limit handling. A human clicking through a dashboard might make three network requests per minute. An agent gathering context for a task might make forty in ten seconds, hitting the API ceiling and crashing mid-execution. Handling backoff gracefully, storing state mid-task, and resuming without losing context adds significant architectural weight.

When we scoped Nous — our agent engine that plans and acts via tools against real backend systems — the integration surface was where the work was. Iris, its first consumer (a conversational-commerce bot for Bangladesh/SEA sellers), reads the product catalogue, stock and order state and updates orders through the backend. Each connection has its own auth, its own error taxonomy, and its own rate-limit profile. The model configuration is a fraction of that work.

The state of your retrieval data

An agent is only as capable as the data it can access. If your data is already structured, cleanly indexed, and available via an internal API, connecting the agent is a wrapper. More often, the data lives in PDF exports, an outdated wiki, and a database schema that relies on institutional knowledge no one has written down.

Before the agent can reason about unstructured data, a pipeline has to be built to extract it. This is a data engineering project, not an AI project. You write parsers for the PDFs, handle OCR failures, strip boilerplate, and chunk the text at semantic boundaries rather than arbitrary character counts so that embedding captures meaning rather than the first half of a sentence.

For EvidenceVault — our SOC 2 audit-evidence tool — the live analyzer maps 12 auditor requests to SOC 2 control criteria automatically on a Spring Boot + pgvector backend. Most of the cost in a build like that sits in ingestion and chunking, not the model call: split at document section boundaries rather than token limits. A chunk that bisects a control description produces an embedding that represents neither half correctly.

Embedding choice also compounds the cost. A higher-dimensional embedding captures more nuance but is larger to store and slower to search. If the underlying data changes frequently, you need event-driven re-ingestion: webhooks or Kafka consumers that detect document changes and re-embed the affected chunks before the next query. When we scope MVP builds, the state of the retrieval data is the first variable we look at, because a disorganised starting corpus can double the build estimate.

How wrong the agent is allowed to be

This is the question that sets the ceiling on the budget, and most clients haven't answered it concretely before the first conversation.

If the agent is summarising meeting notes for internal review, an occasional error is tolerable — a human reads the output, spots the mistake, and corrects it. The reliability tier is low, the engineering cost is low.

If the agent is autonomously filing records, triggering payments, or generating compliance evidence, a hallucinated detail is an operational incident. Achieving reliable accuracy in that context requires multi-step verification (a secondary model grades the output of the primary), structured JSON output enforced by schema validation, and fallback logic when confidence is low.

Reliability is bought in increments, and each increment costs more than the last. Moving an agent from 80% to 90% accuracy is typically a week of prompt tuning and index cleanup. Moving it from 95% to 99% requires a custom eval pipeline, curated few-shot examples, and deterministic fallback mechanisms for low-confidence cases. You're paying for the engineering effort required to constrain a statistical model into behaviour that looks deterministic.

The way we handle this at handover: every build ships with an eval set built from the client's own questions, and a stated error rate — agreed before the first line of code — that defines what "done" means. That agreement is cheaper than any amount of rework after deployment.

Internal vs. user-facing: where the budget goes

The deployment environment dictates the infrastructure, and internal vs. public is the largest binary split.

An internal agent runs behind SSO, for users who understand its scope, with relaxed latency requirements. The engineer waits twelve seconds for a complex reasoning chain. The budget can be spent almost entirely on capability.

A public agent demands strict latency controls. Twelve seconds and the user assumes the site is broken. Reducing latency means streaming responses to the client, running tool calls in parallel where possible, and caching common queries — each of which increases build complexity.

Public agents also need moderation: a fast classifier in front of the main agent to evaluate user input before it reaches the reasoning model, and output filtering before anything hits the screen. You need guardrails against prompt injection, system prompt extraction, and retrieval data leakage. These aren't features — they're preconditions for a public deployment.

Heimdall, our self-hosted gateway that exposes an LLM as an internal API with its own auth and rate limiting, exists specifically because internal services shouldn't hold provider credentials directly. The gateway handles auth, enforces rate limits per caller, and runs an embeddings sidecar for retrieval. That architectural decision eliminates an entire class of credential management complexity for every downstream service — and it's a decision worth making on day one, not after the second credential rotation.

Evaluation and observability as a line item

Evaluation isn't a polish phase. It's a line item in the build. Without an eval harness, you can't know whether a prompt change improved the agent or degraded it. You can't compare models. You can't tell a client what the error rate is.

Building the harness means extracting a fixed set of test questions, writing expected outcomes, and configuring a runner that executes them on every relevant commit. This takes time, and it's required — not optional — for any build where the error rate matters.

Observability in an AI system is more complex than standard telemetry. When the agent fails, you need a full trace to determine whether the failure was a bad retrieval, a bad prompt, or a pure model error. That means logging:

  • The exact user input
  • The context retrieved from the index
  • The constructed prompt sent to the model
  • The raw model output before parsing
  • Latency per step

Standard APM tools log the request. AI observability requires logging the reasoning chain. The infrastructure to store, query, and act on these traces adds to the build estimate proportionally with how tightly you need to control error rates.

The cost multiplier that's free to eliminate

The single largest cost multiplier is unclear acceptance criteria, and it costs nothing to fix before writing a line of code.

In traditional software, a button either submits the form or it doesn't. In an agent build, the agent might submit the form with an incomplete summary, or decline a valid request because the phrasing was unusual. If you haven't defined whether either of those is a failure, you'll spend weeks adjusting the system prompt to satisfy shifting opinions.

Concrete acceptance criteria look like: "extract the invoice total, match it against the purchase order, flag discrepancies over 5%, and decline if either document is missing." Vague acceptance criteria look like: "be helpful."

The difference in engineering cost between those two statements — compounded over a build that runs several weeks — is significant. A team that knows exactly what they're building, and how they'll measure it, will always spend less than one trying to satisfy a moving target.


If you need help scoping the right build for your use case, our MVP builds engagements start with that acceptance criteria conversation before anything else.

Related service

AI-Powered Product & MVP Builds

Web and mobile products with AI built in, launched in 4–8 weeks — scoped hard to the core loop, on a stack that survives past launch.

See how we run it →