Inferensys

Prompt

Side Effect Prediction and Review Prompt Template

A practical prompt playbook for predicting all observable side effects of an agent plan before it mutates production resources, producing a structured manifest suitable for pre-approval review gates.
Developer doing prompt engineering on laptop, prompt variations visible on screen, casual coding session.
PROMPT PLAYBOOK

When to Use This Prompt

Defines the operational context, ideal user, and boundary conditions for the side-effect prediction prompt to prevent misuse in low-risk or read-only scenarios.

This prompt is designed for platform engineers and operators who manage AI agents with the authority to mutate production databases, cloud infrastructure, customer records, or external service configurations. The core job-to-be-done is generating a complete, structured prediction of every observable side effect before any execution step begins. This side-effect manifest serves as the input to a human approval gate or an automated policy engine, ensuring that no mutation occurs without explicit review. The ideal user is someone who already has a plan review process but finds that it lacks systematic enumeration of state changes, data mutations, external API calls with write intent, configuration updates, and notification triggers.

Use this prompt when the cost of an unanticipated mutation is high—for example, when a misplaced database write could corrupt customer data, or an incorrect infrastructure change could cause an outage. It is appropriate for workflows where the agent operates on mutable, shared resources and where the existing execution engine does not already produce a deterministic side-effect manifest. The prompt is particularly valuable in regulated environments where audit trails of predicted versus actual side effects are required. You should also use it when your team needs to scale human review by standardizing what reviewers look for, rather than relying on ad-hoc plan inspection.

Do not use this prompt for read-only analysis plans, plans that operate entirely in sandboxed or ephemeral environments, or plans where side effects are already fully described by a deterministic execution engine. If your agent is only performing search, summarization, or classification with no write operations, this prompt adds unnecessary latency and token cost. Similarly, if you are using a workflow engine that already outputs a complete list of intended mutations as part of its execution contract, running this prompt would be redundant. Avoid using it as a substitute for proper sandbox testing—this prompt predicts side effects, but it does not execute or validate them. Always pair the output with actual pre-execution testing where possible.

PRACTICAL GUARDRAILS

Use Case Fit

Where the Side Effect Prediction and Review prompt template delivers value and where it introduces unacceptable risk.

01

Good Fit: Pre-Production Mutation Gates

Use when: An agent plan includes steps that create, update, or delete production resources such as database records, cloud infrastructure, or customer-facing configurations. Guardrail: Run this prompt as a blocking pre-execution gate. Only release the plan to the execution runtime after the side-effect manifest has been reviewed and approved.

02

Good Fit: Compliance Audit Preparation

Use when: You need an auditable record of predicted state changes before they occur, especially in SOC 2, HIPAA, or PCI-regulated environments. Guardrail: Store the generated side-effect manifest alongside the execution trace as a compliance artifact. Pair with a post-execution reconciliation step to detect unpredicted mutations.

03

Bad Fit: Read-Only Analysis Workflows

Avoid when: The agent plan consists entirely of read operations, data retrieval, or analysis with no external state changes. Guardrail: Skip this prompt to avoid unnecessary latency and token cost. Use a lightweight classifier to detect mutation steps before invoking the full side-effect review.

04

Bad Fit: Real-Time, Low-Latency Paths

Avoid when: The agent operates under strict latency budgets where an additional LLM call for side-effect prediction would violate SLOs. Guardrail: For latency-sensitive paths, use a static allowlist of pre-approved mutation patterns and fall back to this prompt only for novel or high-risk operations.

05

Required Input: Complete Tool Manifest

Risk: Without a full tool manifest including write-capable endpoints, the model cannot accurately predict side effects and will hallucinate plausible but incorrect impacts. Guardrail: Always provide the agent's full tool schema with mutation semantics clearly labeled. Validate that every tool in the plan appears in the provided manifest before running the prompt.

06

Operational Risk: False Confidence in Predictions

Risk: The model may predict side effects with high confidence while missing indirect or downstream impacts such as cache invalidation, webhook triggers, or eventual consistency delays. Guardrail: Treat the side-effect manifest as a minimum prediction, not an exhaustive guarantee. Implement post-execution state diffing to catch unpredicted changes and feed them back into prompt improvement.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A reusable prompt that predicts all observable side effects of an agent execution plan and outputs a structured manifest for pre-approval review gates.

