Thinking in Enterprise LLM Application Architecture

Publication Date: September 26, 2026 Last Updated: September 27, 2026
Introduction
If your objective is to develop a mental operating system for Enterprise LLM Application Architecture, I would not organize it around frameworks such as LangChain, LlamaIndex, Semantic Kernel, Bedrock, OpenAI, vector databases, or agent frameworks. Those are implementation choices.
Instead, your inner problem solving machine should allow you to start with an ambiguous business problem and systematically arrive at a production-grade, scalable, reliable, secure, observable, and economically viable LLM application, regardless of the technology stack.
I would structure it as the following.
Business Intent → Intelligence Contract → Application Pattern → Context → Reasoning → Action → State → Runtime → Trust → Evaluation → Reliability → Scale → Economics → Operations

Note: Here I view Trust as the foundational architecture (e.g., security protocols, data privacy filters, alignment guardrails, and compliance standards). Therefore, it comes before Evaluation. You wouldn't evaluate a system that hasn't passed security clearance. However, if you view Trust as the end result (e.g., user confidence and system verification), then it belongs after Evaluation.
This is the core mental model. The core mental model tells the architect how to think.
Section Mapping to the Core Mental Model
The cleanest way to map the sections is to treat the 14-stage core mental model as the architectural spine, while recognizing that several sections are cross-cutting rather than belonging exclusively to one stage.
| Core Mental Model Stage | Primary Section(s) | Secondary / Supporting Section(s) | Architectural Focus |
|---|---|---|---|
| 1. Business Intent | Start With the Business Problem, Not the LLM | Define the Intelligence Contract | Establish the business problem, desired outcome, user, intent, value, and success criteria before selecting AI technology. |
| 2. Intelligence Contract | Define the Intelligence Contract | Start With the Business Problem, Not the LLM Model the Application as an Intelligence Pipeline | Define the intelligence capabilities, reasoning depth, determinism requirements, behavioral expectations, and output requirements the application must satisfy. |
| 3. Application Pattern | Choose the LLM Application Pattern | Model the Application as an Intelligence Pipeline | Select the appropriate application pattern, such as direct generation, RAG, tool-augmented LLM, workflow, agent, or multi-agent architecture, based on the Intelligence Contract. |
| 4. Context | Context Engineering | Model the Application as an Intelligence Pipeline | Determine what information the application needs, where that information comes from, how it is acquired, and how it is assembled into model-ready context. |
| 5. Reasoning | Reasoning Architecture | Define the Intelligence Contract Model the Application as an Intelligence Pipeline Prompt Architecture | Define how the application interprets information, reasons, decomposes problems, plans, evaluates intermediate results, and reaches decisions. |
| 6. Action | Tool and Action Architecture Agent Architecture | Structured Output Human-in-the-Loop Architecture | Define what the application can do, which tools it can invoke, how actions are controlled, and when humans must approve or execute actions. |
| 7. State | State and Memory Architecture | Agent Architecture Human-in-the-Loop Architecture | Define conversation state, working memory, application state, workflow state, agent state, and persistent memory. |
| 8. Runtime | Model Architecture LLM Gateway Deployment Architecture | CI/CD for LLM Applications Version Everything | Define how models, orchestration, application services, infrastructure, and AI components execute in production. |
| 9. Trust | Guardrails Security Architecture | Multi-Tenancy Production Governance Human-in-the-Loop Architecture | Establish security, authorization, safety, policy enforcement, tenant isolation, governance, and human-control boundaries. |
| 10. Evaluation | Evaluation Architecture Evaluation Pyramid | Structured Output The Production Readiness Test | Establish how retrieval, generation, reasoning, agent behavior, safety, task completion, and business outcomes are evaluated. |
| 11. Reliability | Reliability Engineering Reliability Has Two Dimensions Disaster Recovery The Failure-First Mental Model | The Production Readiness Test | Design for model, retrieval, tool, application, infrastructure, and provider failures while addressing both technical and cognitive reliability. |
| 12. Scale | Scalability Architecture Latency Architecture | Caching Architecture Multi-Tenancy | Address concurrency, throughput, latency, bottlenecks, capacity, caching, and scaling behavior under enterprise workloads. |
| 13. Economics | Cost Architecture | Model Architecture LLM Gateway Latency Architecture Caching Architecture | Optimize model, token, retrieval, infrastructure, and operational costs while establishing sustainable unit economics. |
| 14. Operations | Observability CI/CD for LLM Applications Version Everything | Production Governance Disaster Recovery The Production Readiness Test | Operate, monitor, evolve, govern, troubleshoot, release, and recover the LLM application throughout its production lifecycle. |
The 14-stage model provides the thinking sequence, while the sections define the architectural focus for analyzing and designing each stage.
Start With the Business Problem, Not the LLM
One of the most consequential mistakes in enterprise LLM application architecture is asking the technology question before establishing the business question:
We need an LLM. What architecture should we use?
The framing is understandable, but it reverses the order in which an enterprise architecture should be developed. An LLM is a means, not an objective. Architecture exists to enable a business outcome under defined operational, economic, security, and risk constraints.
The more useful question is:
What business outcome are we trying to produce, and where in that outcome can intelligence create meaningful leverage?
This question establishes the architectural starting point.
It forces the organization to determine whether an LLM is actually required, where intelligence belongs in the workflow, what role the system should play, and what boundaries must surround it. It also prevents a common failure mode in enterprise AI: designing an impressive technical capability and then searching for a business problem that can justify it.
Every major architectural decision follows from this initial understanding. Model selection, retrieval strategy, context construction, orchestration, tool use, human oversight, evaluation, latency targets, security controls, and cost ceilings are not independent choices. They are consequences of the business problem, the workflow in which it occurs, and the role intelligence is expected to play.
If the problem is framed incorrectly at the beginning, downstream engineering can optimize the wrong system with remarkable efficiency. The result may be technically sophisticated, operationally reliable, and architecturally elegant, yet still fail to create meaningful business value.
Enterprise LLM architecture therefore begins before the LLM enters the conversation.
Define the Business Objective
Before making a single architectural decision, establish the business objective with enough precision that it can survive technical scrutiny, operational scrutiny, and executive scrutiny.
At minimum, establish:
- Business problem: What problem actually exists? State it in the language of the business process, not in terms of an AI capability.
- Affected stakeholders: Who experiences the problem directly, and who absorbs its downstream consequences?
- Current economic impact: What does the problem cost today in time, revenue, operational effort, risk exposure, compliance exposure, or customer trust?
- Decision or workflow: Which decision, task, or workflow is constrained by the problem?
- Current-state behavior: What happens today when the problem occurs, before AI is introduced?
- Desired outcome: What specifically should improve, change, accelerate, or become possible?
- Success measures: How will the organization determine whether the intervention actually produced the intended business result?
This distinction between a business objective and a technology objective is fundamental.
"Improve the quality of LLM responses" is not a business objective. It is a technology concern.
"Reduce average claim-resolution time from four days to same-day resolution for claims below a defined complexity threshold" is a business objective. It establishes an outcome, a baseline, a target state, and a measurable boundary.
That precision becomes increasingly valuable as architecture decisions become more consequential. If response quality improves but resolution time does not, the system may be performing well according to an AI metric while failing according to the business metric that justified the investment.
The architecture must therefore be traceable to the outcome.
A useful chain of reasoning is:
Business problem → Business outcome → Workflow change → Intelligence requirement → Architectural requirement
This sequence creates architectural traceability. It allows a team to explain not only what it built, but why each major architectural decision exists and which business requirement it serves.
It also provides a disciplined basis for rejecting unnecessary complexity. If a proposed model, retrieval mechanism, agentic workflow, or orchestration layer cannot be connected to a meaningful requirement, its architectural necessity should be questioned.
The objective is not to maximize the amount of intelligence in the system.
The objective is to place the right intelligence at the right point in the business process to produce a measurable outcome.
Understand the User Before the Use Case
An enterprise LLM application is not built for "users" in the abstract. It is built for a person or group performing a particular role, within a particular business process, under particular operational constraints.
The same capability can require radically different architecture depending on who consumes the output and what that person or system is authorized to do with it.
Before designing the application, establish the user's operating context:
- User: Who specifically interacts with the system?
- User role: What function does the user perform within the business process?
- User intent: What is the user trying to accomplish at the moment of interaction?
- User context: What information, prior actions, constraints, and time pressures surround the interaction?
- User authority: What decisions or actions is the user authorized to make, and which require escalation or additional approval?
- User expectations: What does a useful outcome look like from the user's perspective?
- User error tolerance: What is the operational, financial, legal, regulatory, or reputational consequence of an incorrect response or action?
The final dimension is particularly important.
An LLM response does not carry the same risk simply because the words look similar. Risk is determined in part by what happens after the response is produced.
Consider a customer service representative who asks:
"Why was this customer's claim rejected?"
The system is providing information to a human decision-maker. The representative can review the explanation, consider supporting evidence, challenge the result, and apply business judgment before taking action.
Now consider a system instructed to:
"Automatically approve this claim."
The architectural problem has changed fundamentally.
The second system is not merely generating information. It is participating in a business decision and potentially executing an action with financial consequences. The system may now require stronger authorization controls, deterministic policy enforcement, explicit approval boundaries, comprehensive auditability, stronger evaluation, and a different approach to failure handling.
The distinction can be expressed simply:
Inform → Recommend → Decide → Act
These are not merely different user experiences. They represent progressively different levels of system responsibility.
An application that informs a user can tolerate a degree of imperfection that would be unacceptable in an application authorized to act on the business's behalf. As system responsibility increases along this progression, the architecture must strengthen its controls around authority, evidence, validation, observability, escalation, and human oversight in lockstep.
This is why the user's role cannot be treated as an interface concern to be addressed after the model has already been selected. By the time architecture decisions reach the interface layer, the questions that actually determine system design have already been answered, correctly or not.
The user defines the operational context in which intelligence will be consumed. Their authority establishes what the system may safely recommend or execute. Their tolerance for error shapes evaluation thresholds and control requirements. Their workflow determines whether the system should answer, recommend, request clarification, seek approval, or act outright.
User understanding must therefore precede model selection, retrieval design, orchestration, and prompt engineering. Skipping this step does not remove the decision; it only defers it to a point in the process where it is far more expensive to revisit.
These distinctions, informational versus autonomous, high tolerance versus low tolerance, are not yet the Intelligence Contract itself. They are the raw material the Intelligence Contract will formalize into explicit decision rights, addressed next.
Define the Role of Intelligence in the Workflow
Once the business objective and user context are established, the next question is not yet which LLM should we use?
The question is:
What role should intelligence play in the workflow?
This distinction prevents an enterprise from treating the LLM as the application itself.
In one workflow, intelligence may be responsible for interpreting unstructured information. In another, it may synthesize enterprise knowledge. In another, it may recommend an action to a human operator. In a more autonomous workflow, it may plan a sequence of actions and invoke enterprise systems through controlled tools.
These are materially different architectural responsibilities.
For each candidate use of intelligence, establish:
- Input: What information does the system receive?
- Interpretation: What does the system need to understand or infer?
- Knowledge: What information must it retrieve or ground against?
- Reasoning: What form of analysis or decision support is required?
- Action: Does the system merely generate an answer, or does it initiate an external action?
- Authority: Who or what is ultimately authorized to make the decision?
- Verification: What must be validated before the result is accepted?
- Escalation: Under what conditions must control return to a human or another deterministic system?
This analysis begins to reveal the actual architecture.
A simple information-assistance workflow may require an LLM, enterprise knowledge retrieval, access controls, and response evaluation.
A recommendation workflow may additionally require evidence presentation, confidence handling, policy validation, and human approval.
An autonomous action workflow may require tool authorization, transaction controls, policy enforcement, state management, idempotency, audit trails, action verification, and explicit failure and rollback behavior.
The model may be similar in all three cases. The architecture is not.
Establish the Business and Architectural Boundaries
Enterprise LLM applications operate within systems that already have sources of truth, business rules, authorization models, transaction boundaries, and accountable owners.
The LLM should therefore not be allowed to implicitly redefine those boundaries.
Before proceeding into detailed architecture, establish:
- System of record: Which enterprise systems own authoritative data?
- Decision authority: Which human or system owns the final business decision?
- Policy authority: Which rules are deterministic and must not be delegated to probabilistic generation?
- Action boundary: Which actions may the LLM recommend, and which may it execute?
- Data boundary: What information may enter the model context?
- Security boundary: Which identities, permissions, and access controls govern the interaction?
- Evidence boundary: What evidence must support a response or recommendation?
- Human boundary: Where must a human remain in the loop?
- Operational boundary: What latency, availability, throughput, and cost constraints must the application satisfy?
These boundaries are architectural constraints, not implementation details.
They determine whether the system should be primarily generative, retrieval-grounded, workflow-driven, agentic, or some combination of these patterns. They also determine where deterministic controls must surround probabilistic components.
The central principle is straightforward:
Use intelligence where ambiguity, interpretation, synthesis, or reasoning creates value. Use deterministic systems where certainty, authority, and control are required.
A mature enterprise LLM architecture does not attempt to make every part of the workflow intelligent. It deliberately separates probabilistic intelligence from deterministic control and assigns each responsibility to the architectural mechanism best suited to it.
Trace Every Architectural Decision Back to the Outcome
Once the business problem, user, workflow, intelligence role, and boundaries are established, architectural decisions become easier to reason about.
The question changes from:
"Which LLM architecture should we build?"
to:
"What architecture is required to produce this outcome, for this user, within these constraints?"
That shift is fundamental.
It provides a basis for deciding whether retrieval is necessary, whether an agent is justified, whether a human approval step is required, whether multiple models provide meaningful value, whether a particular latency target is acceptable, and how much the organization should spend per transaction.
It also establishes a decision chain that can be revisited as the system evolves:
Business Outcome → User and Workflow → Intelligence Role → Constraints → Architecture Decisions → Measurable Result
This chain should remain visible throughout the architecture lifecycle.
Models will change. Retrieval technologies will change. orchestration frameworks will change. Context strategies will evolve. New foundation models will emerge. What should remain stable is the business outcome the system exists to produce and the architectural reasoning that connects the outcome to the implementation.
That is the foundation of enterprise LLM application architecture.
Start with the problem. Understand the user. Define the role of intelligence. Establish the boundaries. Then design the system.
Define the Intelligence Contract
One of the most consequential steps in enterprise LLM application architecture is also one of the most frequently skipped.
Teams often move directly from "we understand the user" to "let's choose a model" without first defining what intelligence the system is actually expected to provide. The omission may not be visible during early development. It becomes visible in production, when the system produces outputs, recommendations, or actions that nobody explicitly intended to authorize.
The Intelligence Contract closes this gap.
It is the explicit architectural statement that answers one question before model selection begins:
What intelligence must this system provide, and under what terms?
The term contract is deliberate. A contract establishes obligations, boundaries, and conditions under which actions are permitted. The Intelligence Contract performs the same function for an LLM application. It defines the capability the system requires, the depth of intelligence justified by the business problem, and the degree of determinism required for correctness.
Without this contract, these decisions do not disappear. They simply become implicit. They are made incrementally through prompts, model choices, framework defaults, and implementation decisions. The result is an architecture whose actual behavior may exceed its intended responsibility.
That is particularly dangerous in enterprise systems because capability tends to expand silently. An application introduced to summarize information may gradually begin answering questions, making recommendations, invoking tools, and eventually taking actions. Each expansion may appear reasonable in isolation, yet the aggregate system can end up operating beyond the boundaries originally intended.
The Intelligence Contract establishes those boundaries before implementation begins.
It consists of three fundamental dimensions:
- Intelligence Capability: What kind of intelligence does the system need to provide?
- Intelligence Depth: How much reasoning and autonomy does the problem actually require?
- Determinism Requirement: Which parts of the outcome must be predictable, reproducible, and conventionally verifiable?
Together, these dimensions define the intelligence envelope within which the application should operate.
Intelligence Capability
The first term of the contract is capability.
Before selecting a model or designing an orchestration layer, identify the specific form of intelligence the business process requires. The objective is not to identify everything an LLM can do. The objective is to establish what the application must do.
Common intelligence capabilities include:
- Classification: Assigning an input to one or more predefined categories.
- Extraction: Identifying and structuring information from unstructured content.
- Summarization: Condensing information while preserving the meaning relevant to the task.
- Transformation: Converting content from one representation, structure, or format into another.
- Information synthesis: Combining information from multiple sources into a coherent representation.
- Question answering: Producing an answer to a specific question using the information available to the system.
- Recommendation: Proposing an option or course of action without executing it.
- Prediction: Estimating an unknown or future value based on available evidence.
- Reasoning: Working through a problem that requires analysis, inference, comparison, or judgment rather than straightforward retrieval.
- Planning: Determining a sequence of steps required to achieve a defined objective.
- Tool use: Invoking external systems or services to obtain information or perform controlled operations.
- Workflow execution: Coordinating and completing multiple steps within a defined business process.
- Autonomous action: Taking action on behalf of the business without requiring a human checkpoint for each individual action.
These capabilities should not be treated as a progression that every application should climb.
They define a boundary.
A system designed for extraction should not silently become a reasoning system simply because the model happens to be capable of reasoning. A system designed to provide recommendations should not acquire authority to execute those recommendations without an explicit architectural decision.
Many production problems begin with precisely this kind of capability drift.
A document-processing application may begin by extracting fields from contracts. Later, someone asks it to interpret ambiguous clauses. Then it is asked to recommend an outcome. Eventually, it is connected to a workflow that acts on that recommendation. At each stage, the change may appear incremental. Architecturally, however, the system has crossed several capability boundaries.
The Intelligence Contract makes those boundaries explicit.
For every capability, the architect should be able to answer:
- Why is this capability required?
- What business outcome does it support?
- What inputs does it depend on?
- What output does it produce?
- Who consumes that output?
- What authority, if any, does the output carry?
- What happens when the system cannot perform the capability reliably?
The final question is particularly important.
An intelligence capability is not completely defined until its failure behavior is defined. A system that cannot extract a required value should not necessarily infer one. A system that cannot answer from sufficient evidence should not necessarily generate a plausible response. A system that cannot determine whether an action is safe should have an explicit escalation path.
Capability therefore includes both what the system is allowed to do and what it must do when it cannot do it reliably.
Intelligence Depth
Capability answers what the system does.
Depth answers how much intelligence is required to do it.
These dimensions are related, but they are not interchangeable. A capability such as question answering can range from simple retrieval and synthesis to complex multi-step reasoning involving tools, planning, and external actions.
An approximate intelligence-depth hierarchy is:
Pattern Recognition
↓
Information Extraction
↓
Information Synthesis
↓
Reasoning
↓
Planning
↓
Tool-Augmented Reasoning
↓
Agentic Execution
Moving downward through this hierarchy generally increases the system's capability. It also increases the architectural burden.
Greater intelligence depth can introduce:
- Higher inference cost
- Greater latency
- More complex orchestration
- Larger failure surfaces
- More difficult evaluation
- More complicated state management
- Greater observability requirements
- More extensive security controls
- More difficult debugging and incident analysis
- Greater uncertainty around end-to-end behavior
The architectural mistake is to treat greater intelligence depth as inherently better architecture.
It is not.
A system operating at the level of pattern recognition may be comparatively narrow and predictable. A system operating through agentic execution has a much larger behavioral surface. It may interpret a goal, construct a plan, select tools, invoke external systems, observe results, revise its plan, and continue until it determines that the task is complete.
That capability may be justified in some workflows. It should never be introduced merely because the technology makes it possible.
The governing principle is:
Use the minimum intelligence depth necessary to produce the required business outcome reliably.
This principle is stronger than use the simplest architecture possible. The objective is not simplicity for its own sake. The objective is to avoid introducing reasoning, planning, autonomy, and orchestration where they provide no corresponding business value.
Consider an application that needs to identify whether an incoming document belongs to one of five predefined categories. Introducing an autonomous agent to perform that task adds complexity without establishing a corresponding requirement.
Likewise, an application that must coordinate several enterprise systems, reason over intermediate results, and adapt its next action based on those results may genuinely require planning and tool-augmented reasoning. In that case, deeper intelligence is not architectural excess. It is part of the problem definition.
The question is therefore not:
"How intelligent can we make the application?"
It is:
"What is the minimum intelligence depth required to solve the problem within the required reliability, latency, cost, and control boundaries?"
That question creates a useful discipline for architecture reviews. Every increase in intelligence depth should have a corresponding business or technical justification.
Agentic behavior should be earned by the problem, not assumed by the architecture.
Determinism Requirement
The third term of the contract is determinism.
This dimension is frequently overlooked when LLM application design is approached primarily as a prompting problem. An LLM is probabilistic by nature. Enterprise systems, however, often contain operations for which variability is unacceptable.
The key question is simple:
Does the same input need to produce the same result every time?
If the answer is yes, the architecture should determine whether that responsibility can be moved outside the LLM and implemented using deterministic computation, rules, databases, or conventional software.
This does not diminish the role of the LLM. It defines the role more precisely.
LLMs are well suited to interpreting language, resolving ambiguity, synthesizing information, and producing natural-language responses. They are not a substitute for deterministic computation when the business requires exact, reproducible results.
Consider a financial application that receives the instruction:
"Calculate the customer's final settlement amount."
The model may understand the instruction, identify the relevant information, and explain the result. But the calculation itself should generally be performed by a deterministic service governed by explicit business rules.
The architectural flow becomes:
LLM
↓
Interpret intent
↓
Deterministic service
↓
Apply business rules and calculate
↓
LLM
↓
Explain result
rather than:
LLM
↓
Interpret intent
↓
Calculate everything
The distinction is architectural.
In the first design, each responsibility is assigned to the mechanism best suited to perform it. The LLM handles language and interpretation. The deterministic service handles calculation. The LLM may then translate the verified result into an explanation appropriate for the user.
This separation also creates a clearer control boundary. The calculation can be tested independently, reproduced from the same inputs, audited against explicit rules, and changed without changing the model's behavior.
The principle generalizes beyond arithmetic.
If correctness can be expressed and verified through conventional software, conventional software should generally own that responsibility.
Examples include:
- Arithmetic and financial calculations
- Database lookups for authoritative values
- Threshold and eligibility checks
- Policy enforcement
- Identity and authorization decisions
- Schema validation
- Transaction processing
- Referential integrity
- Deterministic routing
- State transitions governed by explicit business rules
The LLM can interpret the request, determine which deterministic capability is needed, and explain the resulting outcome. It should not become the hidden implementation of rules that the enterprise already knows how to express explicitly.
This separation is especially important in regulated, financial, operational, and safety-sensitive workflows. When an outcome must be reproduced or defended later, the organization should not have to reconstruct why a probabilistic model produced a particular value when a deterministic mechanism could have produced that value directly.
The architectural rule is therefore straightforward:
Use probabilistic intelligence for ambiguity, interpretation, synthesis, and reasoning. Use deterministic mechanisms for rules, calculations, authoritative state, and outcomes that must be reproducible.
The boundary will not always be absolute. Some business decisions contain both deterministic and judgment-intensive components. In such cases, the architecture should separate those components rather than forcing the entire decision into either the LLM or conventional software.
The Intelligence Envelope
The three dimensions of the Intelligence Contract should be considered together.
Capability establishes what the system is expected to do.
Depth establishes how much intelligence is justified.
Determinism establishes where probabilistic behavior must give way to controlled, reproducible computation.
Together, they define the application's intelligence envelope.

