Domain 1 of 3 · Chapter 13 of 22

Implement error handling in agent flows

Unlock the complete study guide + 1,040 practice questions across 16 full exams.

Bundled into the existing Designing and Building Integrated AI Agent Solutions in Copilot Studio premium course — no separate purchase.

14-day money-back guarantee — no questions asked.

Included in this chapter:

  • What breaks, and who needs to hear about it
  • Run after: the setting that creates a failure path
  • Try and Catch: making a transaction fail as one unit
  • Retry policies: the attempts nobody sees
  • The failures a retry cannot fix
  • The controlled error response
  • Logging enough, and not more
  • Terminate, and everything that has to happen before it
  • Telling an operator, without pretending it is an answer
  • How these choices show up in questions

Four mechanisms for one failing action

ConsiderationRun after branchTry and Catch scopesRetry policyTerminate
What it changesWhich action executes next, based on the previous action's outcomeThe unit that succeeds or fails, from one action to a whole blockHow many times the action itself is attempted before it is called failedWhether execution continues at all
Where you configure itRun after settings on the action that followsRun after settings on the Catch scope, pointing at the Try scopeSettings of the individual action being retriedAn action you add on the failure path
The fault it is forAny outcome you want a different next step for: failed, timed out, skipped, successfulA transaction whose steps are only meaningful togetherTransient faults: momentary network loss, temporary unavailability, busy-service timeoutsA nontransient failure with no valid path forward
What it costsOne branch to maintain per outcome you handleGranularity: a failed scope reports a single Failed status for the whole scopeElapsed time inside the synchronous response window, plus more calls to a service that may be throttlingEverything after it, which is why cleanup goes first
What the agent getsWhatever the branch you routed to maps into Respond to the agentWhatever the Catch path maps, if the response action is reachable outside the scopesNothing different: retries are invisible to the agent unless they exhaust the windowNothing, unless a response action ran before it

Decision tree

Did the service refuse the requeston a business rule?YesOrdinary output contracta decision, not a failureNoIs the fault transient: network blip,temporary unavailability, busy timeout?YesExponential retry policy on the actionsized to the response windowNoIs the fix a credential, a permission,or the request itself?YesRepair the connection or the actionno retry count can fix eitherNoIs committed work left half-done, ormust nothing else run?YesCompensate, record, respond, Terminatein that order, status FailedNoControlled error responsewith a code the topic can branch onOperational alerting runs alongside every branch here; it is never itself the branch.

Cheat sheet

  • Configure Run after for failure, timeout, and skipped outcomes
  • Group related actions into Try and Catch scopes
  • Return a controlled error contract when recovery is possible
  • Log actionable error context without excessive custom logging
  • Use exponential retry for transient connector faults
  • Do not retry permanent authentication or validation errors
  • Use Terminate after an unrecoverable flow error
  • Alert operators on repeated or critical flow failures

Unlock with Premium — includes all practice exams and the complete study guide.

Also tested in

References

  1. Handle transient faults recommendation for Power Platform workloads
  2. Agent flows overview - Microsoft Copilot Studio
  3. Employ robust error handling - Power Automate
  4. Use scopes to organize actions in cloud flows - Power Automate
  5. Organize your flows with scopes - Power Automate
  6. Create an agent flow as a tool - Microsoft Copilot Studio
  7. Troubleshoot a cloud flow - Power Automate
  8. Handle errors effectively - Microsoft Copilot Studio
  9. Understand flow failure notifications in Power Automate
  10. Set up Application Insights with Power Automate - Power Platform