This prompt template is designed to be inserted into an agent planning pipeline immediately after a plan is generated but before any execution step begins. It forces the model to enumerate every state change, external service call, data mutation, and irreversible action the plan would produce. The output is a side-effect manifest that can be passed to a human approval queue, logged for audit, or compared against a policy engine. Use this when your agent operates on production databases, cloud infrastructure, customer-facing APIs, or any system where unintended mutations carry real cost.

text
You are a side-effect auditor for an autonomous agent system. Your job is to predict every observable side effect of the following execution plan before any step runs. Do not execute the plan. Do not suggest alternatives. Only produce the side-effect manifest.

## PLAN TO AUDIT
[PLAN]

## AVAILABLE TOOLS AND CAPABILITIES
[TOOL_MANIFEST]

## TARGET ENVIRONMENT CONTEXT
[ENVIRONMENT_CONTEXT]

## CONSTRAINTS
- Classify each side effect by type: STATE_CHANGE, EXTERNAL_CALL, DATA_MUTATION, IRREVERSIBLE_ACTION, OBSERVABLE_OUTPUT, or NO_SIDE_EFFECT.
- For each side effect, specify: the step that causes it, the resource affected, the expected before/after state, whether it is reversible, and the blast radius if it fails.
- Flag any side effect that crosses a trust boundary (e.g., production vs. staging, internal vs. customer-facing, read-only vs. write).
- If a step's side effects depend on runtime data not available at plan time, mark it as CONDITIONAL and describe the branching possibilities.
- Rate each side effect's risk as LOW, MEDIUM, HIGH, or CRITICAL based on reversibility, blast radius, and trust boundary crossing.

## OUTPUT SCHEMA
Return a JSON object with this exact structure:
{
  "plan_id": "string",
  "audit_timestamp": "string (ISO 8601)",
  "total_steps_audited": integer,
  "side_effects": [
    {
      "step_id": "string",
      "step_description": "string",
      "effect_type": "STATE_CHANGE | EXTERNAL_CALL | DATA_MUTATION | IRREVERSIBLE_ACTION | OBSERVABLE_OUTPUT | NO_SIDE_EFFECT",
      "resource_affected": "string (fully qualified resource identifier)",
      "pre_state": "string (description of state before execution)",
      "post_state": "string (description of expected state after execution)",
      "is_reversible": boolean,
      "reversal_procedure": "string or null (how to undo, if reversible)",
      "blast_radius": "string (what else is affected if this fails)",
      "trust_boundary_crossed": boolean,
      "trust_boundary_detail": "string or null",
      "conditionality": "UNCONDITIONAL | CONDITIONAL",
      "condition_description": "string or null (branching scenarios if conditional)",
      "risk_level": "LOW | MEDIUM | HIGH | CRITICAL",
      "risk_rationale": "string"
    }
  ],
  "approval_recommendation": "PROCEED | PROCEED_WITH_CAUTION | REQUIRES_REVIEW | BLOCKED",
  "approval_rationale": "string (summary of why this recommendation was reached)",
  "flagged_steps": [
    {
      "step_id": "string",
      "concern": "string",
      "severity": "LOW | MEDIUM | HIGH | CRITICAL"
    }
  ]
}

## EXAMPLES
[FEW_SHOT_EXAMPLES]

## RISK LEVEL
Current operating risk level: [RISK_LEVEL]
If RISK_LEVEL is HIGH or CRITICAL, flag every irreversible action and every trust boundary crossing for mandatory human review.

Adapt this template by replacing the square-bracket placeholders with your actual plan representation, tool manifest, environment context, and few-shot examples. The [PLAN] placeholder should contain the full step-by-step plan as generated by your planning module, including step IDs, descriptions, and tool assignments. The [TOOL_MANIFEST] should list every tool available to the agent with its capabilities, permissions, and side-effect profiles if known. The [ENVIRONMENT_CONTEXT] should describe the target system state, including which resources are production, which are read-only, and any known constraints. The [FEW_SHOT_EXAMPLES] placeholder is critical for output consistency—provide at least two examples showing correct side-effect classification across different effect types. The [RISK_LEVEL] parameter should be set by your runtime based on the operating context: use LOW for development and staging environments, MEDIUM for internal tools, HIGH for customer-facing systems, and CRITICAL for production infrastructure or regulated data. Before deploying this prompt, validate that your plan representation includes stable step IDs that survive across planning and auditing stages, and ensure your approval gate can parse the JSON output schema without field name mismatches.