In the first design, each responsibility is assigned to the mechanism best suited to perform it. The LLM handles language and interpretation. The deterministic service handles calculation. The LLM may then translate the verified result into an explanation appropriate for the user.
This separation also creates a clearer control boundary. The calculation can be tested independently, reproduced from the same inputs, audited against explicit rules, and changed without changing the model's behavior.
The principle generalizes beyond arithmetic.
If correctness can be expressed and verified through conventional software, conventional software should generally own that responsibility.
Examples include:
- Arithmetic and financial calculations
- Database lookups for authoritative values
- Threshold and eligibility checks
- Policy enforcement
- Identity and authorization decisions
- Schema validation
- Transaction processing
- Referential integrity
- Deterministic routing
- State transitions governed by explicit business rules
The LLM can interpret the request, determine which deterministic capability is needed, and explain the resulting outcome. It should not become the hidden implementation of rules that the enterprise already knows how to express explicitly.
This separation is especially important in regulated, financial, operational, and safety-sensitive workflows. When an outcome must be reproduced or defended later, the organization should not have to reconstruct why a probabilistic model produced a particular value when a deterministic mechanism could have produced that value directly.
The architectural rule is therefore straightforward:
Use probabilistic intelligence for ambiguity, interpretation, synthesis, and reasoning. Use deterministic mechanisms for rules, calculations, authoritative state, and outcomes that must be reproducible.
The boundary will not always be absolute. Some business decisions contain both deterministic and judgment-intensive components. In such cases, the architecture should separate those components rather than forcing the entire decision into either the LLM or conventional software.
Choose the LLM Application Pattern
I have tried my best to maintain a stronger architectural taxonomy without turning this section into a catalog of AI patterns.
Only after the business intent has been established and the intelligence contract has been defined should you decide what kind of LLM application you are actually building.
The ordering matters.
Choosing an application pattern before understanding the problem creates two predictable forms of architectural waste. Teams build agentic systems for tasks that a single model call could have handled, introducing unnecessary orchestration, latency, cost, and failure modes. Conversely, teams sometimes build rigid prompt pipelines for problems that require retrieval, tool access, iterative reasoning, or dynamic execution.
The pattern should therefore be a consequence of the intelligence contract, not an architectural preference stated in advance.
A useful way to think about the application space is to distinguish three broad capabilities:

Generation produces or transforms information.
Retrieval grounds the model in information supplied by the application rather than relying solely on the model's parametric knowledge.
Action extends the model beyond language into the execution of deterministic operations, business processes, or autonomous task completion.
These capabilities can be combined. A production application may retrieve information, invoke tools, execute a workflow, and use an evaluator before returning its final response. The purpose of the taxonomy is therefore not to force every system into a single box. It is to establish a vocabulary for identifying the dominant execution pattern and, more importantly, the degree of autonomy and architectural complexity that the application actually requires.
The following patterns provide that vocabulary.
Pattern A: LLM-Only
User
↓
LLM
↓
Response
This is the simplest application pattern and, in practice, one of the most frequently overlooked.
An LLM-only application is appropriate when the model's existing capabilities are sufficient to perform the task and the application does not require external knowledge, deterministic computation, tool invocation, or multi-step execution.
Typical examples include:
- Summarization
- Rewriting
- Classification
- Translation
- Content generation
- Extraction from supplied text
- Style or format transformation
- Simple question answering based on information already present in the prompt
The architectural principle is straightforward:
If the model can solve the problem reliably from the supplied input, do not add infrastructure merely because more infrastructure is available.
This pattern should not be regarded as an immature architecture. In the right problem domain, it is the most appropriate architecture because it minimizes latency, cost, operational complexity, and failure surface.
The important question is not whether the application uses an LLM-only pattern. The question is whether the pattern satisfies the intelligence contract.
Pattern B: Prompt with Structured Context
User
↓
Context Construction
↓
LLM
↓
Response
The distinction between this pattern and Pattern A is subtle but architecturally important.
The application constructs a deliberate context envelope before invoking the model. That context may contain user attributes, conversation state, business rules, product information, application state, preferences, structured records, or selected portions of a document.
The model is therefore no longer operating solely on the user's request. It is operating within a system-constructed context.
This pattern is particularly useful when the required information is:
- Small enough to assemble directly
- Known at request time
- Highly structured
- User-specific
- Operational rather than corpus-scale
- Unlikely to require semantic search across a large knowledge base
For example, an enterprise assistant may receive a user's request together with their role, account information, current workflow state, permissions, and relevant business rules. No vector database is required simply because the application is context-aware.
This distinction matters because context engineering is often confused with retrieval. They are related, but they are not interchangeable.
Context construction answers: What information should the model receive for this interaction?
Retrieval answers: Which information should the system discover from a larger knowledge space?
That distinction becomes increasingly important as enterprise applications grow.
Pattern C: Retrieval-Augmented Generation
User
↓
Query Understanding
↓
Retrieval
↓
Context Assembly
↓
LLM
↓
Grounded Answer
RAG becomes appropriate when the information required to answer a request resides outside the model's reliable parametric knowledge and cannot reasonably be supplied as static context.
Typical examples include:
- Enterprise policies
- Product documentation
- Technical knowledge bases
- Contracts
- Case histories
- Product catalogs
- Operational records
- Frequently changing business information
- Large document collections
The architectural significance of RAG is often underestimated.
RAG is not simply:
Documents → Embeddings → Vector Database → LLM
A production retrieval system may involve document processing, metadata extraction, access-control filtering, query rewriting, lexical retrieval, vector retrieval, hybrid retrieval, reranking, context compression, citation handling, and retrieval evaluation.
The model can only reason over the context it receives. Consequently, retrieval quality becomes part of application intelligence.
A useful architectural equation is:
Answer Quality
≈
Retrieval Quality × Context Quality × Model Capability
The exact relationship is not mathematically linear, but the architectural implication is important. A more capable model does not compensate indefinitely for poor retrieval.
RAG should therefore be treated as a knowledge-access architecture, not as a database feature.
Pattern D: Tool-Augmented LLM
User
↓
LLM
↓
Tool Selection
↓
Tool
↓
Tool Result Validation
↓
LLM
↓
Response
The model now reaches beyond language into deterministic capabilities.
It may invoke an API, execute a calculation, query an enterprise system, retrieve a customer record, check inventory, obtain a current exchange rate, or perform another bounded operation.
This pattern is particularly important when the intelligence contract contains a determinism requirement.
The model interprets intent and decides what information or operation is required. The tool performs the operation that should not be entrusted to probabilistic generation.
For example:
LLM:
"What is the customer's outstanding balance?"
↓
Billing API:
"₹184,250"
↓
LLM:
"The current outstanding balance is ₹184,250."
The model should not be expected to calculate or invent the authoritative balance when the enterprise system already owns that fact.
This creates an important architectural boundary:
Use the model for interpretation and language; use deterministic systems for authoritative computation and state mutation.
Tool use also introduces new failure modes. Tool schemas must be explicit, authorization must be enforced outside the model, inputs must be validated, outputs must be checked, timeouts must be controlled, and consequential operations must be auditable.
The tool call is therefore not merely an extension of prompting. It is an integration boundary.
Pattern E: Workflow
Input
↓
Step 1
↓
LLM
↓
Step 2
↓
Deterministic Service
↓
Step 3
↓
Validation
↓
Output
A workflow defines the sequence of execution in advance.
The LLM may perform one or more intelligent stages within the process, but the overall control flow remains deterministic and application-owned.
For example:
Receive claim
↓
Extract claim information
↓
Validate required fields
↓
Retrieve policy
↓
Classify claim
↓
Apply business rules
↓
Route for approval
The model may perform extraction or classification, but it does not decide the overall process topology.
This constraint is the principal strength of the workflow pattern.
When the business process is known, repeatable, and governed by explicit rules, deterministic orchestration generally provides stronger predictability, auditability, testing, and operational control than autonomous execution.
A workflow also provides an important architectural middle ground between simple prompting and agents. Many systems described as "agentic" are, on closer inspection, better implemented as workflows with a few intelligent steps.
The distinction is worth making explicit:
A workflow follows a path designed by the system. An agent determines its path at runtime.
Pattern F: Router-Based Application
┌──→ LLM-Only
│
User → Router ───────────┼──→ Contextual LLM
│
├──→ RAG
│
├──→ Tool
│
└──→ Workflow
The Router pattern deserves explicit recognition because it is increasingly common in production applications.
Rather than forcing every request through the same architecture, the application first determines what kind of processing the request requires.
For example:
"What does this paragraph mean?"
→ LLM-Only
"What does our travel policy say?"
→ RAG
"What is my current order status?"
→ Tool
"Process this expense claim."
→ Workflow
Routing can be implemented through deterministic rules, classifiers, a lightweight model, an LLM-based router, or a combination of these mechanisms.
The architectural objective is appropriate path selection.
A router can reduce unnecessary model calls, retrieval operations, tool invocation, and agentic execution. It can also provide a natural place to enforce policy boundaries before a request reaches a more capable execution path.
In larger systems, routing may become hierarchical:
Request
↓
Domain Router
↓
Capability Router
↓
Execution Pattern
The router therefore acts as an architectural control plane for application intelligence.
Pattern G: Evaluator-Optimizer

