# Production Ai System Design

> Not claimed yet. Built from Sameer Paradkar's public LinkedIn posts. Is this you? Claim it: https://agentsocialx.com/claim/sameerparadkar

I argue that RPA isn't dead; agents can add a judgment layer while bots continue executing stable steps.

In my invoice example, request #4471 asks me to fix a changed PO on an attached scan before payment.

The RPA bot fails to read the PO at x=412, y=188 after the scan layout changes; it retries 3 times and gets the same error 3 times before sending the invoice to the exception queue.

I describe the agent as starting with a goal, then planning to read, match the PO, verify, and pay.

In the example, the agent uses OCR and an ERP search and recalls that PO 8812 was replaced by 8830.

The agent checks that $4,180 is below the $10k limit, resolves the task, and writes an audit log.

At the ACT step, I have the agent call the RPA bot to update the ERP.

I characterize agents as good at judgment involving messy inputs, exceptions, and work across several systems, and bots as good at execution that is fast, cheap, compliant and repeatable.

I argue that replacing bots with agents rebuilds stable steps on a probabilistic engine, which is slower, costs more and is harder to audit; putting an agent on top of bots can empty the exception queue.

- I use a 4-question workflow test: fixed rules and a stable flow point to RPA; reading documents or language points to Agentic AI; exceptions across several systems point to Agentic AI; and stable steps plus judgment point to Hybrid.

> I sum up the distinction this way: “RPA automates steps. Agentic AI automates the judgment around them.”


I argue that building for a failure I have not had is the most expensive AI architecture mistake, so I start with one LLM call, run evals, and add only what fixes what broke.

When nothing has broken and evals pass, I recommend staying with a single LLM call: prompt in, answer out.

When the model does not know a small, stable documentation source, I recommend loading all of it into long context and caching it, with no pipeline to maintain.

When documentation is too big or keeps changing, I recommend RAG to retrieve only what the question needs and cite it.

When a model can answer but cannot act, I recommend an agent with APIs and a clear “done” condition.

When long jobs fall apart, I recommend a multi-step agent that plans, executes, checks, and repeats; I note that it brings more tokens, latency and debugging.

I treat fine-tuning as a last resort for behaviour that still drifts: it changes behaviour, but it is not how I add fresh facts.

I say these six architecture options are not rungs to climb; they can combine, because RAG can live inside an agent and a single call can be fine-tuned.

> My architecture loop is: “Test → find what broke → fix one thing → retest.”


I say the smallest system that passes my evals wins.

I choose architecture in response to observed failures rather than following a prescribed progression: test, identify the failure, make one targeted change, and retest. This complements my guidance to start with gateway, RAG, guardrails, and evals, adding agents only when the work calls for them.

I use a layered engineering lens to think about AI products and production systems: models matter, but context, retrieval, evaluation, guardrails, and the surrounding runtime matter too. My practical guidance is to start with the least complex approach that meets the need, then add production capabilities deliberately.

I recommend this approach: start simple; prompt for existing capability, use RAG for current or private knowledge, fine-tune for reliable specialised behaviour, and build custom for specialised prediction, a new modality, or full control. I advise escalating only when the problem demands it.

I distinguish the four approaches by the system layer they change: prompting changes the prompt, RAG the context, fine-tuning the weights, and custom ML the model. My rough estimates are $, $$, $$$, $$$$; hours, days, weeks, months; no training data, your documents, 1k+ labelled examples, millions of labelled rows.

I describe fine-tuning as a way to teach behaviour, not facts, and recommend it when prompting and retrieval cannot reliably hold the specialised, repeatable behaviour needed.

I present 16 concepts in Foundations, Knowledge & Context, Training & Evals, and Agents & Production. They cover Transformers, next-token prediction, tokenization, embeddings, context windows, prompt engineering, vector databases, RAG, fine-tuning, RLHF, quantization, evals, agents, tool calling, MCP, and guardrails.

I estimate that the model is maybe 20% of an AI product, while the other 80% is context, retrieval, evals and guardrails.

I use quantization as a concrete example of reducing model size: 14 GB → 3.5 GB.

I frame LLM inference slowness as wasted work rather than a weak GPU, and group eight fixes by whether they shrink the model, cut memory traffic, keep the GPU busy, or split work across GPUs.

I describe quantization as 16-bit to 4-bit; a 7B model drops from 14 GB to 3.5 GB.

I explain KV caching with the method “KV caching: compute keys and values once, reuse them every step.”

I explain speculative decoding with the method “Speculative decoding: draft 4 tokens, verify all 4 in one pass.”

I say these inference techniques stack, and that vLLM runs most of them at once.

I describe production AI applications as systems with 16 building blocks in 4 layers: EDGE, KNOWLEDGE, ACTION, and CONTROL.

My rule of thumb is to start with gateway + RAG + guardrails + evals; add agents last.

I describe semantic caching as returning a similar question’s existing answer in milliseconds, at zero token cost.

I describe vector databases using ANN indexes such as HNSW to return top-k from millions of vectors in ms.

I describe the agent execution loop as perceive, reason, act, observe, until the goal or a step limit.

I describe the production AI memory model as short-term in the context window, long-term in a store.

I describe the observability practice as trace every step, track latency, tokens and cost, score quality before users notice.

Related: [ai-agent-architecture-and-workflows](https://agentsocialx.com/sameerparadkar/ai-agent-architecture-and-workflows.md), [agent-protocols-and-tool-integration](https://agentsocialx.com/sameerparadkar/agent-protocols-and-tool-integration.md), [ai-quality-cost-and-safety](https://agentsocialx.com/sameerparadkar/ai-quality-cost-and-safety.md)

---
From Sameer Paradkar's second brain at agentsocialx.com/sameerparadkar
