Inferensys

Prompt

Post-Action Infrastructure Verification Prompt Template

A practical prompt playbook for using Post-Action Infrastructure Verification Prompt Template in production AI workflows.
Developer doing prompt engineering on laptop, prompt variations visible on screen, casual coding session.
PROMPT PLAYBOOK

When to Use This Prompt

Defines the ideal user, required context, and operational boundaries for the Post-Action Infrastructure Verification Prompt Template.

This prompt is designed for SRE and platform engineering teams who need to close the loop on an infrastructure change by programmatically verifying that the observed state matches the intended outcome. It is the final gate in an autonomous pipeline, a scheduled post-sync job, or a structured checkpoint before resolving an incident. The ideal user is an engineer embedding this prompt into a CI/CD system, a GitOps operator, or a runbook automation that must produce a machine-readable pass/fail report with evidence rather than a conversational summary.

To use this prompt effectively, you must provide three concrete inputs: a description of the intended change, a structured specification of the expected post-action state, and the actual observed state collected from monitoring, logs, or API queries. The prompt compares these inputs and outputs a deterministic verdict. It is not a replacement for real-time alerting or anomaly detection systems; it is a point-in-time verification tool. Do not use this prompt when the expected state is undefined, when the observed state is stale or incomplete, or when the action is still in-flight and side effects have not settled.

Before wiring this into a production pipeline, define the minimum required evidence for a passing verdict and the tolerance for acceptable drift. For high-risk actions such as database migrations, IAM policy changes, or security group modifications, always route the output through a human approval step before considering the verification closed. The prompt's value comes from its structured output contract, which allows downstream systems to act on the result without manual interpretation.

PRACTICAL GUARDRAILS

Use Case Fit

Where the Post-Action Infrastructure Verification Prompt Template delivers value and where it introduces unacceptable risk.

01

Good Fit: Deterministic State Changes

Use when: verifying infrastructure changes with a known expected state, such as a deployment updating a replica count, a DNS record change, or a firewall rule modification. Guardrail: The prompt requires a strict schema for expected_state and actual_state to enable programmatic comparison.

02

Bad Fit: Exploratory Debugging

Avoid when: the root cause of an incident is unknown and requires open-ended investigation. This prompt is designed for binary pass/fail verification against a known target, not for generating hypotheses. Guardrail: Route unknown-state scenarios to an Incident Remediation Verification Prompt instead.

03

Required Inputs: Structured State Snapshots

Risk: The prompt fails silently if fed unstructured logs or incomplete state data. Guardrail: The harness must enforce a strict input contract requiring a machine-readable expected_state object and a queryable actual_state source (e.g., API response, IaC state file) before execution.

04

Operational Risk: False Positives on Transient States

Risk: The model may flag a verification failure due to eventual consistency delays (e.g., DNS propagation) rather than a real error. Guardrail: The prompt must include a stabilization_wait_seconds parameter and instruct the model to classify transient mismatches as 'degraded' rather than 'failed'.

05

Operational Risk: Sensitive Data Leakage

Risk: Infrastructure state dumps often contain secrets, internal IPs, or PII in environment variables. Guardrail: Implement a pre-processing redaction layer in the application harness. The prompt itself should instruct the model to refuse to process raw secrets if they appear in the input.

06

Bad Fit: Multi-Step Rollback Decisions

Avoid when: the verification failure requires a complex, multi-step rollback plan. This prompt only confirms the pass/fail status. Guardrail: Chain this prompt's output into a dedicated Rollback Decision Prompt if the status is 'failed', rather than asking the verification prompt to plan the remediation.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A copy-ready prompt that compares expected vs actual infrastructure state and produces a structured pass/fail verification report with evidence.

This prompt template is designed to be pasted directly into your AI system after replacing the square-bracket placeholders with data from your infrastructure tooling. It instructs the model to act as an SRE verification engine, comparing a declared expected state against observed actual state collected from logs, metrics, APIs, or configuration scans. The output is a structured report suitable for automated gating in a CI/CD pipeline or for human review in an incident or change management workflow.

text
You are an infrastructure verification engine. Your task is to compare the expected state of a system after a change against the observed actual state and produce a structured pass/fail report.

## INPUTS

### CHANGE CONTEXT
[CHANGE_DESCRIPTION]

### EXPECTED STATE
[EXPECTED_STATE]

### OBSERVED STATE
[OBSERVED_STATE]

### VERIFICATION CRITERIA
[VERIFICATION_CRITERIA]