A single model call is not always sufficient to achieve the required quality bar.
The Evaluator-Optimizer pattern introduces a second evaluation step that examines the generated result against explicit criteria. If the result does not satisfy those criteria, the system can revise, regenerate, or escalate it.
The evaluator may be:
- Another LLM
- A deterministic validator
- A schema validator
- A business-rule engine
- A safety classifier
- A domain-specific scoring function
- A combination of these mechanisms
The pattern is particularly useful for outputs such as:
- Structured extraction
- Code generation
- Long-form technical content
- Complex reasoning
- Compliance-sensitive responses
- Customer-facing communications
- Outputs with explicit quality thresholds
The key architectural principle is that generation and evaluation are separate concerns.
The system should not assume that because a model produced an answer, the answer is therefore acceptable.
This pattern also introduces an important trade-off. Evaluation improves quality only when the evaluator itself is sufficiently reliable. It adds latency and cost, and it can create feedback loops if the acceptance criteria are poorly defined.
The quality threshold should therefore be specified as part of the intelligence contract rather than added after implementation.
Pattern H: Agentic Application
Goal
↓
Agent
├── Reason
├── Retrieve
├── Plan
├── Invoke Tool
├── Observe
├── Re-plan
└── Act
↓
Result
An agentic application changes the fundamental control model.
Instead of receiving a predefined sequence of operations, the system receives a goal and determines the next step dynamically.
The agent may:
- Interpret the goal
- Form a plan
- Select a tool
- Execute the tool
- Observe the result
- Revise the plan
- Continue until a termination condition is reached
This flexibility is valuable for problems whose execution path cannot be reliably specified in advance.
However, agentic architecture should not be equated with architectural maturity.
The freedom to choose a path introduces additional uncertainty:
- More possible execution paths
- Greater token consumption
- Variable latency
- More tool calls
- More opportunities for failure
- More complex evaluation
- More difficult debugging
- Greater authorization requirements
- Greater difficulty reproducing failures
The architecture therefore needs explicit boundaries around:
- Tool permissions
- Data access
- Maximum iterations
- Execution budgets
- Timeouts
- Termination conditions
- Human approval
- State management
- Auditability
- Error recovery
An agent should be introduced when the problem requires runtime decision-making about how to accomplish a goal, not simply because the application has multiple steps.
Pattern I: Multi-Agent System

A multi-agent system decomposes a larger problem across multiple specialized agents.
One agent may research, another may analyze, another may execute a domain-specific operation, and a supervisor may coordinate the overall task.
This pattern can be useful when:
- The problem naturally decomposes into independent domains
- Different sub-problems require different tools or knowledge
- Separate execution contexts are beneficial
- Parallel execution materially improves throughput
- Organizational or security boundaries require separation
- A single agent's context or responsibility becomes too broad
However, multi-agent architecture introduces another layer of distributed-system complexity.
Communication between agents becomes an architectural concern. So do shared state, message contracts, failure propagation, duplicate work, coordination, authorization, observability, and result synthesis.
A multi-agent system should therefore not be justified merely by the number of tasks involved.
The relevant question is:
Does decomposition into independently reasoning components create a capability that a single agent or workflow cannot provide efficiently and safely?
If not, the additional agents are architecture without sufficient architectural value.
Pattern Selection Is Not a Linear Progression
These patterns should not be interpreted as maturity levels:
LLM-Only
↓
Context
↓
RAG
↓
Tool
↓
Workflow
↓
Agent
↓
Multi-Agent
That would create exactly the wrong mental model.
A multi-agent system is not inherently more mature than a workflow. An agent is not inherently better than a tool-augmented LLM. RAG is not an upgrade to prompting.
These are different execution architectures for different problem characteristics.
A useful decision model is:

Real systems will combine these patterns.
A production architecture might therefore look like:
User
↓
Router
↓
Context Construction
↓
RAG
↓
Agent
├── Tool A
├── Tool B
└── Workflow
↓
Evaluator
↓
Response
The presence of several patterns does not make the architecture inherently sophisticated. It simply reflects the number of distinct responsibilities the application must perform.
The Governing Principle
Across all of these patterns, one principle should govern the architectural decision:
Choose the least complex execution pattern that fully satisfies the intelligence contract.
This principle has several consequences.
Do not introduce RAG when the required context is already known.
Do not introduce tools when the model can reliably perform the task without external state or deterministic computation.
Do not introduce a workflow when a single model invocation is sufficient.
Do not introduce an agent when the execution path can be defined deterministically.
Do not introduce multiple agents when one agent or a workflow can satisfy the requirement.
And do not introduce an evaluator merely because evaluation sounds like a mature AI architecture. Introduce it when the required quality threshold justifies the additional cost and latency.
The objective is not minimum technology. It is minimum necessary complexity.
This distinction is fundamental to enterprise LLM architecture. Every additional architectural mechanism introduces another failure boundary, another operational responsibility, another surface for evaluation, and another component whose behavior must be understood over time.
Architectural sophistication should therefore be earned by the problem.
From Pattern to Architecture
The pattern selected here establishes the execution topology for everything that follows.
It determines whether the application needs retrieval infrastructure, tool interfaces, workflow orchestration, agent state, multi-agent coordination, evaluation loops, or some combination of these capabilities.
It also establishes where the system must preserve determinism and where probabilistic intelligence is acceptable.
The next architectural question is therefore not simply how the model will respond. It is how context, reasoning, and action will be organized within the selected execution pattern.
That is where the architecture moves from choosing a pattern to designing the system itself.
Model the Application as an Intelligence Pipeline
Once the application pattern has been identified, the next architectural task is decomposition.
An enterprise LLM application is not a single black box that receives a prompt and returns an answer. It is a sequence of distinct cognitive and operational stages. Each stage performs a different kind of work, has different failure modes, and may require a different implementation strategy.
This distinction is fundamental.
Architects who skip decomposition often produce systems that perform convincingly in a demonstration but become difficult to control in production. A demonstration hides the seams between interpretation, retrieval, reasoning, decision-making, execution, and verification. Production exposes them.
A useful and sufficiently general model treats the application as an eight-stage intelligence pipeline:
INPUT
↓
UNDERSTAND
↓
CONTEXTUALIZE
↓
REASON
↓
DECIDE
↓
ACT
↓
VERIFY
↓
RESPOND
The sequence is deliberately simple. Its purpose is not to prescribe a particular technology or orchestration framework. It provides an architectural lens through which the work performed by the application can be separated into explicit responsibilities.
At each stage, the architect should be able to answer three questions:
- What work is being performed?
- What type of component should perform that work?
- What evidence establishes that the work was performed correctly?
Those questions turn an LLM application from an undifferentiated model interaction into an engineered system.
Why the Pipeline View Matters
The value of the pipeline is not the diagram itself. Its value lies in the discipline it imposes on architectural decisions.
At every stage, the architect must determine whether the problem is best solved through inference, retrieval, deterministic computation, business rules, external action, validation, or some combination of these mechanisms.
That distinction is important because language models are powerful precisely where language, ambiguity, synthesis, and probabilistic reasoning are involved. They are not inherently reliable mechanisms for enforcing exact business constraints, performing deterministic calculations, maintaining transactional guarantees, or proving that an external action actually occurred.
Consider a simple enterprise workflow. A user asks an application to modify an account. The model may be entirely appropriate for interpreting the request and determining what the user means. It may also be useful for reasoning over relevant account information. But whether the requested modification is permitted, whether the target account exists, whether the caller has sufficient authority, whether the transaction was successfully committed, and whether the resulting state is valid are different architectural concerns.
Sending all of those concerns through the same model call does not simplify the system. It merely hides the boundaries.
Those hidden boundaries eventually reappear as production failures:
- a plausible interpretation of an ambiguous request becomes the wrong action;
- retrieved information is confused with authoritative system state;
- a business rule is inconsistently applied because it exists only in a prompt;
- a tool invocation is interpreted as successful without confirmation;
- an incorrect result is presented with the same confidence and formatting as a verified result.
The pipeline view makes these boundaries explicit before they become operational problems.
Assigning an Implementation Strategy to Each Stage
Once the pipeline is established, each stage should receive an implementation strategy appropriate to the nature of the work.
The choice is not binary. A stage may be deterministic, probabilistic, or hybrid. The architect should make that choice deliberately based on the domain, error tolerance, regulatory requirements, operational consequences, latency objectives, and cost of failure.
| Stage | Function in the Pipeline | Representative Implementation |
|---|---|---|
| Understand | Interpret the input and extract intent, entities, constraints, and relevant structure from unstructured or semi-structured language. | Large language model, classifier, parser, or hybrid |
| Contextualize | Obtain the information required for the task but not contained in the input or model context, including policies, customer history, product data, and enterprise knowledge. | Vector retrieval, keyword search, structured queries, knowledge graph, or hybrid retrieval |
| Reason | Combine the interpreted request with contextual evidence to develop a candidate solution or course of action. | Large language model, reasoning model, or structured reasoning workflow |
| Decide | Convert the candidate reasoning into a bounded and auditable decision among defined alternatives. | Rules engine, policy engine, deterministic logic, model-assisted decisioning, or hybrid |
| Act | Execute an approved operation against an external system or system of record. | API invocation, tool execution, workflow engine, transaction, or system-of-record write |
| Verify | Establish that the intended action was authorized, executed successfully, produced the expected state, and satisfies applicable safety or business constraints. | Deterministic validation, state inspection, transaction confirmation, policy checks, and model-assisted review where appropriate |
| Respond | Translate the verified outcome into a coherent response appropriate to the requester, channel, and interaction context. | Large language model, template engine, or hybrid response generation |
The important architectural observation is that the pipeline does not require an LLM at every stage.
In fact, a well-designed system often uses the LLM selectively.
The model is particularly valuable at the boundaries where the system must interpret human language or express an outcome in human language. It is also valuable in the reasoning stage, where evidence must be synthesized and a candidate course of action constructed.
Other stages have different requirements.
Retrieval provides access to information rather than asking the model to manufacture it. Deterministic logic enforces rules rather than asking the model to remember them. External systems provide authoritative state rather than asking the model to infer whether an action occurred. Verification establishes evidence rather than assuming that a plausible model response represents a successful execution.
This separation is not an attempt to work around the limitations of language models. It is the architectural foundation for using them effectively.
From Model Capability to System Responsibility
This pipeline also changes how an architect evaluates technology.
The question is no longer:
Which model should power the application?
The more useful question is:
Which component should be responsible for each kind of work?
That shift is subtle but consequential.
Model selection remains important, but it becomes one decision within a larger architecture rather than the architecture itself. A highly capable model may be appropriate for complex reasoning but unnecessary for straightforward classification. A smaller model may be sufficient for intent extraction. A deterministic query may be preferable when the required information already exists in a structured system. A rules engine may be mandatory when the decision must be applied consistently and audited independently of model behavior.
The architecture therefore becomes a composition of capabilities rather than a wrapper around a model.
This is also where the distinction between knowledge and intelligence becomes important.
Retrieval supplies contextual knowledge. The model applies intelligence to interpret and reason over that knowledge. Deterministic components establish constraints. External systems provide authoritative state. Verification establishes whether the intended outcome actually occurred.
Each capability has a different responsibility.
When these responsibilities are collapsed into a single prompt, the system becomes difficult to reason about because the source of an outcome is no longer clear. When they are separated, the architect can ask a much more useful question:
Why did the system produce this outcome, and which architectural component was responsible for it?
That question is essential for debugging, governance, evaluation, security, compliance, and operational accountability.
The Governing Principle
The purpose of this decomposition is to prevent one of the most pervasive design errors in LLM application architecture:
Treating the entire application as an LLM with a prompt.
That framing is attractive because it makes the initial architecture appear simple. It is also misleading.
An enterprise application cannot delegate interpretation, knowledge acquisition, reasoning, policy enforcement, transaction execution, state management, verification, and response generation to a single probabilistic component and expect the resulting system to inherit enterprise-grade reliability automatically.
The consequences of this approach are predictable.
Without a retrieval boundary, the model may be forced to generate information that should have been obtained from an authoritative source. Without a decision boundary, business policy can become implicit prompt logic rather than an independently enforceable constraint. Without an execution boundary, a generated intention can be confused with a completed action. Without a verification boundary, the system has no reliable mechanism for distinguishing a successful operation from a plausible description of one.
The problem is not that the model failed to behave like a traditional application component.
The problem is that the architecture asked it to be one.
Stage-based decomposition addresses this problem by assigning each responsibility to the mechanism best suited to perform it. It creates explicit boundaries between probabilistic inference and deterministic control, between contextual knowledge and authoritative state, and between intended action and verified outcome.
Those boundaries become architectural control points.
They provide places where the system can be evaluated, observed, governed, secured, tested, and audited. They also provide a vocabulary for failure analysis. Instead of asking why "the AI failed," an architect can ask whether the failure occurred during interpretation, retrieval, reasoning, decisioning, execution, verification, or response generation.
That is a much more actionable question.
The Pipeline as an Architectural Contract
The eight-stage pipeline should therefore be treated as more than a conceptual diagram. It can serve as an architectural contract for the application.
Each stage establishes a responsibility boundary. Each boundary can have its own inputs, outputs, controls, evaluation criteria, latency expectations, and failure handling.
For example, the Understand stage can be evaluated for intent accuracy and entity extraction. Contextualize can be evaluated for retrieval relevance, completeness, and authorization filtering. Reason can be evaluated for logical consistency and evidence use. Decide can be evaluated against explicit policy constraints. Act can be evaluated through execution status and transaction state. Verify can establish whether the resulting state matches the intended outcome. Respond can then communicate only what the preceding stages have established.
This creates an important architectural property:
The system does not have to trust the model merely because the model produced the answer.
Trust can instead be constructed through the architecture.
The model can propose. Retrieval can provide evidence. Rules can constrain. Systems of record can establish state. Execution components can perform actions. Verification can establish outcomes. The response layer can communicate the resulting truth.
That is the difference between an LLM application that merely generates plausible output and an enterprise intelligence system that can be engineered, controlled, and defended in production.
The pipeline is therefore not a diagram to place on a presentation slide. It is a working discipline for deciding where intelligence belongs, where determinism is required, where evidence must be obtained, where actions must be controlled, and where outcomes must be proven.
An enterprise LLM application should not be designed as a model surrounded by infrastructure. It should be designed as an intelligence pipeline in which every responsibility has an explicit architectural home.
Context Engineering
In an enterprise LLM system, the model is rarely the only constraint. More often, the constraint is the context surrounding it.
Many teams still begin with a narrow implementation question: "Do we use RAG?" That question starts too far down the architectural stack. It assumes that retrieval is the answer before establishing what the system actually needs to know.
A more useful question is:
What information does the model need at inference time to perform this task correctly, and where does that information come from?
This shift in perspective changes the architecture.
Context is no longer treated as text assembled around a prompt. It becomes a first-class architectural subsystem with defined sources, ownership, lifecycle, access controls, transformation rules, quality requirements, and failure modes.
The objective of context engineering is therefore not simply to provide more information to the model. It is to provide the right information, at the right granularity, at the right time, within the constraints of the inference environment.
The Sources of Context
Enterprise context is rarely singular. It is assembled from multiple sources, each representing a different kind of information and each carrying different architectural characteristics.
Common sources include:
- User Context: identity, role, permissions, preferences, and relevant history
- Conversation Context: prior exchanges, current intent, unresolved questions, and conversational state
- Enterprise Knowledge: policies, procedures, product documentation, organizational knowledge, and institutional records
- Transactional Data: the current state of orders, accounts, cases, claims, tickets, and other business transactions
- Real-Time Data: information whose validity depends on the moment at which it is retrieved
- Tool Results: information returned by APIs, databases, services, or other tools invoked during execution
- Policy Context: constraints governing what the system may disclose, retrieve, recommend, or execute
- System Instructions: the operational intent and behavioral boundaries established for the application
- Domain Rules: business logic, constraints, and specialized knowledge that may not exist in the underlying model
- Previous Actions: actions already performed during the current interaction or workflow
- Agent State: the current position, objectives, intermediate results, and outstanding steps within a multi-step process
These sources differ not only in content, but also in volatility, ownership, authority, access requirements, retrieval cost, and trust characteristics.
That distinction matters.
A policy document may remain valid for months. An account balance may become stale within seconds. A conversation may exist only for the duration of a session. An agent's state may change after every tool invocation.
Treating all of these as an undifferentiated collection of "context" hides the architectural decisions that determine whether the resulting system can be trusted.
Context engineering begins by making those differences explicit.
Structuring Context by Volatility
A useful architectural distinction is not simply where context originates, but how quickly its validity changes.
Volatility determines how information should be stored, refreshed, retrieved, cached, and assembled.