IMPLEMENTATION TABLE

Prompt Variables

Required inputs for the Side Effect Prediction and Review prompt. Each placeholder must be populated before the prompt is sent. Missing or malformed variables will cause the model to hallucinate side effects or skip critical mutation categories.

PlaceholderPurposeExampleValidation Notes

[PLAN_STEPS]

The complete sequence of planned actions to analyze for side effects

  1. DELETE /users/1234
  2. POST /billing/invoice with payload {...}
  3. UPDATE db.orders SET status='cancelled'

Must be a numbered or bulleted list of discrete steps. Each step must include the target resource or API endpoint. Empty or prose-only input will produce vague predictions.

[AGENT_CAPABILITIES]

The full manifest of tools, permissions, and access scopes available to the agent

Tools: user_delete, billing_create, order_update Permissions: write:users, write:billing, write:orders Scope: production-us-east-1

Must include explicit permission boundaries. If scopes are omitted, the model will assume worst-case access and over-flag side effects. Validate against actual IAM or API key scopes before use.

[TARGET_ENVIRONMENT]

The environment where the plan will execute

production

Must be one of: production, staging, development, sandbox. Controls the severity weighting of side effects. Null or unknown values should default to production with a warning flag.

[RESOURCE_INVENTORY]

A list of mutable resources the agent can affect, with current state summaries

users: 45,230 active orders: 12,847 open billing_invoices: 3,201 this month

Optional but strongly recommended. Without this, the model cannot estimate blast radius. If null, the prompt should instruct the model to mark all resource-impact estimates as low-confidence.

[PREVIOUS_SIDE_EFFECTS]

Side effects already produced by completed steps in a multi-step execution

Step 2 already sent invoice #45821 to customer@example.com Step 3 already set order #8872 to cancelled

Required for replanning or mid-execution review. If null, the prompt treats this as a pre-execution review. Must be a structured list with step references, not free text.

[CONSTRAINT_MANIFEST]

Hard constraints that side effects must not violate

No outbound emails to unverified addresses No deletions without soft-delete grace period Max 100 records mutated per step

Each constraint must be a single verifiable rule. Vague constraints like 'be careful' will be ignored. Validate that each constraint is testable against the predicted side-effect manifest.

[REVIEW_GATE_TYPE]

The type of approval gate this side-effect manifest will feed into

human_approval_required

Must be one of: human_approval_required, auto_approve_low_risk, logging_only, block_on_high_severity. Controls the output detail level and severity threshold language. Mismatch with actual gate logic will cause false approvals or unnecessary blocks.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the side-effect prediction prompt into a production agent review gate.

This prompt is not a conversational assistant; it is a pre-execution safety validator that must sit inside a deterministic application harness. The harness is responsible for feeding the prompt a complete plan object and a structured environment manifest, then parsing the predicted side-effect manifest into a machine-readable format for downstream gating logic. The prompt itself is stateless—every call must receive the full plan and context because side-effect analysis depends on the interaction between the plan steps and the target environment's current state.

Wire the prompt into a review gate that executes synchronously after plan generation and before any tool dispatch. The application layer must: (1) assemble the [PLAN] as a JSON array of steps with id, action, target_resource, and parameters; (2) build the [ENVIRONMENT_MANIFEST] describing mutable resources, their current state, and access scopes; (3) call the model with response_format set to a strict JSON schema matching the expected side-effect manifest; (4) validate the output against that schema, rejecting any response where predicted_side_effects is not an array or risk_level is not one of the allowed enum values; (5) if validation fails, retry once with the validation error appended to the prompt as a [PREVIOUS_ERROR] constraint. After two failures, escalate to a human reviewer and block execution. For high-risk environments, add a human approval queue step: if any side effect has severity: "critical" or irreversible: true, route the manifest to a review UI and pause the agent until approval is received.