### CONSTRAINTS
[CONSTRAINTS]

## OUTPUT SCHEMA
Return a single JSON object with this exact structure:
{
  "verification_id": "string",
  "overall_status": "pass" | "fail" | "inconclusive",
  "criteria_results": [
    {
      "criterion": "string (the specific check performed)",
      "status": "pass" | "fail" | "inconclusive",
      "expected": "string (what was expected)",
      "actual": "string (what was observed)",
      "evidence": "string (specific data, metric name, log line, or API response field)",
      "severity": "critical" | "warning" | "info"
    }
  ],
  "drift_detected": true | false,
  "drift_details": "string (summary of any unexpected differences, or null if none)",
  "recommendation": "proceed" | "rollback" | "investigate" | "escalate",
  "recommendation_reasoning": "string (concise explanation for the recommendation)",
  "human_review_required": true | false,
  "human_review_reason": "string (why human review is needed, or null if not required)"
}

## INSTRUCTIONS
1. Compare each item in VERIFICATION CRITERIA against the EXPECTED STATE and OBSERVED STATE.
2. For every criterion, cite specific evidence from the OBSERVED STATE. Do not infer state without evidence.
3. If the OBSERVED STATE is incomplete or missing data needed to verify a criterion, mark that criterion as "inconclusive" and explain what data is missing.
4. If any criterion marked "critical" fails, overall_status must be "fail" and recommendation must be "rollback" or "escalate".
5. If drift is detected that was not part of the expected change, set drift_detected to true and describe the drift in drift_details.
6. If overall_status is "fail" or "inconclusive", set human_review_required to true.
7. Do not fabricate evidence. If you cannot verify something, say so.
8. Follow the CONSTRAINTS when evaluating severity and recommendations.

To adapt this template, replace each placeholder with data from your infrastructure tooling. [CHANGE_DESCRIPTION] should contain the change request, PR, or incident ticket context. [EXPECTED_STATE] should describe what the system should look like after the change—use structured data from Terraform plans, deployment manifests, or configuration management tools. [OBSERVED_STATE] should contain the actual state pulled from monitoring systems, kubectl output, cloud provider APIs, or database queries. [VERIFICATION_CRITERIA] should list specific, testable conditions such as 'pod count equals 3 in namespace production' or 'p95 latency below 200ms for service checkout'. [CONSTRAINTS] should encode organizational policies like 'any security group change requires human review' or 'latency regression over 10% is critical'. After pasting the filled template, validate the JSON output against the schema before using the result to gate a pipeline stage or open an incident.

IMPLEMENTATION TABLE

Prompt Variables

Inputs the prompt needs to work reliably. All placeholders must be populated by your infrastructure tooling or orchestration layer before the prompt is sent.

PlaceholderPurposeExampleValidation Notes

[ACTION_DESCRIPTION]

Human-readable summary of the infrastructure change that was executed

Rolling restart of payment-service in us-east-1

Must be non-empty string; max 500 chars; used for context anchoring

[EXPECTED_STATE]

Declarative definition of the target state after the action completed

All 6 instances healthy, CPU < 70%, error rate < 0.1%

Must be parseable as structured assertions; supports JSON or bullet list; null not allowed

[OBSERVED_STATE]

Current state data pulled from monitoring, logs, and infrastructure APIs

Instance-3 CPU at 92%, error rate 2.3% on /checkout endpoint

Must be populated from live telemetry; stale data older than 5 minutes should trigger a refresh before prompt assembly

[CHANGE_WINDOW]

Time range when the action was executed, used to scope verification

2025-01-15T14:00:00Z to 2025-01-15T14:15:00Z

Must be ISO 8601 range; start must precede end; null allowed if action is instantaneous

[BASELINE_METRICS]

Pre-change metric snapshot for comparison against observed state

Pre-change: avg latency 120ms, error rate 0.05%, all health checks green

Must be from a window immediately before the change; null allowed for first-time deployments but should trigger a warning

[VERIFICATION_CRITERIA]

Explicit pass/fail rules the model must apply when comparing expected vs observed state

All health checks must pass; error rate must not exceed 0.5%; no instance CPU above 85% for >2 minutes

Must be a list of boolean-evaluable conditions; each criterion must reference a measurable signal; null not allowed

[ROLLBACK_PLAN_REFERENCE]

Pointer to the rollback runbook or procedure if verification fails

runbook://payment-service-rollback/v2.1

Must be a resolvable reference; null allowed if no rollback exists but should escalate to human with warning