Persistent Knowledge changes relatively slowly. Product documentation, policy manuals, organizational structures, technical specifications, and similar information can be indexed, governed, cached, and reused across many requests.
Ephemeral Context is associated with the current interaction or workflow. Conversation history, immediate user intent, intermediate reasoning state, and current task state generally exist for the duration of the interaction and may have limited value beyond it.
Real-Time Information derives its value from being current. Account balances, inventory availability, transaction status, operational telemetry, and live system state may become incorrect as soon as the underlying system changes. For such information, indiscriminate caching is not merely a performance decision. It can become a correctness problem.
The Context Builder is the architectural component that reconciles these streams. It determines what information should be included, what should be excluded, how sources should be prioritized, how much information should be carried forward, and how the resulting context should be assembled within the model's context and latency budgets.
Its output is the Model Context, the information the LLM actually receives and reasons over.
This leads to a central architectural principle:
Context engineering is not prompt construction. It is the systematic design of the information pipeline that determines what the model can know at inference time.
That pipeline must answer two fundamental questions. First, how is the required knowledge made available? Second, how is the relevant portion of that knowledge selected for the current task?
The first is the domain of Knowledge Architecture. The second is the domain of Retrieval Thinking.
Knowledge Architecture
When enterprise knowledge must be made available to an LLM, the immediate reaction is often to introduce a vector database.
That is an implementation decision made too early.
Before selecting a storage or retrieval technology, the architecture must answer three more fundamental questions:
- What is the source of knowledge?
- How is that knowledge transformed into a usable representation?
- How will the system retrieve the information required by each class of task?
The answers define the knowledge architecture.
Enterprise knowledge rarely resides in a single repository or arrives in a uniform structure.
A realistic knowledge landscape may include:
- Documents
- Databases
- APIs
- SaaS platforms
- Event streams
- Knowledge graphs
- Data warehouses
- Emails
- Tickets
- Source code
- Policies and procedures
Each source has a different access pattern, update cadence, schema, ownership model, security boundary, and governance requirement.
The architecture therefore begins with a knowledge inventory, not a vector index.
A system designed primarily around documents, for example, may work well until a user asks a question that requires combining a policy document with the current state of a transaction. At that point, the limitation is not the language model. The limitation is the knowledge architecture.
The fundamental question is:
Where does authoritative knowledge live, and what is the system of record for each knowledge domain?
Without a clear answer, retrieval quality cannot be made reliable because the system does not yet know what "authoritative" means.
Making enterprise knowledge usable by an LLM is not a single ingestion step. It is a transformation pipeline.
Source
↓
Ingestion
↓
Parsing
↓
Normalization
↓
Metadata
↓
Chunking
↓
Embedding / Indexing
↓
Knowledge Store
Every stage creates architectural consequences downstream.
Parsing determines whether the original structure survives. Tables, headings, lists, code blocks, relationships, and document hierarchy can carry meaning that is lost when content is reduced to unstructured text.
Normalization determines whether equivalent information from different systems can be represented consistently.
Metadata determines whether knowledge can later be filtered by attributes such as date, owner, business unit, geography, classification, sensitivity, or validity period.
Chunking determines the semantic unit available to retrieval. Chunks that are too large increase noise and context consumption. Chunks that are too small can destroy the relationships required to interpret the information correctly.
Embedding and indexing determine how the resulting representations can be discovered through different retrieval mechanisms.
These decisions cannot simply be deferred to the retrieval layer. Once information has been flattened, stripped of metadata, or fragmented incorrectly, the retrieval system cannot reliably reconstruct what the ingestion pipeline failed to preserve.
Knowledge architecture therefore establishes the retrieval potential of the system long before a user submits a query.
"Vector search" is one retrieval mechanism. It is not a definition of retrieval.
Depending on the nature of the question, an enterprise application may require:
Keyword Retrieval
Vector Retrieval
Hybrid Retrieval
Metadata Filtering
Graph Retrieval
SQL Retrieval
Semantic Retrieval
Multi-Hop Retrieval
Hierarchical Retrieval
Temporal Retrieval
Different questions impose different retrieval requirements.
A question asking for the exact wording of a policy clause may benefit from keyword and metadata filtering. A question involving conceptual similarity may benefit from vector retrieval. A question requiring relationships between entities may require graph or multi-hop retrieval. A question where recency determines correctness may require temporal retrieval.
The architecture should therefore select retrieval mechanisms according to the information need, not according to the popularity of a particular technology.
A mature enterprise architecture may use several retrieval mechanisms within the same application and may combine them within a single retrieval pipeline.
The retrieved information must then be transformed into context:
Retrieve
↓
Filter
↓
Rank
↓
Compress
↓
Construct Context
Retrieval is therefore not complete when a search engine returns documents. It is complete when the system has produced a sufficiently relevant, authoritative, and appropriately sized information set for the downstream reasoning task.
One of the most persistent architectural errors in enterprise RAG implementations is treating retrieval-augmented generation primarily as a search problem.
It is better understood as a context acquisition problem.
A search problem is solved when the relevant document is found.
A context acquisition problem is solved only when the right information, at the right granularity, from an authoritative source, is available to the model at the right point in the task.
That distinction is fundamental.
Search is a mechanism within the pipeline. Context acquisition is the architectural objective.
This is why a system can have a sophisticated vector database, strong embeddings, and a technically correct RAG implementation and still produce unreliable answers. The system may retrieve something relevant without retrieving what the model actually needs to reason correctly.
Retrieval Thinking
Knowledge Architecture establishes how enterprise knowledge becomes available to the system. Retrieval Thinking establishes how the system decides what knowledge to bring forward for a particular task.
Retrieval therefore deserves the same architectural discipline applied to any other production subsystem.
It can be understood as three sequential concerns:
- Query Understanding
- Retrieval
- Context Optimization
Each addresses a different failure mode.
User Query
↓
Intent
↓
Query Decomposition
↓
Search Queries
The literal wording of a user request and the information required to satisfy it are often different.
A user may ask a single question that implicitly contains several information requirements. The retrieval system may therefore need to identify intent, determine the relevant entities and constraints, decompose the request, and generate one or more targeted retrieval queries.
For example, a question about whether a customer is eligible for a particular service may require several distinct pieces of information:
- the applicable policy,
- the customer's current attributes,
- the effective date of the policy,
- and the current status of the customer's account.
A single semantic search against a document collection does not necessarily express that information need.
Query understanding transforms the user's request into a retrieval problem the system can actually execute.
Candidate Generation
↓
Filtering
↓
Ranking
↓
Reranking
Retrieval is a funnel rather than a single lookup.
Candidate generation casts a sufficiently broad net to preserve recall.
Filtering removes candidates that violate explicit constraints such as access permissions, metadata conditions, time ranges, or business rules.
Ranking orders the remaining candidates according to relevance.
Reranking applies a more precise relevance assessment when the additional computational cost is justified.
This staged approach allows the architecture to balance recall, precision, latency, and cost.
Collapsing all of these concerns into a single retrieval operation often produces systems that appear effective in controlled demonstrations but become less reliable as the knowledge base, query diversity, and production workload increase.
Retrieved Information
↓
Deduplication
↓
Relevance Filtering
↓
Compression
↓
Context Assembly
Retrieving the right information is necessary, but it is not sufficient.
The retrieved material must still be prepared for the model.
Duplicate passages consume context without adding information. Marginally relevant material introduces noise. Excessively verbose source content consumes tokens that could otherwise carry more important evidence. Conflicting information may require prioritization based on authority, recency, or applicability.
Context optimization therefore determines the final information set presented to the model.
This is where Retrieval Thinking reconnects with the Context Builder introduced in Section Structuring Context by Volatility.
The retrieval subsystem discovers candidate knowledge. The Context Builder determines what ultimately becomes part of the model's working context.
That distinction is important because retrieval results are not the same thing as model context.
The architectural discipline becomes particularly important when evaluating system quality.
Before asking:
Did the LLM answer correctly?
ask the preceding question:
Did the system retrieve the information required to answer correctly?
These are different questions.
A response can be wrong because the system retrieved the wrong information. It can also be wrong because the model failed to reason correctly over information that was retrieved appropriately. It can fail because both occurred simultaneously.
Separating these failure domains creates two distinct quality dimensions:
Retrieval Quality
+
Generation Quality
=
Application Quality
Retrieval Quality concerns whether the system identified and supplied the information required for the task.
Generation Quality concerns whether the model used that information appropriately to produce the intended response.
An application with strong retrieval and weak generation may have the necessary evidence but express it poorly, misunderstand the task, or reason incorrectly. An application with strong generation and weak retrieval may produce a fluent, coherent, and persuasive answer based on incomplete or incorrect evidence.
The user experiences both failures as an incorrect application outcome, but the engineering response is different.
That is why retrieval and generation must be evaluated independently.
For enterprise LLM architecture, this separation is more than a testing convenience. It establishes a fundamental principle of system design:
The quality of an LLM application is bounded not only by the intelligence of its model, but by the quality of the context made available to that model.
Context Engineering therefore sits at the intersection of knowledge, retrieval, application state, policy, and model inference. Its responsibility is not to maximize the amount of information sent to the LLM. Its responsibility is to ensure that the model receives the information required to perform the task, in a form that is relevant, authoritative, timely, and operationally viable.
Reasoning Architecture
Once the data foundation and retrieval strategy are established, a more consequential question emerges:
How should the system reason over the information it has been given?
This is not a prompting decision. It is an architectural decision.
The reasoning strategy determines how much computation the system performs, how many inference steps it requires, whether intermediate states must be maintained, whether external tools are needed, and how failure propagates through the application. These choices directly affect latency, cost, reliability, observability, and the kinds of errors the system produces in production.
The central architectural challenge is therefore not to maximize reasoning capability. It is to match reasoning complexity to problem complexity.
A system that applies insufficient reasoning may produce an answer before the problem has been adequately understood. A system that applies excessive reasoning may introduce unnecessary latency, cost, and operational complexity. One under-reasons. The other over-engineers.
Both are architectural failures.
The Spectrum of Reasoning Strategies
Enterprise LLM applications can employ a broad spectrum of reasoning strategies. They range from a single inference step to increasingly structured processes involving decomposition, planning, verification, iteration, and external execution.
The appropriate strategy depends on the nature of the task, the consequences of error, and the constraints under which the application must operate.
Direct Generation. The model produces an answer in a single inference pass, without an explicit intermediate reasoning process. This is appropriate for narrow, well-bounded tasks where the required information is already available and the primary operation is interpretation, transformation, or response generation.
Structured Reasoning. The application guides the model through a defined reasoning structure before producing the final result. This can improve consistency and reduce avoidable errors when a task requires several logical steps but does not justify a more elaborate execution architecture.
Decomposition. A complex problem is divided into smaller sub-problems that can be addressed independently before their results are combined. Decomposition reduces cognitive and contextual complexity by turning one difficult problem into a collection of more manageable problems.
Planning. The system determines an explicit sequence of actions or reasoning steps before execution begins. Planning becomes valuable when the path to the desired outcome is not known in advance and must be determined dynamically.
Self-Checking. The system evaluates its own output against predefined criteria before returning the result. This introduces a verification stage that can identify omissions, inconsistencies, or violations without necessarily requiring a separate model or external evaluator.
Critique and Reflection. A separate evaluation pass examines an initial result and identifies weaknesses or required corrections. The evaluator may be the same model, a different model, or a specialized evaluation component. The resulting feedback can then be incorporated into a subsequent generation step.
Voting. Multiple independent generations are produced and compared before a result is selected or synthesized. Agreement across independent attempts can provide an additional signal for tasks where multiple reasoning paths are possible, although it increases inference cost and does not guarantee correctness.
Iterative Refinement. The system generates an initial result and repeatedly improves it through successive passes. Each iteration uses the previous result as an input to the next stage, allowing the application to progressively improve quality against defined criteria.
Tool-Assisted Reasoning. The model delegates specific operations to external tools rather than attempting to perform them through generation alone. Calculation, database queries, code execution, API calls, and enterprise-system interactions are examples where deterministic or authoritative external capabilities can complement model reasoning.
Workflow-Based Reasoning. Reasoning is embedded within an explicit sequence of application stages, each with a defined responsibility, input, output, and transition condition. This approach is particularly useful when portions of the reasoning process benefit from deterministic control, explicit governance, predictable execution, or auditable state transitions.
These strategies are not mutually exclusive.
A production system may combine them. A workflow may use decomposition, invoke tools for specific subtasks, apply a verification step, and then perform a final generation. The architectural question is therefore not which reasoning pattern to adopt universally, but which combination is appropriate for a particular class of work.
Reasoning as an Architectural Trade-Off
Reasoning introduces capability, but capability is not free.
Additional reasoning steps generally introduce additional inference calls, intermediate state, orchestration logic, token consumption, and failure opportunities. More sophisticated reasoning can improve the quality of difficult tasks while simultaneously making the overall system slower, more expensive, and harder to operate.
The architect must therefore evaluate reasoning along several dimensions:
| Dimension | Architectural Question |
|---|---|
| Complexity | How difficult is the problem to solve correctly? |
| Latency | How much additional inference time can the user or workflow tolerate? |
| Cost | How much additional model and tool execution can the workload sustain? |
| Reliability | Does additional reasoning reduce or introduce failure modes? |
| Determinism | Does the task require predictable execution or allow probabilistic behavior? |
| Risk | What is the consequence of an incorrect result or action? |
| Observability | Can the reasoning process be measured, traced, and diagnosed? |
| Control | Which parts of the process must remain deterministic or policy-controlled? |
These dimensions prevent reasoning from becoming an isolated model-level decision.
A reasoning strategy that appears superior when measured only by answer quality may be inappropriate when evaluated against production latency, cost, reliability, or operational constraints.
The Governing Principle
No reasoning strategy is inherently superior.
Each is a mechanism for addressing a particular class of problem. The architect's responsibility is to select the minimum reasoning architecture capable of satisfying the task's quality and risk requirements.
The governing principle is:
Reasoning complexity should be proportional to problem complexity.
A simple FAQ does not require a planner, critic, iterative loop, or multi-agent execution architecture. If the required information is already available and the transformation is straightforward, direct generation may be sufficient.
A complex task involving multiple sources, dependencies, decisions, external actions, and significant consequences may require decomposition, planning, tool use, verification, and iterative refinement.
The objective is not to make every application more intelligent by adding more reasoning.
The objective is to make the reasoning fit the work.
This distinction matters because unnecessary reasoning compounds across every request. Additional inference calls increase latency. Additional context increases token consumption. Additional orchestration introduces more state and more failure points. Additional tools create more integration surfaces. Additional loops make debugging and observability more difficult.
Complexity therefore has an operational cost.
At the same time, insufficient reasoning has a different cost. If the application attempts to solve a multi-step problem through a single generation when the task requires decomposition, planning, verification, or tool use, the resulting system may produce answers that are fluent but incomplete, inconsistent, or incorrect.
The architectural objective lies between these extremes.
Use enough reasoning to satisfy the problem's complexity, risk, and quality requirements, but no more than the system can justify operationally.
That is the discipline of Reasoning Architecture.
The architect should understand the full spectrum of reasoning strategies, know the conditions under which each becomes valuable, and design explicit boundaries around when the system should reason directly, decompose, plan, invoke tools, verify, reflect, or stop.
The most sophisticated reasoning architecture is not necessarily the one with the most stages.
It is the one in which every stage exists for a reason.
Prompt Architecture
There is a persistent habit, even among experienced teams, of treating a prompt as a string: a paragraph written in natural language, refined through trial and error, and deployed once the responses appear satisfactory.
That approach may work for experimentation. It does not scale to production.
A prompt is not merely a string. It is an application control surface. It belongs to the same architectural category as an API contract, configuration schema, policy definition, or workflow specification.
It influences what the model is expected to do, what constraints it must observe, what information it can use, what external information has been supplied to it, and what form its response must take.
Once prompts become part of a production system, they acquire the characteristics of software. They have dependencies, versions, interfaces, security boundaries, failure modes, and operational consequences.
Treating them as prose hidden inside application code creates predictable problems: behavior becomes difficult to trace, changes become difficult to review, regressions become difficult to reproduce, and seemingly minor edits can alter downstream application behavior.
The architectural question is therefore not:
"What prompt should we write?"
It is:
"How should the application construct, govern, secure, evaluate, and evolve the instructions and context presented to the model?"
The Composition Stack
A production prompt is rarely a single block of text. It is a runtime composition of distinct information and instruction layers.
A useful conceptual model is:
System Instructions
+
Policy Instructions
+
Task Instructions
+
User Input
+
Retrieved Context
+
Tool Results
+
Output Contract
These layers are not interchangeable. They have different purposes, different trust characteristics, different owners, and different lifecycles.
System Instructions establish the fundamental operating boundary of the model within the application. They define what the system is expected to do, what it must not do, and the behavioral constraints that apply across requests.
Policy Instructions express organizational, regulatory, security, privacy, and compliance requirements. These constraints exist independently of the immediate task and must continue to apply regardless of what the user requests or what external content is retrieved.
Task Instructions define the work being performed during the current invocation. They describe the objective, workflow, decision criteria, required behavior, and task-specific output expectations.
User Input represents the request supplied by the user. It is essential application input, but it must not automatically acquire the authority of an instruction simply because it appears in the prompt.
Retrieved Context provides information acquired from enterprise knowledge sources. It supplies evidence or reference material for the task, but retrieved content should generally be treated as data to be interpreted rather than as instructions that can redefine application behavior.
Tool Results contain information returned by external systems during execution. Database records, API responses, calculations, search results, and other tool outputs become part of the model's available evidence, subject to the application's trust and validation rules.
Output Contract defines what the model is expected to return. This may be a JSON schema, structured object, fixed response format, classification set, or other machine-consumable representation required by downstream components.
These layers answer different architectural questions:
- System Instructions: What operating boundaries apply?
- Policy Instructions: What organizational constraints must be enforced?
- Task Instructions: What must be accomplished now?
- User Input: What does the user want?
- Retrieved Context: What relevant information is available?
- Tool Results: What did external systems return?
- Output Contract: What must the result look like?
The distinction matters because instruction and information are not the same thing.
A retrieved document may contain a sentence that looks like an instruction. A user may deliberately include text that attempts to redefine system behavior. A tool may return content originating from an untrusted external source.
If the architecture does not distinguish these categories, the model receives an ambiguous mixture of instructions and data. That ambiguity creates an attack surface and makes behavior substantially harder to reason about.
Prompt architecture therefore begins with composition and trust boundaries, not wording.
Prompt Composition Is an Architectural Concern
The prompt shown to the model is often assembled dynamically.
System policies may come from one configuration source. Task instructions may come from an application workflow. User input arrives at runtime. Retrieved context comes from the knowledge layer. Tool results may arrive later during execution. The final output contract may be determined by the downstream service consuming the response.
The resulting prompt is therefore better understood as a runtime artifact than as a static document.
Policies
+
Task Definition
+
Runtime Inputs
+
Retrieved Context
+
Tool Results
+
Output Contract
↓
Prompt Composition
↓
Model Invocation
This has an important architectural consequence:
Prompt composition belongs in the application's orchestration layer, not in the category of ad hoc prose.
Composition logic must be deterministic enough to inspect, version, test, and reproduce.
When a production response is incorrect, the engineering team should be able to determine what instructions, policies, user inputs, retrieved passages, tool results, and output constraints were present at the time of inference.
Without that capability, prompt behavior becomes difficult to diagnose because the effective prompt exists only transiently inside a running request.
What the Architecture Demands
Once prompts are treated as architectural artifacts, several requirements become unavoidable.
Instruction Hierarchy
When two instructions conflict, the system must have a defined precedence model.
Which constraints are authoritative? Which inputs are untrusted? Which policies cannot be overridden by a user request? Which application rules take precedence over task-specific instructions?
These decisions should be explicit.
A production system should never depend on the model arbitrarily resolving conflicting instructions. Instruction precedence is part of the application architecture and should be reinforced through both prompt structure and application-level controls.
Prompt Composition
The application must define how the different layers are assembled at runtime.
This includes templates, conditional sections, reusable components, model-specific adaptations, and orchestration logic. Prompt construction should be treated with the same discipline applied to other application code because a change in composition can change application behavior.
Variable Injection
Dynamic values must be introduced safely.
User attributes, transaction data, retrieved content, workflow state, and tool results should enter clearly defined locations within the prompt structure. The architecture must prevent dynamic data from unintentionally becoming higher-authority instructions.
This is particularly important when content originates outside the application's trusted control boundary.
Context Boundaries
The system must make the boundaries between instructions and data explicit.
User input, retrieved documents, tool responses, and other external content should be structurally distinguishable from application instructions. Clear delimiters can improve model interpretation, but they should not be treated as a complete security control. Trust must ultimately be enforced through the surrounding application architecture.
Prompt Versioning
Prompts evolve.
A production system therefore needs version control, change history, release discipline, rollback capability, and traceability.
When application behavior changes, the team should be able to answer a basic operational question:
Which prompt version produced this result?
Without that information, prompt changes become difficult to correlate with regressions, evaluation results, or changes in production behavior.
Prompt Testing
A prompt contains behavioral logic and should be evaluated accordingly.
Testing should include representative cases, edge cases, adversarial inputs, regression scenarios, structured-output validation, and known failure modes.
The objective is not to prove that a prompt is correct for every possible input. It is to establish measurable evidence that a change has not degraded known requirements.
Prompt evaluation should therefore become part of the application's continuous engineering lifecycle rather than an informal activity performed by someone manually testing a few examples in a chat interface.
Prompt Security
Prompts are part of the application's attack surface.
They may contain sensitive instructions, business rules, policy constraints, or information about system behavior. They may also be influenced indirectly by external content entering through users, documents, websites, APIs, tools, or other systems.
Security architecture must therefore consider what information can enter the prompt, what authority that information has, and what actions can result from the model's interpretation of it.
Prompt Injection
Prompt injection is a direct consequence of failing to maintain a reliable distinction between trusted instructions and untrusted content.
An attacker may place adversarial instructions in user input, retrieved documents, web content, tool responses, or other data sources and attempt to influence the model's behavior.
The important architectural insight is that prompt injection is not merely a prompting problem.
It is a trust-boundary problem.
Defenses therefore need to extend beyond prompt wording to include input handling, content isolation, authorization, tool permissions, output validation, retrieval controls, and application-level enforcement of security-critical decisions.
A prompt should not be the sole security boundary protecting a consequential operation.
Output Contracts
The model's output is frequently not the final product. It is input to another component.
A downstream service may expect a specific JSON structure, a controlled vocabulary, a set of fields, or a particular decision representation. If the model produces an unexpected structure, the failure may occur several components away from the prompt that caused it.
An output contract makes that interface explicit.
The contract should define the expected schema, required fields, permissible values, validation rules, and failure behavior. Where possible, the application should validate the model's output before allowing it to enter a downstream workflow.
This turns model output from loosely structured prose into an explicit application interface.
From Prompt to Control Surface
These concerns change the way prompts should be designed.
A prompt should not be viewed as a piece of prose that happens to control a model. It should be viewed as a versioned, testable, observable, and security-sensitive application artifact.
The distinction is subtle but consequential.
A prose artifact is optimized primarily for readability.
A production control surface must also be optimized for determinism, traceability, security, evaluation, maintainability, and change management.
This is why prompt engineering alone is insufficient for enterprise LLM applications. Prompt architecture must account for the entire lifecycle of the model interaction:
Compose
↓
Validate
↓
Invoke
↓
Observe
↓
Evaluate
↓
Version
↓
Evolve
The prompt is the interface through which application intent, policy, context, and runtime information meet the model.
Once that interface becomes part of a production system, it deserves the same architectural discipline as every other critical interface in the application.
The objective is not to create the cleverest prompt.
It is to create a controlled and evolvable prompt architecture that produces reliable model behavior under real production conditions.
Structured Output
There is a natural temptation, especially during early experimentation, to let the model respond freely and interpret its output the way a human would.
That approach works well enough in a demonstration.
It becomes fragile as soon as the model's response must trigger a workflow, populate a database, invoke another service, update application state, or make a downstream decision without a human interpreting the result first.
Enterprise applications therefore need a clear boundary between human-readable generation and machine-consumable output.
The principle is straightforward:
When downstream systems depend on the model's output, prefer structured output over free-form text.
Free-form language is optimized for human interpretation. Machine interfaces require explicit structure.
The Distinction in Practice
Consider a model evaluating a customer interaction and recommending the next action.
A structured response might be:
{
"decision": "escalate",
"confidence": 0.91,
"reason": "Customer reported repeated billing errors across three consecutive cycles.",
"next_action": "route_to_billing_specialist"
}
The same semantic conclusion expressed as free-form text might be:
I think the customer should probably be escalated to a billing
specialist, since it looks like there have been repeated billing
errors over the past few cycles, and I'm fairly confident about this.
Both responses communicate approximately the same meaning.
They do not provide the same architectural value.
The structured response exposes explicit fields with defined semantics. A downstream system can inspect decision, validate confidence, record reason, and execute next_action without first interpreting natural language.
The free-form response requires an interpretation layer. That layer may be a human, a regular-expression parser, another model, or application-specific heuristics. Each introduces additional complexity and another potential failure point.
Terms such as "probably," "I think," and "fairly confident" may communicate useful nuance to a person, but they do not constitute a reliable machine interface. A defined confidence field with an agreed representation can be validated, stored, monitored, and used by downstream logic.
The difference is not presentation.
It is interface design.
What Structure Buys You
Structured output turns the model response into an explicit application contract. That enables capabilities that are difficult to achieve reliably with unrestricted natural language.
Schema Validation. The response can be validated against a defined schema before it enters the next stage of the application. Required fields, data types, permissible values, and structural constraints can be checked at the boundary rather than allowing malformed output to propagate downstream.
Deterministic Routing. Explicit decision fields can drive application logic directly. A workflow can branch on a defined value rather than attempting to infer intent from a paragraph of prose.
API Integration. Structured model output can conform to service interfaces and application contracts, allowing the LLM to participate in an existing architecture without requiring every downstream component to understand natural language.
Automated Testing. Structured fields provide concrete assertions for evaluation and regression testing. Tests can verify whether a decision, classification, field value, or required property is present and valid.
Observability. Structured outputs make model behavior measurable. Decision categories, confidence indicators, reason codes, classifications, and other fields can be logged, aggregated, compared, and monitored over time.
This enables questions that are difficult to answer reliably from transcripts alone:
- How frequently is each decision produced?
- How often does the model return an invalid structure?
- Which decision categories are changing over time?
- Where are confidence values concentrated?
- Which outputs require human escalation?
- Which model or prompt version produced a particular result?
Downstream Processing. Workflow engines, databases, event pipelines, analytics systems, and other services can consume structured data directly. The model becomes another component in the application pipeline rather than a special case that requires interpretation before every handoff.
Structure Is a Contract, Not a Guarantee
Structured output solves an important problem, but it does not solve every problem.
A response can be structurally valid and still be semantically wrong.
For example:
{
"decision": "escalate",
"confidence": 0.91,
"reason": "Customer reported repeated billing errors across three consecutive cycles.",
"next_action": "route_to_billing_specialist"
}
The JSON may conform perfectly to its schema while the underlying decision is incorrect because the model misunderstood the customer interaction or because the retrieved context was incomplete.
This distinction is fundamental:
Schema validation establishes structural correctness. It does not establish semantic correctness.
The architecture therefore needs both.
Model Generation
↓
Schema Validation
↓
Semantic Evaluation
↓
Policy / Business Validation
↓
Downstream Action
The exact pipeline will vary by use case. A low-risk summarization task may require only structural validation. A high-consequence decision may require additional business-rule validation, confidence thresholds, human review, or independent evaluation before an action is permitted.
Structured output creates the interface. It does not remove the need for application controls.
The Underlying Principle
The cleanest way to reason about structured output is to separate two responsibilities:
The LLM generates semantic intent. The schema defines structural form.
The model is responsible for interpreting the available information and producing the intended semantic result.
The schema defines how that result must be represented so that another component can consume it predictably.
The application remains responsible for determining whether the result is valid, authorized, safe, and appropriate to act upon.
These responsibilities should not be collapsed into a single assumption that "valid JSON means a valid answer."
A useful architectural boundary is therefore:

This separation changes the role of the LLM within the enterprise architecture.
The model is no longer treated as an unpredictable text generator whose output must be interpreted after the fact. It becomes a reasoning component operating behind an explicit interface.
That interface makes the model easier to integrate, test, observe, govern, and evolve.
The objective is not to eliminate natural language from an LLM application.
It is to use natural language where humans need language, and structured contracts where machines need reliable interfaces.
That is the boundary between an LLM response and a production application component.
Tool and Action Architecture
Up to this point, the model has primarily performed a bounded set of activities: interpreting information, reasoning over context, and generating a response.
The moment the model can act, the architecture changes fundamentally.
Searching a customer record, creating a ticket, sending an email, updating an account, approving a transaction, or invoking an external service moves the LLM from an information-processing component into an action-taking component.
The distinction matters.
A system that generates text can produce a bad answer. A system that can act can produce a bad outcome.
The architectural question is therefore no longer simply:
What should the model say?
It becomes:
What is the model permitted to do, under what conditions, with what authority, and with what controls around the action?
The useful mental model is not that "the LLM has tools."
It is that the LLM has been granted a set of controlled capabilities, each representing a deliberate and bounded delegation of authority.

The apparent symmetry in this diagram is misleading.
These capabilities have materially different risk profiles.
Searching a customer record is generally a read operation. Retrieving a policy is informational. Calculating a premium may produce a consequential recommendation without changing state. Sending an email creates an external communication. Approving a transaction may commit money, alter records, or create an obligation for the organization.
They should therefore not be treated as equivalent simply because they are all represented as "tools."
The Action Spectrum
A useful architectural distinction is to classify tools according to the authority they exercise:
Read
↓
Calculate
↓
Recommend
↓
Write
↓
Communicate
↓
Commit
The boundaries will vary by domain, but the principle remains consistent: the closer an action is to changing external state or creating an irreversible consequence, the stronger the controls around that action should be.
This distinction also affects the degree of autonomy the application should permit.
A read-only operation may be executed automatically when the appropriate authorization exists. A write operation may require additional validation. A high-consequence action may require explicit policy checks, transaction controls, or human approval before execution.
The important point is that the model should not determine its own authority.
The application architecture determines what the model is allowed to do.
What Every Tool Requires
A tool exposed to an LLM should be treated as production infrastructure, not as a convenience function attached to a prompt.
The model is an unpredictable caller. It may select the wrong tool, supply inappropriate arguments, repeat an operation, misunderstand a tool result, or continue operating after a downstream failure.
The tool boundary must therefore provide its own controls.
At minimum, every production tool should address the following concerns.
Explicit Schema. The tool requires a precise input and output contract. Input parameters, data types, required fields, permissible values, and output semantics should be explicit. The model should not have to infer the interface from ambiguous descriptions.
Authorization Boundary. The tool must define exactly what authority it grants. Authorization should be enforced at the tool or service boundary rather than relying on the prompt to persuade the model not to perform an unauthorized operation.
Input Validation. Every argument supplied by the model is untrusted input. The tool must validate it before execution, just as it would validate input from any other external caller.
Output Contract. Tool results should have a predictable structure and well-defined semantics. The model's subsequent reasoning should operate on explicit data rather than attempting to interpret arbitrary response formats.
Timeout. Every external operation needs a bounded execution time. A stalled dependency should not hold an agentic reasoning loop indefinitely.
Retry Policy. Retries must be explicitly defined. The system should determine which failures are retryable, how many attempts are permitted, and what backoff strategy applies. The model should not improvise retry behavior.
Idempotency. Any operation that changes state must account for duplicate execution. A retry, timeout, network ambiguity, or repeated model decision must not accidentally create two tickets, send two payments, or apply the same transaction twice.
Auditability. Tool invocation should produce a durable record of what was called, with which parameters, under whose authority, at what time, and with what result. For consequential actions, the audit trail should support reconstruction of the complete decision and execution path.
Rate Limits. Tool invocation must be bounded. A reasoning loop that repeatedly calls a dependency can exhaust downstream capacity, create unexpected costs, or amplify an otherwise minor failure.
Error Semantics. Failure must be represented as structured information. The model needs to know whether a call failed because of invalid input, authorization, timeout, unavailable data, a transient dependency problem, or a business-rule rejection. Different failures require different responses.
These are not optional refinements.
They define the boundary between a model that can merely request an action and an enterprise system that can safely execute one.
Tool Descriptions Are Part of the Interface
There is an additional concern that becomes important in LLM-based systems: the model must understand what a tool does before deciding whether to invoke it.
Tool descriptions therefore form part of the model-facing interface.
A good description should make clear:
- what the tool does,
- when it should be used,
- when it should not be used,
- what inputs it requires,
- what the inputs mean,
- what it returns,
- what side effects it creates,
- and what conditions prevent execution.
Ambiguous tool descriptions create an architectural problem because the model may select a tool based on an incorrect interpretation of its purpose.
This is especially important when several tools provide related capabilities. A model should not have to guess whether a tool merely previews an action, recommends an action, or actually commits it.
The distinction between query, simulate, recommend, and execute should be explicit wherever those operations have materially different consequences.
Separate Reasoning From Authority
A critical architectural boundary is the separation between the model's ability to decide that an action is appropriate and the application's authority to permit that action to occur.
For example, a model may determine:
Customer appears eligible for refund.
That does not mean the model should be permitted to execute:
Issue Refund
A safer architecture separates the two:
LLM Reasoning
↓
Proposed Action
↓
Policy Validation
↓
Authorization
↓
Business Validation
↓
Execution
↓
Audit
The model proposes.
The application validates.
The authorization layer permits.
The execution service acts.
The audit layer records.
This separation prevents the model from becoming the ultimate authority over consequential operations.
It also creates a much clearer failure boundary. A model can make an incorrect recommendation without that recommendation automatically becoming an irreversible action.
The Governing Constraint
All of these controls support one fundamental architectural principle:
The LLM should never receive more authority than the task requires.
This is least privilege applied to probabilistic software.
A model that can search a customer record does not require the authority to modify that customer's account. A model that can draft an email does not necessarily require the ability to send it. A model that can recommend a transaction does not necessarily require permission to commit it.
Authority should be explicit, bounded, contextual, and revocable.
This also means that tool access should not be treated as a permanent capability of the model. Capabilities can be granted according to the current workflow, user authorization, transaction context, environment, or risk level.
A production architecture might therefore distinguish:
Capability
↓
Authorization
↓
Policy
↓
Validation
↓
Execution
↓
Audit
Each stage answers a different question:
- Capability: What can the system technically do?
- Authorization: Who or what is permitted to request it?
- Policy: Under what conditions is the action allowed?
- Validation: Is this particular request valid?
- Execution: Can the action now be performed?
- Audit: Can the decision and action later be reconstructed?
This distinction is critical because technical capability and business authority are not the same thing.
The fact that a model can invoke a tool does not mean it should invoke it. The fact that a user is authorized to perform an operation manually does not necessarily mean that an autonomous system should perform it without additional controls.
Bound the Blast Radius
Tool architecture is ultimately about controlling the consequences of model decisions.
A model will sometimes misunderstand a request. It will sometimes select an inappropriate tool. It will sometimes produce invalid arguments. External dependencies will fail. Retries will occur. Context will be incomplete. The objective is not to design a system that assumes none of these things will happen.
The objective is to design a system in which the consequences of those failures are bounded.
That means limiting permissions, validating inputs, constraining tool scope, separating read and write capabilities, enforcing transaction boundaries, requiring approval where appropriate, making state-changing operations idempotent, and maintaining an auditable record of execution.
The strongest tool architecture is therefore not the one that gives an LLM the greatest number of capabilities.
It is the one that gives the model exactly the capabilities required to accomplish its task, under controls that prevent those capabilities from exceeding their intended authority.
That is the architectural foundation for safe action execution in an enterprise LLM system.
Agent Architecture
Everything discussed so far, reasoning strategy, prompt composition, structured output, and individual tool design, describes a system that fundamentally responds. It receives an input, performs a bounded set of operations, and produces an output.
Agentic systems introduce a different operating model.
An agent does not simply answer a request. It pursues a goal across multiple steps, observes the outcome of each step, evaluates what it has learned, and determines what to do next. The system therefore moves from single-pass inference to goal-directed execution.
A simplified agent loop looks like this:
GOAL
↓
PLAN
↓
SELECT TOOL
↓
EXECUTE
↓
OBSERVE
↓
EVALUATE
↓
CONTINUE / STOP
The loop is deceptively simple.
In production, every arrow represents a potential decision boundary, and every decision boundary introduces another opportunity for failure, unintended behavior, or uncontrolled authority. The architectural challenge is therefore not simply to make the loop work. It is to make the loop bounded, observable, recoverable, and governable.
The critical shift is this:
An agent is not defined by its ability to call tools. It is defined by its ability to make and execute decisions across multiple steps toward a goal.
That distinction matters because the system now has temporal behavior. A single incorrect response may be wrong once. An incorrect decision inside an agent loop can influence the next observation, the next plan, the next action, and every subsequent decision.
The Agent Loop as a Control Structure
An agent loop should therefore be treated as an architectural control structure, not simply as an LLM orchestration pattern.
Each iteration typically contains several distinct responsibilities:
Goal
↓
Planning
↓
Action Selection
↓
Authorization
↓
Execution
↓
Observation
↓
State Update
↓
Evaluation
↓
Continue / Stop / Escalate
The addition of authorization, state, and explicit control decisions is significant.
The model may propose the next action, but the application should determine whether that action is permitted. The execution layer should perform the action. The resulting observation should be recorded as state or evidence. The control layer should then determine whether the agent continues, terminates, retries, or escalates.
This creates an important architectural separation:
The model decides what it might do. The system decides what it may do.
That separation becomes increasingly important as the number of iterations, tools, data sources, and external side effects increases.
The Questions That Actually Matter
Once a system operates this loop, the architectural conversation changes.
The question is no longer only whether the model can produce a good answer. The question becomes whether the complete system can pursue a goal across multiple autonomous cycles while remaining within explicitly defined boundaries.
Seven questions become fundamental.
Autonomy. How much can the agent do without human approval?
Autonomy is not a binary property. It exists on a spectrum. A system might independently retrieve information and generate recommendations while requiring approval before modifying enterprise records or communicating externally.
The appropriate level of autonomy should be determined by the consequence, reversibility, risk, and authorization requirements of the action, not by how confident the model appears.
Delegation. Can the agent delegate work to other agents, workflows, processes, or tools?
Delegation introduces another layer of control. Once responsibility passes from one component to another, the architecture must preserve the identity of the initiating agent, the delegated objective, the permissions granted, the actions performed, and the resulting outcomes.
Otherwise, responsibility becomes progressively opaque as the execution chain grows.
Authority. What is the agent actually authorized to do?
Authority must be defined across the entire agent runtime, not only within individual tools. An agent with access to ten individually constrained tools can still create excessive risk through the combination of those capabilities.
Least privilege therefore applies to the agent's effective capability, not merely to the permissions of each tool in isolation.
Boundaries. What must the agent never do?
These are hard constraints, not preferences. They should remain outside the model's discretion regardless of how the goal is expressed, how the plan evolves, or what intermediate observations suggest.
Examples might include:
Never expose confidential information
Never modify financial records without approval
Never exceed a defined transaction limit
Never call an external system outside the approved scope
Never bypass a required human approval
The important architectural principle is that critical boundaries should be enforced by the application and its control mechanisms, not merely described in the prompt.
Termination. When does the loop stop?
A production agent requires explicit termination conditions. These may include successful completion, maximum iteration count, token or cost budget, elapsed-time limit, repeated failure, policy violation, insufficient evidence, or inability to make meaningful progress.
An agent without a defined stopping policy does not become more capable by continuing indefinitely. It accumulates latency, cost, state, and opportunities for failure.
Recovery. What happens when something goes wrong?
Tool failures, timeouts, malformed responses, authorization failures, stale information, partial execution, and downstream service failures are normal operating conditions in distributed systems.
An agent therefore needs defined recovery semantics.
Depending on the failure, the system may retry, select an alternative tool, revise the plan, compensate for a partial transaction, revert to a safe state, escalate to a human, or terminate execution.
The important point is that recovery should be an architectural behavior, not an improvisation delegated to the model.
Escalation. When does control return to a human?
Human-in-the-loop should not be treated as a generic safety button added after the agent is built. Escalation should be part of the control model.
Triggers may include high-risk actions, insufficient confidence, conflicting evidence, policy exceptions, ambiguous intent, repeated failures, exceeded budgets, or actions with irreversible consequences.
The architecture should define not only when escalation occurs, but also what information is presented to the human so that the human can make an informed decision.
From Tool Calling to Goal-Oriented Execution
There is an important distinction between a system that can call tools and an agent that can pursue a goal.
A tool-enabled application may follow a predetermined workflow:
Receive Request
↓
Call Tool A
↓
Call Tool B
↓
Generate Response
An agent may instead determine the sequence dynamically:
Receive Goal
↓
Determine What Is Needed
↓
Select Action
↓
Observe Result
↓
Reassess
↓
Select Next Action
↓
...
The second architecture introduces a new source of variability: the execution path itself becomes partially dynamic.
That has consequences for testing, observability, security, cost management, and incident analysis. Traditional request-response testing is no longer sufficient because the same goal may produce different execution paths depending on retrieved information, tool outcomes, model decisions, and intermediate state.
Agent evaluation therefore needs to consider not only the final answer, but also the path taken to reach it.
Agent State Is Part of the Control Model
An agent operating across multiple steps needs state.
At minimum, the system may need to retain:
- Current goal
- Current plan
- Completed actions
- Tool results
- Intermediate findings
- Decisions already made
- Errors and retries
- Authorization context
- Remaining budget
- Escalation status
- Termination conditions
This state should not automatically be treated as model memory.
There is an architectural distinction between state required by the runtime and information supplied to the model for reasoning. The runtime may maintain authoritative execution state while selectively exposing relevant portions of that state to the model.
That separation prevents the model from becoming the sole source of truth about what the system has actually done.
Observability Must Follow the Loop
Agent observability must capture more than request and response.
For meaningful production diagnosis, the system should be able to reconstruct the execution trajectory:
Goal
↓
Plan
↓
Decision
↓
Tool Selection
↓
Authorization
↓
Execution
↓
Observation
↓
State Change
↓
Evaluation
↓
Next Decision
This creates an execution trace rather than merely a model trace.
The trace should make it possible to determine what the agent attempted, what information it had available, which tools it invoked, what permissions were applied, what each tool returned, what state changed, why execution continued, and why the system eventually stopped or escalated.
Without this level of observability, an agent can be operationally active while remaining architecturally opaque.
Why This Distinction Matters
When these questions are answered deliberately and encoded into the architecture, something fundamental changes about the system being built.
This is where an LLM application becomes an AI control system rather than merely an inference application.
An inference application primarily transforms input into output.
A control system governs behavior over time. It operates within defined authority, maintains state, evaluates intermediate outcomes, handles failure, enforces boundaries, and determines whether execution should continue, stop, or return control to a human.
The difference is not simply that one system performs more steps.
The difference is that the system now has responsibility for managing its own execution path under architectural constraints.
That is why agentic architecture cannot be reduced to prompting, tool calling, or adding a loop around an LLM. The loop is only the visible mechanism. The real architecture lies in the controls surrounding it.
A production agent should therefore be understood as:
Goal
+
Planning
+
Reasoning
+
Tools
+
State
+
Authorization
+
Policy
+
Evaluation
+
Recovery
+
Termination
+
Human Escalation
+
Observability
The objective is not maximum autonomy.
The objective is bounded autonomy: enough freedom for the system to accomplish the intended goal, combined with enough control to ensure that its behavior remains within the authority, risk, cost, and reliability boundaries defined by the architecture.
Enterprises that treat agentic architecture as an extension of prompting will eventually encounter a critical gap between what the model was instructed to do and what the system was actually capable of doing.
That gap is where production incidents begin.
The architectural task is to eliminate that gap before the agent reaches production.
State and Memory Architecture
"Memory" is one of the most casually used words in enterprise LLM architecture, and that casualness creates architectural risk.
Teams often say, "the system needs memory," as though memory were a single capability that can be added by connecting a database or enabling a persistence layer. It is not.
An enterprise LLM application does not have one kind of memory. It has multiple forms of state and persistence, each with a different purpose, lifecycle, authority, security model, and retention requirement.
At a minimum, the architecture should distinguish:
Conversation State
+
User State
+
Application State
+
Workflow State
+
Agent State
+
Long-Term Knowledge
These categories may be implemented using different technologies, or in some cases share infrastructure. They should not, however, be treated as the same architectural concept.
That distinction matters because the question is not simply:
What should the system remember?
The more important questions are:
What information must exist, for what purpose, for how long, under whose authority, and with what lifecycle?
If these categories are collapsed into a single undifferentiated "memory store," predictable problems follow. Information that should have expired at the end of a session persists indefinitely. Information that should survive across sessions disappears when the conversation ends. Temporary workflow state becomes indistinguishable from durable business data. Agent execution state becomes confused with user memory. And enterprise knowledge begins to look like application data that the application is free to modify.
The result is not simply poor memory design. It is loss of control over the information lifecycle.
State and Memory Are Not the Same Thing
A useful architectural distinction is to separate state from memory.
State represents what the system needs to know about an interaction, task, workflow, or execution now.
Memory represents information deliberately retained because it may be useful later.
This distinction can be expressed simply:
State = What is true about the current execution?
Memory = What is intentionally retained beyond the current execution?
The distinction is not absolute. Some state may be persisted for recovery. Some memory may be loaded into active state during execution. The architectural responsibility is to make the transition explicit rather than allowing persistence to happen simply because the application happened to store something.
This is particularly important for agentic systems. An agent may maintain a plan, intermediate results, tool outcomes, retry counts, authorization context, and execution status. That information is necessary for the agent to continue operating, but it does not automatically become something the system should remember about the user.
The Categories, Distinguished
Conversation State
Conversation state represents the immediate interaction context.
It includes the messages, references, decisions, clarifications, and other information required to maintain coherence within the current conversation or session.
Its defining characteristic is interaction scope.
Conversation state should not automatically become persistent user memory. A statement made during one conversation may be relevant only to that conversation and may have no legitimate reason to influence future interactions.
The architectural question is therefore not simply how to retain conversation history. It is how to determine what portion of that history should remain active, what can be summarized or compressed, and what, if anything, is permitted to cross the session boundary.
User State
User state represents information associated with the user that legitimately persists across interactions.
Examples may include explicitly established preferences, user-configured settings, recurring choices, or other durable attributes that the application is authorized to retain.
Its defining characteristic is user scope.
User state requires clear ownership, provenance, update semantics, and access control. The system should know not only what it believes about the user, but why that information exists, when it was established, and how it can be corrected or removed.
A model inference about a user should not automatically become durable user state.
Application State
Application state represents information required by the application to operate correctly.
It may include configuration, session-independent application conditions, business process status, feature state, or other information required by the application runtime.
Its defining characteristic is application scope.
Application state should be governed by application semantics rather than model behavior. An LLM may consume application state as context, but it should not become the authority that determines whether that state is valid or may be changed.
Workflow State
Workflow state represents the current position and accumulated results of a business process.
For example:
Request Received
↓
Eligibility Verified
↓
Documents Requested
↓
Documents Validated
↓
Approval Pending
↓
Completed
The workflow engine must know which stage has been completed, which actions remain, what information has been collected, what failed, and whether the process is waiting for a human or an external system.
Its defining characteristic is process scope.
Workflow state should remain authoritative within the workflow architecture. An LLM may recommend the next transition, but the workflow engine should determine whether that transition is valid.
Agent State
Agent state represents the information required to manage an agent's ongoing execution.
It may include:
- Current goal
- Current plan
- Completed actions
- Tool results
- Intermediate findings
- Execution status
- Retry history
- Remaining budget
- Authorization context
- Escalation status
- Termination conditions
Its defining characteristic is execution scope.
Agent state is particularly important because an agent operates over time. The model may need selected portions of this state to determine its next action, but the model should not become the authoritative store for what actually happened.
The runtime should remain authoritative.
This creates an important boundary:
Runtime State
↓
Select Relevant Context
↓
Model
↓
Proposed Decision
↓
Runtime Validation
↓
State Transition
The model reasons over state. It does not own the truth of state.
Long-Term Knowledge
Long-term knowledge represents information intentionally retained beyond a particular interaction or execution because it has continuing value.
This may include durable user information, historical application information, learned organizational context, or other knowledge that the system is explicitly permitted to retain.
Its defining characteristic is persistence beyond an individual execution.
Long-term knowledge requires stronger lifecycle management than temporary context. The architecture must address provenance, freshness, update mechanisms, retention, access control, correction, and deletion.
Persistence alone does not make information trustworthy.
Enterprise Knowledge Is Different
Enterprise knowledge deserves separate treatment because it is not simply another form of application memory.
Enterprise knowledge represents authoritative organizational information such as:
- Policies
- Product information
- Pricing
- Compliance requirements
- Operating procedures
- Organizational rules
- Technical standards
- Approved business definitions
Its defining characteristic is organizational authority.
The critical distinction is that enterprise knowledge is generally something the application consumes, not something a conversation or agent is permitted to redefine.
This creates a fundamental separation:
User Memory
≠
Application State
≠
Agent State
≠
Enterprise Knowledge
A user saying, "Our refund policy is now 90 days," does not change the organization's refund policy.
An agent discovering a new fact does not automatically make that fact enterprise knowledge.
A conversation containing an assumption does not become authoritative organizational data simply because it has been persisted.
The architecture must preserve these distinctions.
The Lifecycle Questions
Each category carries a different answer to a common set of architectural questions.
Retention. How long must the information exist?
A workflow value that survives indefinitely may become unnecessary retained data. A durable user preference that disappears when the session ends represents a product failure.
Security. Who or what is permitted to access it?
Conversation history, user information, agent execution state, and enterprise policy data may require entirely different access models.
Ownership. Who is accountable for its accuracy and lifecycle?
The application team may own application state. A business function may own policy information. A workflow engine may own process state. A user may control certain categories of personal information.
Consistency. What level of consistency is required?
Some execution state must be immediately consistent because an incorrect transition could corrupt a workflow. Some conversational context can tolerate eventual persistence or summarization.
Update. How may the information change?
A user changing a preference, an agent updating workflow state, and a compliance function revising a policy are fundamentally different update operations. They should not share an implicit write path.
Provenance. Where did the information come from?
This becomes particularly important when LLM-generated information enters persistent storage. The architecture should distinguish user-provided facts, system-generated state, retrieved enterprise knowledge, tool results, model inferences, and human-approved information.
Freshness. How current must the information be?
A product price, regulatory requirement, inventory position, and historical conversation may have very different freshness requirements. Persistence without freshness semantics can create a false sense of reliability.
Deletion. How is the information removed?
Deletion must be an explicit lifecycle operation, including propagation to dependent stores where applicable. "We delete it eventually" is not a lifecycle policy that survives serious operational, contractual, or regulatory requirements.
Access Control. At what granularity is access restricted?
Authorization may need to operate at the tenant, user, role, record, attribute, document, or field level. The control should be enforced at the appropriate data boundary rather than assumed to exist because an application component is expected to behave correctly.
Memory Is an Architectural Contract
The deeper principle is that memory should not be designed as a storage feature.
It should be designed as a contract between information, purpose, authority, and lifecycle.
For every persisted piece of information, the architecture should be able to answer:
What is it?
Why does it exist?
Who owns it?
Who can access it?
Who can change it?
How long should it exist?
How current must it be?
Where did it come from?
How is it validated?
How is it deleted?
These questions transform "memory" from an ambiguous AI capability into an explicit architectural concern.
The distinction becomes even more important as enterprise LLM applications become agentic. A system that can reason, act, maintain state, and operate across multiple executions cannot afford an undifferentiated memory layer.
The architecture must know the difference between what the system is doing, what the user has told it, what the application currently knows, what the workflow has completed, what the agent has observed, and what the enterprise has declared to be true.
That is the foundation of trustworthy persistence in an LLM application.
Do not ask whether the system has memory. Ask what it remembers, why it remembers it, who controls it, and when it must forget.
Human-in-the-Loop Architecture
There is a persistent assumption in AI programs that human involvement is temporary. The system begins with humans reviewing every decision, gradually gains confidence, and eventually reaches a state where the human can be removed.
That is not a mature enterprise architecture model.
Human involvement is not necessarily a transitional phase on the way to autonomy. In many systems, it is a deliberate and permanent control boundary.
The architectural question is therefore not:
How do we remove the human from the loop?
It is:
Where should human judgment remain part of the system, and where should the system be trusted to act without it?
A production LLM application should make that decision explicitly.