Model choice matters here. Use a model with strong structured output support and low hallucination rates on enumeration tasks—frontier models with JSON mode enabled are preferred. Set temperature to 0 or near-zero to maximize consistency. Log every side-effect prediction alongside the plan version, environment manifest hash, and final execution outcome. This creates a feedback loop: compare predicted side effects against actual observed side effects from execution logs to build an eval dataset for tuning the prompt or fine-tuning a smaller classifier model. Do not use this prompt for real-time latency-sensitive paths where the review gate would violate a user-facing SLA; in those cases, pre-compute side-effect manifests for known plan templates and use the prompt only for novel or high-variance plans.

IMPLEMENTATION TABLE

Expected Output Contract

Defines the structure, types, and validation rules for the side-effect manifest produced by the Side Effect Prediction and Review Prompt. Use this contract to build a parser, validator, and approval gate before executing the plan.

Field or ElementType or FormatRequiredValidation Rule

side_effect_manifest

JSON Object

Top-level object must contain 'plan_id', 'review_timestamp', and 'predicted_effects' array.

plan_id

String

Must match the [PLAN_ID] input exactly. Non-match triggers a schema rejection.

review_timestamp

ISO 8601 String

Must parse to a valid UTC datetime. Reject if timestamp is older than the plan generation time.

predicted_effects

Array of Objects

Array must not be empty. If no side effects are predicted, a single object with 'effect_type': 'NONE' and 'rationale' is required.

predicted_effects[].effect_type

Enum String

Must be one of: STATE_CHANGE, EXTERNAL_CALL, DATA_MUTATION, FILE_SYSTEM, CONFIG_CHANGE, PERMISSION_CHANGE, NOTIFICATION, NONE. Reject unknown values.

predicted_effects[].target_resource

String (URN or Path)

Must be a non-empty string identifying the resource. For EXTERNAL_CALL, must be a valid URL or service identifier. For NONE, set to null.

predicted_effects[].description

String

Must be a non-empty, human-readable description of the expected change. Minimum 20 characters. Reject if it contains only the effect_type repeated.

predicted_effects[].reversibility

Enum String

Must be one of: REVERSIBLE, IRREVERSIBLE, PARTIALLY_REVERSIBLE, NOT_APPLICABLE. IRREVERSIBLE effects require a 'rollback_notes' field.

predicted_effects[].confidence

Number (0.0-1.0)

Must be a float between 0.0 and 1.0 inclusive. Effects with confidence below [CONFIDENCE_THRESHOLD] should be flagged for human review.

predicted_effects[].approval_required

Boolean

Must be true if reversibility is IRREVERSIBLE or confidence is below [CONFIDENCE_THRESHOLD]. The approval gate should block execution if any effect has this set to true and is not yet approved.

PRACTICAL GUARDRAILS

Common Failure Modes

Side-effect prediction fails in predictable ways. These are the most common failure modes when generating a side-effect manifest for agent plans, along with practical mitigations to embed in your review harness.

01

Silent State Mutation Omission

What to watch: The model lists obvious API calls but misses implicit state changes such as cache invalidation, log writes, metric emissions, or database trigger cascades. These unlisted side effects bypass review gates entirely. Guardrail: Include a system prompt instruction to enumerate second-order effects and infrastructure-level mutations. Cross-reference the plan against a known asset inventory or architecture diagram.

02

Over-Confident Null Predictions

What to watch: For plans the model deems 'read-only' or 'safe,' it outputs an empty side-effect manifest with high confidence, missing mutations caused by logging, analytics, or stateful read operations. Guardrail: Require the model to justify any empty manifest with a step-by-step trace. Implement a hard rule that flags plans with zero predicted side effects for mandatory human review.

03

Vague or Non-Verifiable Descriptions

What to watch: The manifest contains entries like 'updates database' or 'modifies configuration' without specifying the target table, key, config path, or expected before/after state. Reviewers cannot assess risk against such ambiguity. Guardrail: Enforce a strict output schema requiring resource_identifier, mutation_type, and expected_state_change fields for every side effect. Validate schema compliance before the manifest reaches a human.

04

Scope Creep in Multi-Step Plans

What to watch: The model accurately predicts side effects for the first few steps but loses fidelity in later steps, omitting cumulative or cascading effects from earlier mutations. Guardrail: Prompt the model to predict side effects step-by-step and then perform a second pass to identify cross-step interactions. Use a separate 'cumulative impact' section in the output schema.

05

Tool-Specific Blind Spots