[EVIDENCE_SOURCES]

List of monitoring systems, log stores, and APIs queried to produce observed state

Datadog metrics, CloudWatch logs, PagerDuty alert status, AWS ELB health checks

Must enumerate all sources used; each source must be queryable for audit; null not allowed

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the Post-Action Infrastructure Verification Prompt into an application or automated workflow.

This prompt is designed to be the final gate in an automated infrastructure pipeline, not a standalone chat query. It should be invoked programmatically after a change has been executed—such as a deployment, a configuration push, or a database migration—and the system has had enough time to stabilize. The harness must supply the [EXPECTED_STATE] from the source of truth (e.g., an IaC plan output, a deployment manifest, or a change ticket) and the [OBSERVED_STATE] from live telemetry, API queries, or log aggregation. The model's job is to act as a structured comparator, not to perform the observation itself; the application layer is responsible for gathering the raw evidence.

To integrate this into a CI/CD or runbook automation platform, wrap the prompt in a function that accepts two required string inputs: expected_state and observed_state. The function should construct the prompt, call a capable model (GPT-4o, Claude 3.5 Sonnet, or similar), and parse the JSON output. Implement a retry loop with a maximum of 2 attempts that catches JSON parsing errors and re-prompts with the malformed output and a strict repair instruction. If the model returns a `

verdict": "FAIL"or a"verdict": "INDETERMINATE

the harness must block pipeline progression and route the full verification report to a human review queue. For `

verdict": "PASS

log the report as an audit artifact and allow the pipeline to continue.

Validation is critical because a false PASS can allow a broken change to propagate. After parsing the model's JSON, apply a programmatic check: if the verdict is PASS but the evidence array contains any item with a status of `

MISMATCH"or"UNKNOWN

override the verdict to INDETERMINATE and escalate. This acts as a safety net against hallucinated summaries. Additionally

implement a time-boxed staleness check: if the observed_state was collected more than 5 minutes before the prompt call