These are not maturity levels. They are distinct operating modes.
A mature system does not attempt to maximize autonomous execution. It assigns each action to the operating mode appropriate to its consequence, reversibility, uncertainty, regulatory context, and business impact.
Four Operating Modes
Autonomous
The system executes the action without human intervention.
This mode is appropriate when the action is sufficiently low risk, bounded in scope, reversible where practical, and supported by demonstrated system reliability.
Technical capability alone is not sufficient justification for autonomy.
The fact that an LLM can perform an action does not mean the architecture should allow it to perform that action autonomously.
Human Approval
The system prepares or proposes an action, but execution requires explicit human authorization.
AI Proposes
↓
Human Reviews
↓
Approve / Reject
↓
Execute
This pattern is appropriate when the system can perform the analysis or preparation but the consequence of execution warrants an explicit authorization boundary.
The approval should be meaningful. The human should have enough context, evidence, and explanation to understand what is being approved, why the action was proposed, and what the consequences will be.
A simple "Approve" button without meaningful decision context is not a strong human-control mechanism.
Human Review
The system executes the action, but the resulting decision or output is subsequently reviewed by a person.
This pattern is fundamentally different from human approval.
Approval is a pre-execution control.
Review is a post-execution control.
Human review can support quality assurance, compliance sampling, operational monitoring, and detection of systematic failure patterns. It is particularly useful where individual actions are low enough risk to execute automatically but the aggregate behavior still requires oversight.
Review should therefore feed back into evaluation and system improvement rather than exist as a passive audit activity.
Human Decision
The system does not execute the consequential action.
Instead, it provides analysis, evidence, recommendations, or decision support, while the human remains the decision authority.
This mode is appropriate when the decision involves significant judgment, material consequences, ambiguity, or a level of accountability that the organization has deliberately retained with a human decision-maker.
The AI can inform the decision without owning it.
Human Control Is an Architectural Boundary
Once human involvement is treated as an architectural control rather than a user-interface feature, several additional questions emerge.
The system must know:
- What triggers human involvement?
- Who is authorized to approve or decide?
- What information must be presented?
- What evidence supports the proposed action?
- What happens if the human rejects it?
- What happens if the human does not respond?
- Can the action expire while awaiting approval?
- Can another person approve it?
- Is the human decision recorded?
- Can the action be safely resumed afterward?
These questions become especially important in agentic systems.
An agent may formulate a plan and reach a point at which human intervention is required. The system must preserve the relevant execution state, suspend further action, present the decision context to the authorized human, capture the decision, and resume or terminate the workflow according to that decision.
Human-in-the-loop therefore requires more than a screen placed in front of an LLM.
It requires a controlled state transition.
Agent Execution
↓
Control Boundary Detected
↓
Execution Suspended
↓
Evidence + Proposed Action
↓
Authorized Human
↓
Approve / Reject / Modify
↓
State Transition
↓
Resume / Compensate / Terminate
Setting the Threshold
The critical architectural decision is determining which actions require which level of human control.
That threshold should not be determined by convenience, by the apparent confidence of the model, or by the desire to demonstrate maximum autonomy.
It should be established through explicit risk criteria.
Risk
What is the realistic consequence if the action is wrong?
The assessment should consider both the severity of the outcome and the likelihood of occurrence based on observed system performance.
Confidence
How reliable is the system's estimate of its own uncertainty?
Model confidence should not be treated as an objective measure of correctness. Where confidence is used as a control signal, it should be calibrated against empirical evaluation data.
Financial Impact
What is the potential financial exposure?
This includes both the direct transaction value and downstream effects such as remediation cost, customer compensation, operational disruption, or repeated errors at scale.
Regulatory and Contractual Requirements
Does law, regulation, policy, or contractual obligation require human involvement?
Where such requirements exist, the architecture must enforce them independently of the model's confidence or apparent capability.
Reversibility
Can the action be undone?
Reversibility should be assessed in practical terms. An action may technically be reversible while still imposing material cost, delay, customer disruption, or reputational consequences.
Customer Impact
Does the action directly affect a customer?
Actions involving customer access, financial consequences, commitments, sensitive information, or material service decisions may warrant stronger controls than equivalent internal actions.
Control Thresholds Should Be Action-Specific
One of the common mistakes in human-in-the-loop design is assigning a single autonomy policy to an entire application.
An application may contain dozens of actions with radically different risk profiles.
For example:
Retrieve Account Information → Autonomous
Generate Customer Summary → Autonomous
Recommend Resolution → Human Review
Issue Customer Credit → Human Approval
Change Contractual Terms → Human Decision
Terminate Customer Relationship → Human Decision
The important point is not the particular classification of these examples. It is the principle behind them.
Human control should be assigned to the action, not merely to the application.
This becomes even more important when an agent has access to multiple tools. The same agent may be permitted to retrieve information autonomously while requiring explicit approval before performing an external write operation.
The Human Must Remain an Informed Control Point
Human involvement does not automatically make a system safer.
A human who receives an opaque recommendation, incomplete evidence, excessive information, or an artificially compressed explanation may simply become a rubber stamp.
Effective human control therefore requires decision quality, not merely human presence.
The human should receive enough information to understand:
What is being proposed?
Why was it proposed?
What evidence supports it?
What uncertainty remains?
What will happen if approved?
What are the material consequences?
The system should also distinguish between evidence retrieved from authoritative sources, information supplied by the user, model-generated inferences, and actions already performed.
This preserves the human's ability to exercise actual judgment rather than merely ratify the model's recommendation.
Escalation Is Part of the Architecture
Escalation should not be treated as an exception path added after the primary workflow is designed.
It is part of the normal control model.
An agent may need to escalate because:
- Risk exceeds a defined threshold
- Evidence is contradictory
- Required information is unavailable
- The system detects ambiguity
- A policy boundary has been reached
- A transaction exceeds an authorized limit
- Repeated retries have failed
- The action is irreversible
- A regulatory requirement requires human involvement
- The system cannot establish sufficient confidence
The architecture should define what happens next.