What to watch: The model fails to predict side effects for custom or less common tools whose internal behavior is not well-represented in training data. It defaults to generic descriptions or misses the side effect entirely. Guardrail: Augment the prompt with tool-specific side-effect documentation. For each available tool, provide a structured description of its known mutations, external calls, and failure modes in the system prompt.

06

Hallucinated Approval Justifications

What to watch: To make a plan appear safer and pass a review gate, the model fabricates reassuring but false statements like 'no production impact' or 'fully idempotent' without evidence. Guardrail: Require every safety claim in the manifest to be tied to a specific plan step or tool contract. Use an LLM judge or a second model pass to fact-check safety assertions against the raw plan before the manifest is shown to a human reviewer.

IMPLEMENTATION TABLE

Evaluation Rubric

Criteria for evaluating the quality and safety of a side-effect prediction manifest before it is used in a pre-approval review gate. Use this rubric to test the prompt's output against pass/fail standards.

CriterionPass StandardFailure SignalTest Method

Completeness of Side Effects

All observable state changes, external service impacts, and data mutations are listed for every plan step.

Manifest omits a known mutation (e.g., a database write or API POST) that is explicitly described in the plan.

Diff the manifest against a manually curated list of expected side effects from the plan. Fail if recall < 100%.

Granularity of Description

Each side effect specifies the target resource, the operation type, and the expected before/after state.

A side effect is described vaguely (e.g., 'updates config') without identifying the specific resource or new value.

Parse each side-effect entry for required fields: [RESOURCE_ID], [OPERATION], [PRE_STATE], [POST_STATE]. Fail if any field is missing or null.

Reversibility Classification

Each side effect is correctly classified as REVERSIBLE, IRREVERSIBLE, or CONDITIONALLY_REVERSIBLE with a rollback procedure for reversible items.

An irreversible operation (e.g., sending an email, deleting a record) is misclassified as reversible.

Sample 5 side effects with known reversibility. Fail if classification accuracy < 100% on this sample.

Impact Scope and Blast Radius

For each side effect, the manifest estimates the blast radius (e.g., number of users affected, downstream services impacted).

A side effect with a wide blast radius (e.g., production schema migration) is listed with 'low' impact or no scope estimate.

Check that every side effect has a non-null [BLAST_RADIUS] field. Fail if any IRREVERSIBLE side effect has a null or 'unknown' blast radius.

Precondition and Guardrail Mapping

Each side effect is linked to the preconditions that must be met and any existing guardrails that would prevent or mitigate it.

A high-risk side effect (e.g., deleting a user) has no associated guardrail or precondition listed.

For each side effect rated CRITICAL or HIGH severity, assert that [PRECONDITIONS] and [GUARDRAILS] fields are populated. Fail if any are empty.

Severity and Risk Rating Consistency

Severity ratings (CRITICAL, HIGH, MEDIUM, LOW) follow a consistent rubric based on reversibility, blast radius, and data sensitivity.

Two side effects with identical characteristics (e.g., both delete a production record) receive different severity ratings.

Provide 3 pairs of similar side effects to the prompt. Fail if severity rating differs within any pair without a documented rationale in the [RATIONALE] field.

Approval Gate Recommendation Accuracy

The manifest correctly recommends an approval gate (AUTO_APPROVE, HUMAN_REVIEW, BLOCK) based on the side effect's severity and reversibility.

An IRREVERSIBLE, CRITICAL side effect is recommended for AUTO_APPROVE.

Check that all IRREVERSIBLE + CRITICAL side effects map to BLOCK or HUMAN_REVIEW. Fail if any map to AUTO_APPROVE.

Output Schema Validity

The manifest is valid JSON that conforms to the specified [OUTPUT_SCHEMA] without extra or missing fields.

The output is missing the top-level [SIDE_EFFECTS] array or contains malformed entries with string-type errors.

Validate the output against the [OUTPUT_SCHEMA] using a JSON Schema validator. Fail on any validation errors.

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Use the base prompt with a single frontier model. Remove the approval gate schema and replace it with a simple checklist. Focus on side-effect categories (state changes, external calls, data mutations) without strict field validation.

Watch for

  • The model may miss indirect side effects like log writes or cache invalidations
  • Without schema enforcement, output format will drift across runs
  • Low-risk plans may still trigger unnecessary caution language
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.