New Tool Radar

AI Agents & Automation

How to Test an Agent Approval Path by Rejecting Once

Test an agent approval path by rejecting a request once, so you can prove the risky step does not run on a no.

Schematic with three steps: Pick a harmless request and pause it; Reject it and watch the risky step; Approve a second run to confirm the.

Most approval paths are tested only on the approve side: someone clicks yes, the step runs, and everyone assumes the no side works too. It often does not, because the reject branch was never run. LangGraph’s approve-or-reject pattern is explicit: resume with true to approve or false to reject, and the graph must handle both. Test the no side on purpose, with a harmless request, and confirm the risky step does not run and the run ends or routes elsewhere cleanly. An approval path you have only approved is half tested.

What you need

  • An agent run that already pauses for approval
  • A harmless request that needs approval, for example a test write
  • A person ready to reject it once

Step 1: Pick a harmless request and pause it for approval

Choose a request whose rejection costs nothing, such as a test record write, and run the agent until it pauses for approval.

Step 2: Reject it and watch the risky step

Reject the request and confirm the risky step does not run, the run ends or routes to a safe path, and no partial write is left behind.

Step 3: Approve a second run to confirm the yes side still works

Run the same request again and approve it, confirming the step runs normally. A test that only checks rejection may have broken approval.

Worked example: synthetic reject test

The table below is a synthetic example. It shows the expected result of the reject test; no agent was run.

Check Expected Result
Run pauses for approval Yes Pass
Reject runs the risky step No Pass
Run ends cleanly on reject Yes Pass
Approve on the second run works Yes Pass

Expected result (UNTESTED). the rejected run skips the risky step and ends cleanly, and the approved second run works normally. This check was not run live; the table shows the expected result for the synthetic example.

Limits

  • A reject test needs a harmless request; do not test rejection on a real customer action.
  • Rejection must leave no partial write behind, so check the external system afterwards.
  • Testing only the approve side leaves the reject branch unproven.
  • A run that ends on rejection should tell the requester why, not just stop.

Sources

See all