Skip to content
Blog

Resilience for Orchestrators: Retries, Timeouts, and Circuit Breakers

Build enterprise-grade resilience into multi-agent orchestrators using retries, per-task timeouts, and circuit breakers with the Microsoft Agent Framework.

Published on September 11, 2026

AI Assistant

In distributed multi-agent systems, agents depend on external LLM APIs, vector databases, web scrapers, and third-party tools. Any of these dependencies can suffer intermittent rate-limiting, transient network degradation, or total service outages. If an orchestrator agent lacks fault tolerance, a single failing downstream tool will cause cascading failures across the entire multi-agent fleet.

Engineering production orchestrators requires enterprise resilience primitives: Exponential Backoff Retries, Per-Task Timeout Limits, and Circuit Breakers.

Core Fault-Tolerance Patterns for Agents

  1. Exponential Backoff with Jitter: Automatically retries transient 5xx or rate-limit (429) errors, adding randomized delay jitter to prevent thundering herd spikes.
  2. Per-Task Hard Timeouts: Enforces maximum execution windows (e.g., 15 seconds) on every agent sub-task to prevent hanging requests from blocking the orchestrator indefinitely.
  3. Circuit Breakers: Automatically opens (trips) when a downstream service error rate exceeds a threshold (e.g., 50% failures over 1 minute), fast-failing subsequent calls to avoid resource exhaustion until the service recovers.
[Orchestrator] --> [Circuit Breaker] --> (CLOSED) --> [LLM API / Tool]
                          |
                   (Error Threshold Exceeded)
                          v
                       (OPEN) --> Fast Fail / Degraded Fallback Mode

Implementing Circuit Breakers in Microsoft Agent Framework

Using Polly or native resilience policies within the Microsoft Agent Framework, we wrap agent delegates in fault-tolerant execution pipelines.

using System;
using System.Threading.Tasks;
using Microsoft.Agents.Core;
using Polly;
using Polly.CircuitBreaker;

public class ResilientAgentOrchestrator
{
    private readonly AsyncCircuitBreakerPolicy _circuitBreaker;
    private readonly AsyncPolicy _retryPolicy;

    public ResilientAgentOrchestrator()
    {
        // 1. Define Circuit Breaker: Trip after 3 consecutive failures for 30 seconds
        _circuitBreaker = Policy
            .Handle<Exception>()
            .CircuitBreakerAsync(
                exceptionsAllowedBeforeBreaking: 3,
                durationOfBreak: TimeSpan.FromSeconds(30),
                onBreak: (ex, breakDelay) => 
                    Console.WriteLine($"Circuit OPEN: Suppressing calls for {breakDelay.TotalSeconds}s due to: {ex.Message}"),
                onReset: () => Console.WriteLine("Circuit CLOSED: Service healthy again.")
            );

        // 2. Define Exponential Backoff Retry Policy
        _retryPolicy = Policy
            .Handle<HttpRequestException>()
            .WaitAndRetryAsync(
                retryCount: 3,
                sleepDurationProvider: attempt => TimeSpan.FromSeconds(Math.Pow(2, attempt))
            );
    }

    public async Task<string> ExecuteTaskWithResilienceAsync(Func<Task<string>> agentAction)
    {
        try:
        {
            // Execute action wrapped inside combined Retry + Circuit Breaker policy
            return await _retryPolicy.WrapAsync(_circuitBreaker).ExecuteAsync(agentAction);
        }
        catch (BrokenCircuitException)
        {
            // Fast-fail fallback response when circuit is open
            return "DEGRADED_MODE: External model or tool service is currently experiencing an outage. Operating in cached offline mode.";
        }
        catch (TimeoutException)
        {
            return "TIMEOUT_ERROR: Agent sub-task exceeded execution deadline.";
        }
    }
}

Best Practices for Orchestrator Fault Tolerance

  • Isolated Failure Domains: Isolate tool circuit breakers so that an outage in a web search API does not disable database query tools.
  • Surface Health Signals to Users: When an agent switches to degraded fallback mode due to an open circuit breaker, inform the user explicitly rather than failing silently.
  • Monitor Trip Telemetry: Emit metric counters (agent_circuit_breaker_tripped) to trigger ops alerts whenever a circuit breaker opens in production.

For detailed architecture guidance, state management patterns, and enterprise deployment options, check out the official Microsoft Agent Framework Documentation.