A GitHub Copilot agent calls an external MCP tool that intermittently fails with a timeout error. The agent currently crashes and abandons the task when this occurs. What should be implemented to improve resilience?
Select an answer to reveal the explanation.
Short Explanation and Infographic
A professional plumber doesn't pack up and leave when a fitting doesn't thread on the first try — they try again with a different approach, and if they still can't fix it, they call a specialist. Error handling in agents means: catch the error, log it, retry intelligently, and escalate if it persists.
Full explanation below image
Full Explanation
Robust agentic systems must handle tool failures gracefully without crashing or silently corrupting their outputs.
Why B is correct: Structured error handling is the correct approach. When a timeout occurs, the agent should: (1) catch the specific error type, (2) log it as a durable artifact so the team can investigate, (3) implement exponential backoff retry logic for transient failures, and (4) escalate to a human or alternative path if retries are exhausted. This keeps the agent operational and the team informed.
Why A is wrong: Context window size has no relationship to tool timeout errors. Timeouts are network or service-level failures, not context management issues.
Why C is wrong: Removing the tool eliminates the capability along with the error. If the tool provides necessary functionality, the solution is to make the agent resilient to the tool's failures, not to remove the tool.
Why D is wrong: Silently ignoring errors and continuing with incomplete data is dangerous. The agent's outputs may be wrong or misleading, and the team has no visibility into what went wrong. Silent failure is worse than loud failure in agentic systems.