Make each stage observable and accountable
A RAG or agent workflow has separate failure surfaces: ingestion, index freshness, retrieval, reranking, prompt assembly, model response, citation, and tool execution. Define a measurable service objective for each user-visible stage and an error budget or review threshold appropriate to its risk.
Stage-level service contract
| Stage | Measure | Failure decision |
|---|---|---|
| Retrieval | Permitted-evidence coverage and p50/p95 latency | Abstain, retry, or serve a bounded search result |
| Answer | Citation validity and grounded-answer evaluation | Withhold unsupported answer |
| Agent tool | Authorized completion, timeout, and denial rate | Stop or route to approved fallback |
Trace evidence and versions through the request
Record a request correlation ID, non-sensitive caller scope, corpus and index version, retrieved evidence IDs, filter decision, prompt template version, model configuration, policy result, tool outcome, and latency by stage. Redact sensitive payloads and retain only what an investigation needs.
Version-correlated RAG trace
Loading diagram...
Contain throttling and dependency failure
Treat 429 and 503 responses as capacity and dependency signals. Use bounded exponential backoff with jitter where the operation is safe to retry, preserve idempotency keys for writes, and protect dependencies with queue limits, backpressure, timeouts, and circuit breakers.
Degraded-mode runbook record
Application policy for a dependency failure; tune values from live measurements.
Click on an annotation to highlight it in the JSON
Treat corpus and index changes as releases
Chunking, embeddings, metadata filters, rerankers, prompts, and index migrations can all change the evidence presented to a model. Version them, evaluate them against representative and permission-sensitive cases, release gradually where the product allows it, and retain a proven rollback route.
This course-synthesis lifecycle extends Corpus Ingestion: treat a parser, chunker, or embedding change as an immutable candidate data source and index. Amazon Bedrock Knowledge Bases documents that parsing strategy and chunking strategy cannot be changed after a data source is connected, while its ingestion logs can record per-document processing outcomes.
Candidate ingestion release with evidence-based promotion
Loading diagram...
- Detect source-to-index drift with lineage and freshness signals.
- Compare a candidate index with the prior version on the same evaluation set.
- Exercise deletion, restore, dependency loss, and fallback paths before a high-risk release.
- Record the decision, owner, and conditions for rollback.
Debug and recover with a rehearsed runbook
- Triage by correlation ID: identify the caller scope, index version, evidence IDs, dependency status, and policy result.
- Classify the defect: source drift, permission mismatch, retrieval loss, model behaviour, tool failure, or capacity event.
- Contain with the narrowest safe control: pause ingestion, roll back index, open a circuit, or route to a retrieval-only or single-agent fallback.
- Restore and verify against RTO, RPO, residency, and representative quality checks; publish the learning into the next change control.
Make the trace envelope replayable without copying sensitive content
A useful trace answers an operator’s decision question: which configuration, evidence set, policy result, and dependency outcome produced this response? It does not require storing a complete user prompt or document body. Assign the correlation identifier at intake, propagate standard trace context across retrieval and tool boundaries, and attach immutable version identifiers rather than mutable labels such as “current index”. Sample successful traffic according to an explicit retention and cost policy, but keep error and quality-regression traces inspectable. The Agentic AI Lens recommends standardized schemas and end-to-end context propagation so concurrent runs can be separated reliably.
Illustrative OpenTelemetry retrieval span
Application-owned fields; hashes and IDs stand in for sensitive request or document content.
Click on an annotation to highlight it in the JSON
Turn CloudWatch questions into owned operating decisions
Dashboards are useful only when each signal changes a decision. Start with a bounded question and a named owner. For stale ingestion, compare source-event time with indexed-at time by corpus version and pause promotion when the lag exceeds the workload threshold. For throttling, segment 429 and 503 outcomes by dependency, operation, retry count, and fallback result; reduce offered load before retrying into a saturated service. For a quality regression, join answer-evaluation failures to index, prompt, policy, and model versions so a team can stop the candidate release rather than tuning blindly.
CloudWatch investigation questions
| Question | Evidence | Runbook decision |
|---|---|---|
| Is the corpus stale for a protected query class? | source event, indexed-at, corpus version, failed ingestion reason | Pause promotion; repair or replay the affected partition. |
| Is throttling recovering? | dependency status, retry attempts, queue depth, fallback rate | Apply backpressure or circuit break; do not increase retries without capacity evidence. |
| Did a release reduce grounded quality? | evaluation failure plus prompt, index, model, and policy versions | Roll back the candidate manifest and preserve the comparison trace. |
Promote and roll back a complete retrieval release
A rollback cannot be reconstructed from a model name alone. Treat the corpus snapshot, chunking rule, embedding and index configuration, filters, reranker, prompt, policy bundle, evaluation set, and deployment target as one release manifest. Before promotion, prove that the candidate can serve representative, denied, stale, and dependency-failure cases; state who may stop traffic and how the previous manifest is restored. This is architecture guidance, not a recovery SLA: recovery objectives remain workload- and service-specific and must be drilled.
Change and rollback manifest
A minimal release receipt used to compare a candidate with the last known-good configuration.
Click on an annotation to highlight it in the JSON
Practice this manifest in a game day. Start with a source update that is accepted upstream but absent from the candidate index, then verify that freshness telemetry identifies the affected scope without exposing document bodies. Introduce a controlled dependency throttle and verify backpressure, bounded retries, and the chosen degraded response. Finally, inject an evaluation failure for an otherwise healthy candidate and prove that the on-call owner can identify the manifest, stop promotion, restore the prior configuration, and re-run the affected cases. Record elapsed restoration time and lost or replayed work against the workload objective; a dashboard with no exercised decision path is not recovery evidence.
AWS guidance for observable agent operations
Primary guidance on end-to-end tracing, telemetry schemas, and operational controls. Lens guidance informs review; it is not an SLA or certification.
Read the Agentic AI Lens tracing practiceBind error budgets to alert ownership and a safe action
An SLO is useful when it represents a user outcome that an operator can influence. Define separate indicators for fresh permitted evidence, grounded cited answers, and successful authorized tool completion; do not collapse them into one availability percentage. State the population, exclusions, measurement window, and error budget in a release-owned record. An alert should name the threshold, alert owner, runbook, and mitigation authority. Page on a fast-burning budget or a safety breach; create a ticket for a slow trend. This is workload policy, not an AWS guarantee, and it must be calibrated with observed traffic and recovery capability.
SLO and alert ownership record
Application service-objective contract with an explicit action path.
Click on an annotation to highlight it in the JSON
Validate the contract by injecting a candidate-quality regression and a dependency failure separately. The first should consume the quality budget and stop promotion without being misclassified as infrastructure availability. The second should show bounded fallback and recovery telemetry. After every incident, review whether the alert was actionable, whether the owner had sufficient context, and whether the chosen mitigation created a hidden authorization or freshness regression.
Replay decisions from minimal redacted evidence
Incident replay is a controlled reconstruction, not a request to re-run a user’s production prompt against today’s corpus. Preserve a redacted replay bundle with configuration versions, normalized request class, identity scope token or reference, selected evidence IDs, policy receipt, tool outcomes, and terminal reason. Rehydrate only in an approved environment with the same permitted corpus snapshot and explicitly mark missing data. This lets a team distinguish a system regression from a source change while reducing the chance that traces become an uncontrolled duplicate of protected content.
Replay evidence and redaction controls
| Evidence | Keep or transform | Validation |
|---|---|---|
| Prompt and retrieved passage | Store classification and approved hash or reference, not default raw text | Redaction tests include error and retry paths. |
| Identity and tenant | Use opaque scope reference with controlled resolver | Replay cannot widen the original scope. |
| Versions and terminal reason | Retain immutable release identifiers | Operator can reproduce routing without guessing. |
Make replay results reviewable by recording a comparison outcome: reproduced, not reproduced, blocked by unavailable evidence, or rejected by authorization. A non-reproduction result can still be valuable if it proves the investigation used a different corpus, policy, or dependency state. Do not fill a missing replay field with a guessed current value. Escalate when the missing record itself prevents a safety or compliance conclusion, then improve the telemetry schema through the ordinary release process.
Glossary: terms first introduced here
These are the technical terms introduced in this step. Later modules build on them rather than redefining them from scratch.
New vocabulary for this step
| Term | Plain-language meaning | Why it matters here |
|---|---|---|
| Observability | The signals and records needed to understand what a running system did and why. | A RAG incident needs evidence about source, retrieval, policy, model, and tool steps, not only an error count. |
| Trace | A correlated record of the steps and versions involved in one request or background operation. | It makes a failure reproducible without treating broad access to raw prompts or documents as routine. |
| SLO (service-level objective) | A target for a user-important property such as availability, latency, citation validity, or safe abstention. | It turns reliability from a vague aspiration into a measurable release and operating decision. |
Knowledge Check
Test your understanding with this quiz. You need to answer all questions correctly to mark this section as complete.