LLM Application Architecture: From Knowledge Retrieval to Workflow Orchestration
Choosing an LLM application architecture is less about which pattern is strongest and and more about matching knowledge retrieval, workflow orchestration, agents, and system integration to the job. This article explains how those capabilities differ, what makes retrieval trustworthy, how to isolate model uncertainty in automation, and how to evaluate, secure, and grow a system from a read-only loop to controlled execution.
1. Ask a better question: not which option is stronger, but which architecture fits
When teams design LLM applications, they often ask: “How do these two approaches differ?” “Can a knowledge Q&A system also automate business work?” “If we can orchestrate workflows, do we still need an agent?”
These questions look like feature comparisons, but they are really about different system responsibilities. Knowledge retrieval answers “how do we find trustworthy information.” Workflow orchestration answers “how do we execute work according to rules.” An agent answers “how do we choose the next action from a goal and the current environment.” An application framework is about “how we compose those capabilities into a service that can be maintained.”
If the business goal is unclear, choosing by interface polish or the number of components can look successful in a proof of concept and then fail after launch on access isolation, error recovery, knowledge updates, and operating cost.
A useful technical discussion therefore moves from product-to-product comparison toward matching general capabilities with business constraints. The object of selection should not be only an application-building environment. It should be the full path: data, models, execution, permissions, and operations.
2. Split requirements into four capabilities and avoid mixing concepts
2.1 Knowledge retrieval: give answers evidence that can be checked
The core job of knowledge retrieval is to find content relevant to a question inside an authorized data scope and turn it into context the model can use.
A typical path is:
document ingestion → content parsing → chunking → index building → query retrieval → result filtering → answer generation.
Retrieval-augmented generation does not make the model permanently memorize enterprise material. It supplies external evidence at answer time. It fits policy lookup, operating-manual Q&A, and internal knowledge search, but it does not automatically guarantee a correct answer.
For example, an operating procedure may contain both an old version and a new version. If the index does not keep version information, the system may retrieve a semantically related clause that is no longer in effect. The problem is not weak model wording. It is a gap in knowledge governance.
A knowledge system therefore needs at least source identifiers, version management, update time, access control, and citation location. An answer that points to the original passage is usually more valuable to the business than fluent language.
2.2 Workflow orchestration: make deterministic steps run reliably
Workflow orchestration organizes tasks with clear inputs, outputs, and execution conditions. For example:
receive a request → validate fields → look up business records → check whether rules are met → draft a disposition → enter approval.
This fits work whose steps are relatively stable, whose results must be auditable, and whose exception paths can be designed in advance. A model can take part, but it should not replace every rule.
Text classification can be given to the model. Amount calculation, identity checks, and state changes should stay in deterministic logic. That uses the model’s ability to understand natural language without hiding critical business rules inside a prompt.
The value of orchestration is not only “connecting nodes.” It also includes timeouts, state recording, retry policy, failure branches, and human handoff. Without those, a visual flow can still be a hard-to-maintain collection of scripts.
2.3 Agents: handle tasks whose path cannot be fully preset
An agent usually loops around a goal: observe current information, decide the next action, call an external capability, then adjust based on the result.
It fits exploratory work, such as investigating a problem across several sources or filling in material from clues already found. That flexibility also means the execution path, the number of calls, and result quality are harder to know in advance.
An agent is therefore not inherently better than a fixed workflow. For stable, repeated, rule-clear work, a deterministic flow is often easier to test and audit. For tasks whose path varies, an agent can be confined to one controlled step instead of taking over the whole system.
When an action writes, sends, deletes, or approves, set an explicit authorization boundary. A model suggesting an operation does not mean the system has permission to perform it.
2.4 System integration: beyond connecting capabilities, handle the contract
Integration is not only calling a business API. It also includes passing identity, validating inputs, checking permissions, interpreting return values, and recovering from failure.
The same “query order” request can mean different fields, statuses, and value domains in different systems. Without a stable data contract, a model may treat “accepted” as “completed,” or treat a missing field as a normal result.
A reliable integration layer should hide those system differences and expose a small set of clear, limited, checkable capabilities. An interface description should not only say what it can do. It should also state preconditions, input constraints, likely failure reasons, and whether it has side effects.
3. Knowledge Q&A quality starts with the data path
3.1 Parsing should keep semantic structure
Turning a document into plain text does not mean parsing succeeded. Tables, heading hierarchy, footnotes, and relationships across pages can all change meaning.
A number in a table must stay tied to its row and column headers. If only the digits remain, a hit may contain the keyword and still fail to support a correct answer. For structurally complex material, sample the parsed output. Do not only count how many documents were imported.
3.2 Chunking should be designed around completeness of information
Chunks that are too short lose definitions, conditions, and exceptions. Chunks that are too long pull in unrelated content and consume more context.
Do not split only by character count. Operating steps, complete clauses, and table explanations should usually stay semantically continuous. When needed, keep the link between a chunk and its section, and add neighboring content after a hit.
Expanding context has a cost: the more you add, the more likely the model is distracted by irrelevant text. Validate with real questions. Do not treat chunk length as a universal parameter.
3.3 Retrieval should combine semantic and exact match
Semantic retrieval handles similar intent expressed in different words. Keyword retrieval is often more direct for IDs, proper terms, and exact fields.
When source types are mixed, the two result sets can be combined and then filtered for relevance. Combining them does not automatically improve every question and can add noise. Measure the gain on samples.
For conditions such as version, date, department, and document type, prefer explicit metadata filters over semantic similarity alone.
3.4 The answer policy must include “I don’t know”
If no evidence is retrieved, the system should not fill internal facts from general knowledge. Appropriate behavior includes saying the evidence is insufficient, asking for more conditions, or routing to a person.
When retrieved results conflict, do not silently pick one. Show the conflicting sources and effective dates, and let a rule or the user confirm.
A trustworthy Q&A system does not aim to answer every time. It answers when there is evidence and holds the boundary when there is not.
4. Isolate model uncertainty in business automation
4.1 Connect the model to business logic with structured results
Natural language is suitable for user interaction and unsuitable for driving critical operations directly. Before model output enters a business system, convert it to constrained structured data and check types, ranges, and required fields.
The following is an illustrative flow, not a concrete system API:
User input↓Identify intent and extract candidate fields↓Check whether fields are complete and formats are valid├─ Incomplete: ask the user to supply missing fields└─ Complete: enter the permission check↓Run a read-only query↓Produce a recommended action↓If a write is involved, request confirmation↓Execute and record audit information
The split is: the model understands, rules constrain, and the business system executes.
4.2 Before retrying, decide whether the operation is safe
A network timeout does not always mean the action failed. A write may already have succeeded and only the response was lost. Retrying immediately can create duplicate records or send duplicate notifications.
Operations with side effects should be idempotent, or their status should be queried before a retry. Limit retry count, and distinguish transient faults from business rejections. The former may be retried later. The latter usually needs corrected input or a person.
4.3 Long-running tasks need explicit state
A task across several steps can last a long time. If all state lives only in the conversation, an interruption is hard to resume.
A safer approach stores a task identifier, the current stage, completed actions, items awaiting confirmation, and the error reason. Conversation history can support interaction, but it should not be the only source of business state.
5. Evaluate options against real tasks
5.1 Write the constraint list before the feature list
A team can start with questions such as:
- May data leave a designated environment?
- Do users and departments need strict isolation?
- Does the application mainly answer read-only questions, or will it change business data?
- After a document changes, how soon must answers reflect it?
- Must every run be traceable?
- How much custom development and day-to-day maintenance can the team carry?
Those answers set architectural boundaries. An easy interface can lower early build cost. It does not replace requirements for permissions, security, and operations.
5.2 Prove the concept with representative tasks
Samples should include common cases, hard cases, and failure cases, not only cases that demo well.
Knowledge Q&A samples can cover exact lookup, explanation across passages, version conflicts, questions with no answer, and permission-restricted questions. Workflow samples should cover the happy path, missing fields, API timeouts, duplicate submission, and user withdrawal.
Define the expected behavior for each sample in advance. When there is no single correct answer, still define criteria, such as whether valid evidence is cited, whether a key condition is missed, and whether an action exceeds authority.
5.3 Score in layers, not only the final reply
Observe the system at three layers:
Retrieval: Did it find the right evidence, and did expired or unauthorized content get mixed in?
Generation: Is the answer supported by evidence, are limits stated accurately, and are there unsupported inferences?
Execution: Was the right action chosen, were approval boundaries followed, and can the system recover from exceptions?
Also record end-to-end latency, call volume, resource use per task, and human intervention. Averages do not describe real experience. Look at the distribution of slow requests and high-cost tasks.
6. Security and operations belong in the architecture
6.1 Access control cannot depend on the prompt
Telling the model “do not answer unauthorized content” is not reliable access control. Permissions should be enforced by the system at query time and at action time.
Knowledge permissions should run through indexing and retrieval so unauthorized text never enters model context. Caches should also account for user identity, permission scope, and document version, so one user’s result is not reused where it should not be shared.
6.2 External content is untrusted input
Documents, web pages, and API responses can contain text that tries to change model behavior. The system must separate business data from execution instructions. A passage that asks for a sensitive capability must not be given higher privilege because of that request.
For high-risk operations, use least privilege, an allowlist of scope, and human confirmation. Output filtering can supplement those controls. It cannot replace a security boundary at execution time.
6.3 Logs should support debugging and protect sensitive data
To diagnose issues, record task stage, retrieval sources, action results, and error types. Do not store full business documents, access credentials, or personal sensitive data by default.
Define retention, who can read logs, and redaction rules. Observability is not “log as much as possible.” It is a balance between enough detail to debug and minimizing data.
7. Start with a minimal closed loop, then widen the boundary
A steady rollout usually has three stages.
In the first stage, build a read-only loop. Choose a knowledge scope with a clear boundary and validate parsing, retrieval, citation, and refusal. Confirm information quality before adding complex actions.
In the second stage, add controlled workflows. Connect a small number of stable business capabilities. Prefer query and recommendation first, then introduce writes that require confirmation. For each new action, add permission checks, failure handling, and audit records.
In the third stage, handle limited uncertainty. Introduce an agent for local decisions only when a fixed workflow cannot cover real demand, and limit its action scope, execution budget, and stop conditions.
A good architecture is not the one with the most components. It assigns each capability a fitting job: retrieval supplies evidence, the model understands and expresses, workflows organize execution, rules hold the boundary, and operations keep the system running. Built that way, an LLM application can move from a demo feature to a business system that is trustworthy and maintainable.