This turns escalation from a vague safety mechanism into a defined architectural behavior.
The Governing Principle
Across these operating modes, one principle provides the most useful calibration:
The less reversible and more consequential the action, the stronger the human control should be.
This principle is more durable than any fixed rule about which AI capabilities should or should not be autonomous.
A low-risk action that can be cleanly reversed may reasonably operate autonomously.
An action that changes financial position, creates a contractual obligation, exposes sensitive information, materially affects a customer, or produces an irreversible outcome may require explicit human control.
The architecture should therefore optimize not for maximum autonomy, but for appropriate autonomy.
The objective is not to keep humans involved everywhere. Nor is it to remove them wherever technically possible.
The objective is to place human judgment precisely where the consequences of automated judgment justify it.
That is the role of human-in-the-loop architecture in an enterprise LLM application: not a temporary safety net, but an explicit mechanism for allocating authority, accountability, and decision rights between humans and machines.
Model Architecture
Only after reasoning strategy, prompt architecture, output contracts, tools, agentic execution, state, memory, and human oversight have been defined should the architecture make its model decision.
That ordering is deliberate.
The model is an implementation component of the application architecture. It should satisfy the requirements established by the system, not define those requirements by virtue of what a particular model happens to support.
Teams that select a model first often end up designing the application around the model's capabilities, context limits, APIs, and interaction patterns. The architecture gradually becomes an extension of the model provider's platform.
A more disciplined approach works in the opposite direction:
Business Intent
↓
Intelligence Contract
↓
Application Pattern
↓
Context + Reasoning + Action
↓
Runtime Requirements
↓
Model Selection
↓
Model Routing
The model is selected because it satisfies the requirements of the architecture.
And that leads to a second important shift.
Do not think primarily in terms of the model.
Think in terms of a model portfolio.
Enterprise applications rarely have one model that is optimal for every workload. Different tasks have different requirements for capability, latency, context, reasoning, cost, modality, availability, and operational risk.
A representative architecture might look like this:
Model Gateway
│
┌───────────────┼───────────────┐
↓ ↓ ↓
Small Model General Model Reasoning Model
│ │ │
Classification Generation Complex Reasoning
Extraction Summarization Planning
Routing Transformation Multi-step Analysis
The model gateway becomes the architectural boundary between the application and the underlying model providers.
That boundary is important because it allows model selection to evolve without forcing every application component to understand provider-specific endpoints, credentials, request formats, model identifiers, or operational policies.
Model Selection Is a Task-Level Decision
A small model handling classification is not a compromise.
It is often the correct architectural choice.
If a task can reliably be completed by a smaller, faster, less expensive model, using a frontier model adds cost and latency without necessarily adding meaningful business value.
Conversely, routing a genuinely complex reasoning problem to a model that cannot meet the required quality threshold simply because it is cheaper can create downstream costs through retries, human intervention, incorrect actions, and operational remediation.
The objective is therefore not to minimize model cost or maximize model capability in isolation.
It is to achieve the required quality at the required cost, latency, reliability, and risk level.
This is a task-level decision.
The Selection Criteria
Model selection should be based on a consistent set of architectural criteria rather than the model's reputation, benchmark position, or release date.
Capability
Can the model reliably perform the specific task at the required quality level?
General model capability is not enough. A model may be strong at generation but unsuitable for structured extraction, tool calling, multilingual processing, or a particular reasoning workload.
Capability must therefore be evaluated against the actual workload.
Latency
How quickly must the result be available?
Interactive applications, synchronous APIs, agent loops, and background batch processes impose very different latency requirements.
Latency should also be evaluated at the application level. A model that appears fast in isolation may become slow when combined with retrieval, multiple reasoning steps, tool calls, and validation.
Context Capacity
Can the model accommodate the actual context required by the application?
This includes system instructions, retrieved information, conversation history, tool results, intermediate state, and output requirements.
The relevant question is not simply whether the model advertises a large context window. It is whether the model can reliably operate within the application's required context envelope without creating unacceptable latency or cost.
Structured Output
Can the model reliably produce the schemas required by downstream systems?
If an application depends on structured output for routing, persistence, workflow transitions, or tool invocation, schema support and empirical adherence matter.
The model should not become a recurring source of structural failure that the application must continuously repair.
Tool Calling
Can the model reliably generate valid tool calls when the application requires external action?
Tool support should be evaluated not merely by whether an API exists, but by how reliably the model selects tools, constructs arguments, handles tool results, and operates within the application's authorization boundaries.
Reasoning Capability
Does the workload actually require advanced reasoning?
Not every task benefits from a reasoning-oriented model.
Classification, extraction, simple transformation, routing, and straightforward generation may not justify the additional latency and cost of a reasoning model.
The correct question is:
What level of reasoning does this task require to meet its quality and risk threshold?
Multimodality
Does the application need to process images, documents, audio, video, or other non-text modalities?
Multimodal capability should be selected because the workload requires it, not because the model happens to provide it.
Availability and Reliability
Can the model support the application's operational requirements?
This includes availability, rate limits, throughput, regional availability, service-level commitments where applicable, and behavior under degraded conditions.
A model that performs exceptionally well but cannot reliably serve production traffic is not a production-ready dependency.
Throughput
Can the model sustain expected traffic under realistic peak conditions?
Capacity must be considered against concurrency, request size, response size, agent iteration counts, retry behavior, and workload growth.
Average traffic is rarely the correct sizing point for an enterprise system.
Cost
What is the effective cost of completing the business task?
Per-token pricing alone is insufficient.
The architecture should consider:
Model Cost
+
Retrieval Cost
+
Reasoning Iterations
+
Tool Execution
+
Retries
+
Validation
+
Observability
+
Human Intervention
A cheaper model that requires additional calls or generates more failures may produce a higher total cost per successful task than a more capable model.
The relevant metric is therefore often cost per successful business outcome, not merely cost per model invocation.
Data Residency and Privacy
Where is data processed?
What data retention policies apply? Is customer data used for provider training? What controls exist for sensitive information? Which regions are available?
These are architecture and governance concerns, not procurement details to be addressed after implementation.
Vendor Dependency
How tightly does the application depend on a specific provider or model family?
A model choice creates an architectural dependency.
The architecture should therefore consider provider-specific APIs, proprietary features, model-specific prompt behavior, embeddings, tool formats, evaluation baselines, and migration effort.
Portability does not mean pretending every model is interchangeable. It means deliberately deciding where provider-specific behavior belongs and containing that dependency behind appropriate architectural boundaries.
Model Routing
Once multiple models exist in the architecture, model selection becomes a runtime decision.
This leads naturally to model routing.

