A production LLM feature is a probabilistic component inside a conventional software system. The model call may be central, but identity, policy, data, tools, state, evaluation, and operations determine whether the feature is dependable.
Reference architecture
run:
maxSteps: 4
maxInputTokens: 12000
deadlineMs: 10000
requireToolAuthorization: trueThese limits keep orchestration bounded and make tool authorization a mandatory application control rather than a model suggestion.
client -> API/policy -> orchestrator -> model gateway -> model | | | | +-> tools +-> quotas/fallback +-> retrieval -> governed indexes +-> trace/evaluation pipeline
The API authenticates and applies product limits. The orchestrator owns a bounded state machine. The gateway normalizes provider contracts, timeouts, version selection, and usage. Retrieval and tools remain separate trust boundaries.
| Layer | Primary contract | Main risk |
|---|---|---|
| API | User intent and authorization | Cross-tenant access |
| Orchestrator | State and budgets | Runaway execution |
| Model gateway | Provider request/response | Drift and outage |
| Retrieval | Evidence with provenance | Poisoning or leakage |
| Tool adapter | Typed, authorized effect | Excessive agency |
Typed orchestration
state = { requestId, subject, objective, remainingSteps: 4, remainingTokens: 12000, deadline, evidence: [] } while state.remainingSteps > 0 and now() < state.deadline: proposal = model.propose(state) validated = schema.parse(proposal) result = executeAuthorized(validated, state.subject) state = transition(state, result)
The loop is owned by application code. Budgets and schemas are deterministic guardrails. A model proposal is untrusted input until policy and tool adapters validate it.
tool: name: create_refund inputSchema: RefundRequestV3 sideEffect: irreversible authorization: "subject may refund order" approval: requiredAboveAmount: 250 idempotencyKey: requestId
This configuration makes effect, policy, approval, and retry behavior reviewable. Never give a model raw database or cloud credentials.
Model gateway
result = await gateway.generate({ modelPolicy: "support-balanced-v5", promptVersion: "support-answer-19", timeoutMs: 8000, maxOutputTokens: 700, responseSchema: SupportAnswer })
The policy name decouples product code from one provider identifier. Log versions, timing, token usage, finish reason, and request correlation—not private prompt content by default.
Failure architecture
Classify failures: invalid input, policy denial, retrieval insufficiency, model timeout, malformed output, tool rejection, and internal error. Retries require a deadline and idempotency. A fallback model may differ in safety, context, schema support, and data terms; evaluate it as a separate release.
Readiness checklist
- Every external effect passes deterministic authorization.
- Prompt, model, policy, schema, retrieval, and tool versions are traceable.
- Token, iteration, latency, concurrency, and cost budgets are enforced.
- Private content has defined provider and telemetry handling.
- Offline evaluations and production indicators gate promotion.
- The system has a useful non-LLM or bounded-degradation path.
The chat box is presentation. The production product is the governed state machine and evidence around it.
Technical depth: boundaries and invariants
The implementation should preserve three invariants. First, untrusted input remains data until a deliberately selected component interprets it. Second, authority is checked at the moment an effect occurs, not inferred from an earlier UI or orchestration decision. Third, every externally visible result is attributable to versioned inputs, configuration, and dependencies. These invariants apply differently to production LLM application architecture, but together they prevent convenience layers from silently expanding trust.
For bounded model orchestration, tool effects and execution budgets must remain deterministic. Name which identity performs each transition and where data changes classification. This exposes copies in caches, queues, traces, evaluation stores, temporary files, and provider systems that are absent from a request-path diagram. Set limits for size, lifetime, retries, fan-out, and cost at the earliest trusted boundary. Map the full lifecycle: creation, validation, transformation, persistence, use, observation, expiry, deletion, and recovery.
Control plan
- Typed orchestration. Validate requests, model outputs, and tool arguments against versioned schemas. Verification: Malformed and adversarial contract tests.
- Tool authorization. Authorize every effect with user, action, resource, and current context. Verification: Cross-user and replay tests.
- Bounded execution. Limit time, tokens, iterations, fan-out, and spend. Verification: Loop and dependency-timeout drills.
- Versioned evidence. Trace model, prompt, retrieval, policy, and tool versions. Verification: Reconstruct sampled outcomes.
For bounded model orchestration, tool effects and execution budgets must remain deterministic. Prefer controls whose decision can be represented by a stable reason code and whose configuration can be reviewed as code. When a mechanism is probabilistic, document the threshold, calibration evidence, expected false-positive and false-negative consequences, and the human escalation path. Controls should be independently useful. A detector does not replace prevention, and a preventive rule with no observable denial can be impossible to operate.
Design-review questions
- Which components can create external effects?
- Where can untrusted instructions enter context?
- What deterministic checks surround probabilistic output?
- What is the minimum safe mode during provider failure?
For bounded model orchestration, tool effects and execution budgets must remain deterministic. Revisit assumptions after incidents and material dependency changes. These questions should produce evidence, not yes-or-no assurances. Link an answer to a test, policy version, trace, evaluation slice, access review, or documented supplier guarantee. Where evidence is unavailable, record the statement as an assumption and assign discovery work.
Release and recovery design
For bounded model orchestration, tool effects and execution budgets must remain deterministic. A production release needs compatibility rules for stored data, cached artifacts, client contracts, and in-flight work. Version prompts, schemas, policies, indexes, and model or cryptographic dependencies independently. A rollback may restore application code while leaving a new index or data format active; test those combinations explicitly. Keep emergency changes reviewable and time-bounded.
For bounded model orchestration, tool effects and execution budgets must remain deterministic. Avoid fallback behavior that silently removes authorization, provenance, grounding, or privacy controls. If the safe response is to stop an operation, return a clear, non-sensitive error and preserve enough correlation data for support. If bounded degradation is acceptable, constrain its duration, users, actions, and data. Recovery planning should identify the minimum safe service, the authority required to activate it, and the data needed to reconcile afterward.
For bounded model orchestration, tool effects and execution budgets must remain deterministic. Run a game day around the most consequential dependency. Inject latency, stale state, malformed responses, permission denial, and partial success. Confirm that retries do not duplicate effects, circuit breakers do not hide persistent failure, and queues cannot grow without a budget. Measure time to detect, decide, contain, recover, and verify. Feed discoveries into architecture and evaluation suites rather than leaving them only in an incident document.
Platform assembly sequence
Treat production LLM application architecture as a product capability with an owner, an interface, and measurable failure behavior. Begin with one bounded production flow rather than a platform-wide rewrite. The accountable group should include product, application, data, model, security, and reliability owners. Write the user or business outcome first, then map the identities, data, policy decisions, dependencies, and recovery paths that influence it. Record assumptions that can become false as the environment changes.
Capture a baseline before changing controls. For this topic, useful baseline evidence includes task success, refusal quality, latency by stage, token cost, tool failures, retrieval quality, and safety events. Baselines need dimensions, not only totals: environment, tenant, caller type, resource, model or policy version, and outcome often explain why an average moved. Protect telemetry from sensitive content, restrict access, and give high-cardinality data a deliberate retention period.
Implement the smallest vertical slice that can be evaluated end to end. Put configuration and policy under review, assign stable version identifiers, and make a rollback path available before broad exposure. Exercise both expected behavior and an unavailable model, poisoned context, unauthorized tool action, runaway loop, privacy leak, or silent quality regression. A release is not complete when the happy path succeeds; it is complete when operators can detect, contain, and recover from the credible failures.
For bounded model orchestration, tool effects and execution budgets must remain deterministic. Promote only when the evidence supports the intended benefit and no unacceptable regression is hidden in a subgroup. Use staged delivery. Start with offline tests and an isolated environment, move to internal or shadow traffic where appropriate, then expose a small production cohort with explicit stop conditions. Compare the new path with the baseline.
Model-system failure boundaries
For bounded model orchestration, tool effects and execution budgets must remain deterministic. Central services also concentrate availability and administrative risk. Define what happens when they are slow, unavailable, inconsistent, or compromised. Safe degradation is domain-specific: sometimes denying an action is correct; sometimes a bounded, auditable fallback prevents greater harm. No control described here establishes safety by itself. A technically correct mechanism can be undermined by stale ownership, excessive privilege, incomplete data, weak recovery, or an adjacent path that bypasses enforcement.
For bounded model orchestration, tool effects and execution budgets must remain deterministic. Track uncertainty and residual risk in plain language. Accepted risk needs an accountable owner, a reason, an expiration or review trigger, and evidence that the assumed conditions still hold. High-impact exceptions should be discoverable in operations, not buried in a design document. Do not reduce the review to a single score.
For bounded model orchestration, tool effects and execution budgets must remain deterministic. Test redaction before telemetry leaves the process. Restrict debug modes and make temporary diagnostic access expire automatically. Privacy and security should shape observability. Record identifiers, versions, reason codes, timing, and outcome rather than raw credentials, private prompts, regulated records, or complete retrieved documents.
Architecture readiness review
- Confirm ownership for the user outcome, production service, policy or model, data, and incident response.
- Verify least privilege for human and workload identities, including administrative and emergency paths.
- Test input limits, timeouts, retries, concurrency, idempotency, and cancellation under realistic load.
- Exercise an unavailable model, poisoned context, unauthorized tool action, runaway loop, privacy leak, or silent quality regression and confirm that alerts identify the affected path and version.
- Sample successful and denied or degraded outcomes; investigate by cohort rather than relying on averages.
- Verify that logs, traces, evaluation sets, caches, and support bundles exclude unnecessary sensitive data.
- Test rollback, revocation, restore, and dependency outage procedures on a schedule.
- Revisit the design after material architecture, supplier, data, threat, or policy changes.
Production architecture conclusion
The durable outcome is not a diagram or a purchased feature. It is a reviewable production loop: define the decision, constrain authority, preserve useful evidence, test failure, and adjust from observed results. For production LLM application architecture, success should be demonstrated through versioned prompts, traces, evaluation suites, authorization tests, rollback drills, and incident runbooks. That evidence lets engineering, security, product, and operations discuss the same system without pretending uncertainty has disappeared.
Continue with Retrieval-Augmented Generation: Designing Evidence Into AI Answers and browse the Prime Axiom resource library for related implementation material.
LLM architecture references
- NIST AI Risk Management Framework
- OWASP Top 10 for LLM Applications
- Google Cloud Generative AI Architecture
For bounded model orchestration, tool effects and execution budgets must remain deterministic. The architecture, examples, and recommendations in this article are original synthesis for practical engineering use. These sources are included for standards, risk frameworks, and vendor-supported behavior.