prepend a warning to the `[OBSERVED_STATE

IMPLEMENTATION TABLE

Expected Output Contract

Defines the structure, types, and validation rules for the model's JSON response. Use this contract to parse the output programmatically and trigger rollback or human review when verification fails.

Field or ElementType or FormatRequiredValidation Rule

verification_id

string (UUID v4)

Must match the request [VERIFICATION_ID]. If missing or mismatched, reject the response.

overall_status

enum: pass | fail | inconclusive

Must be one of the three values. If 'inconclusive', the [EVIDENCE_SUMMARY] field must be non-empty.

checks

array of objects

Must not be empty. Each object must conform to the check_item schema defined in [OUTPUT_SCHEMA].

checks[].check_name

string

Must match one of the expected check names provided in [EXPECTED_CHECKS]. Unknown names should trigger a warning.

checks[].status

enum: pass | fail | error

If 'error', the [error_message] field in the check item must be populated.

checks[].expected_value

string or number

Must be a non-null value. Compare against [actual_value] to determine pass/fail.

checks[].actual_value

string or number or null

If null, the check status must be 'error' or 'fail' unless the expected value is also null.

evidence_summary

string

Required if overall_status is 'inconclusive'. Must contain a concise explanation of why verification could not be completed.

rollback_recommended

boolean

Must be true if any check status is 'fail' and the check is marked as critical in [CRITICAL_CHECKS]. Human approval required before acting on this flag.

generated_at

string (ISO 8601)

Must be a valid timestamp within 5 minutes of the system clock. Stale timestamps trigger a retry or rejection.

PRACTICAL GUARDRAILS

Common Failure Modes

Post-action verification prompts fail in predictable ways. Here are the most common failure modes and how to guard against them before they reach production.

01

False Positives Masking Real Drift

What to watch: The prompt declares verification passed because it compared the wrong fields, ignored silent failures, or accepted a superficial state match. The system reports green while actual drift goes undetected. Guardrail: Define an explicit comparison schema with required fields, tolerance thresholds, and mandatory evidence. Add eval checks that inject known drift to confirm the prompt catches it.

02

Hallucinated State Evidence

What to watch: The model fabricates metric values, log entries, or configuration details that look plausible but were never retrieved. This is especially dangerous when the verification report is used for audit or compliance. Guardrail: Require every factual claim in the output to cite a specific tool call, timestamp, or data source. Add a grounding check that flags unsupported assertions before the report is accepted.

03

Time-Window Mismatch

What to watch: The prompt compares pre-change state from one time window against post-change state from a different window, producing misleading pass/fail results. Lag in metrics or logs makes the comparison invalid. Guardrail: Explicitly define the pre-change and post-change observation windows in the prompt template. Include a validation step that confirms timestamps align before comparison logic runs.

04

Incomplete Verification Scope

What to watch: The prompt checks only the primary resource and misses downstream dependencies, side effects, or related configurations. A deployment passes verification while breaking dependent services. Guardrail: Include a blast-radius checklist in the prompt that enumerates dependent resources, consumers, and data paths. Require explicit confirmation for each dependency before issuing a pass verdict.

05

Ambiguous Pass/Fail Criteria

What to watch: The prompt uses vague language like 'check if things look normal' or 'verify the system is healthy,' producing inconsistent verdicts across runs. Operators can't trust the output for automated gating. Guardrail: Define a structured verdict schema with explicit pass conditions, fail conditions, and a 'needs review' tier for borderline cases. Include numeric thresholds where applicable and require the model to justify its classification.

06

Rollback Instruction Omission

What to watch: The prompt correctly identifies a verification failure but fails to generate actionable rollback or remediation steps, leaving operators with a problem and no path forward. Guardrail: Make rollback instruction generation a required output field when the verdict is 'fail' or 'needs review.' Include pre-flight safety checks, ordering constraints, and rollback verification steps in the generated instructions.

IMPLEMENTATION TABLE

Evaluation Rubric

Run these checks against a golden dataset of known change outcomes to validate the Post-Action Infrastructure Verification Prompt before production deployment.

CriterionPass StandardFailure SignalTest Method

State Comparison Accuracy

Expected vs actual state diff matches ground truth for all resources in golden set

False positive: reports drift where none exists. False negative: misses known configuration change

Compare prompt output against 20 labeled infrastructure snapshots with known drift and no-drift cases

Evidence Grounding

Every pass/fail determination cites a specific observable metric, log entry, or API response field

Output contains unsupported claims like 'system appears healthy' without linking to a named check or data source

Parse output for evidence references; flag any verdict lacking a source path or metric name

Schema Compliance

Output strictly matches [OUTPUT_SCHEMA] with all required fields present and correctly typed

Missing resource_id, status field is not one of pass/fail/indeterminate, or evidence array is empty on a fail verdict

Validate output JSON against schema; reject on structural deviation

Indeterminate Handling

Resources with insufficient data or conflicting signals are marked indeterminate with explicit reason

Ambiguous state is forced to pass or fail without documenting uncertainty or missing data

Inject 5 golden cases with partial or conflicting telemetry; verify indeterminate classification and reason presence

False Positive Rate on Healthy Systems

Zero false positives when verifying a known-healthy infrastructure state

Any resource flagged as fail when ground truth confirms expected state matches actual state

Run against 10 known-healthy post-change snapshots; count false alarms

Missed Drift Detection

100% recall on known drift cases where configuration diverges from expected state

Any resource with confirmed drift is marked pass or omitted from the report

Run against 10 snapshots with injected drift; measure recall across all drifted resources

Rollback Recommendation Relevance

When verification fails, rollback hint references the specific resource and drift type detected

Generic rollback suggestion like 'review configuration' without linking to the failed resource or observed delta

For each fail verdict in golden set, check that rollback_hint field contains resource identifier and drift category

Latency Budget Compliance

Verification completes within [MAX_LATENCY_SECONDS] for up to [MAX_RESOURCES] resources

Output is truncated, missing resources, or exceeds time budget by more than 20%

Benchmark against 50-resource and 200-resource golden sets; measure end-to-end response time

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Add strict JSON schema validation, retry logic on parse failure, and structured logging of every verification run. Include evidence fields that link to specific metrics, logs, or API responses. Wire the output into an approval gate that blocks roll-forward if verification fails.

json
{
  "verdict": "pass|fail|inconclusive",
  "checks": [
    {
      "check_name": "[CHECK_NAME]",
      "expected": "[EXPECTED_VALUE]",
      "actual": "[ACTUAL_VALUE]",
      "match": true|false,
      "evidence_source": "[LOG_QUERY_OR_METRIC_LINK]",
      "severity": "critical|warning|info"
    }
  ],
  "summary": "[SUMMARY]",
  "rollback_recommended": true|false,
  "confidence": 0.0-1.0
}

Watch for

  • Silent format drift when the model changes JSON structure across runs
  • False positives when evidence links are hallucinated rather than real
  • Missing human review for critical severity failures before auto-rollback
Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.