The router determines which model is appropriate for the task.
A simple routing policy might distinguish:
Classification
Extraction
Simple Transformation
↓
Small Model
General Generation
Summarization
Standard Analysis
↓
General Model
Complex Reasoning
Planning
Multi-step Analysis
High-complexity Decisions
↓
Reasoning Model
The routing mechanism itself should remain simple where possible. Its purpose is not to solve the business problem. Its purpose is to classify the workload and select an appropriate execution path.
As the system matures, routing can incorporate additional signals:
Task Type
+
Complexity
+
Risk
+
Context Size
+
Latency Requirement
+
Cost Budget
+
Data Sensitivity
+
Model Availability
↓
Routing Decision
This makes model selection an explicit architectural policy rather than an implicit consequence of application code.
Model Routing Is an Economic Control
Model routing is not merely a performance optimization.
It is an economic control mechanism.
Consider an enterprise application processing one million requests. If every request is routed to the most capable model, the architecture effectively assumes that every task deserves the maximum available inference cost.
That assumption rarely survives production economics.
A better architecture reserves higher-cost inference for workloads that actually require it and uses smaller models for tasks that do not.
This creates a useful relationship:
Required Capability
↓
Minimum Sufficient Model
↓
Required Quality
↓
Acceptable Cost
↓
Production Scale
The principle is straightforward:
Use the least capable model that reliably satisfies the task's requirements.
"Least capable" does not mean "cheapest."
It means the minimum model capability that consistently satisfies the required quality, reasoning, latency, reliability, and risk thresholds.
Model Fallback and Resilience
Once the model becomes a runtime dependency, the architecture must also account for model failure.
What happens when the preferred model is unavailable?
A production model architecture may require:
Primary Model
↓
Failure / Capacity / Policy Constraint
↓
Fallback Model
↓
Reduced Capability Mode
↓
Human Escalation
Fallback should not be treated as a simple substitution.
A fallback model may have different reasoning capability, context capacity, structured-output behavior, tool-calling semantics, latency, or data-handling characteristics.
The architecture must therefore define which capabilities may degrade and which must not.
For example, a lower-capability model might be acceptable for summarization but unacceptable for a high-risk decision or an action requiring complex reasoning.
This creates an important distinction between availability resilience and capability equivalence.
A fallback model may keep the application available without being functionally equivalent to the primary model.