CCAR-F Agentic Architecture and Orchestration Practice Question
When designing an autonomous agent loop using Claude 3.5 Sonnet that involves tool use, which TWO strategies are most effective for preventing the agent from entering an infinite loop when a tool returns an error?
⚠ Common exam trap
Candidates often ignore the need for hard limits, assuming the model will eventually 'figure it out,' which leads to infinite loops and massive token waste in production environments.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Set a strict 'max_iterations' counter in the application logic
Infinite loops in agentic workflows typically occur when an agent repeatedly attempts the same failing action without a strategy change. Implementing a maximum iteration limit provides a hard stop for safety, while providing explicit error feedback in the tool result allows Claude to reason about the failure and attempt a different logical path rather than repeating the same error.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
Set a strict 'max_iterations' counter in the application logic
Why this is correct
A hard-coded iteration limit in the orchestration code ensures that the agent cannot run indefinitely, regardless of the model's behavior. This acts as a critical safety circuit-breaker in production systems to control costs and prevent resource exhaustion when the agent fails to converge on a final solution.
- ✗
Increase the temperature setting to 1.0 to encourage varied tool calls
Why it's wrong here
Increasing temperature can lead to more stochastic and unpredictable behavior, which often makes debugging agent loops significantly more difficult. In an agentic tool-use context, higher temperature might actually increase the likelihood of the model hallucinating tool parameters or failing to follow the schema, potentially exacerbating the looping problem.
- ✓
Include the specific error message in the 'content' field of the tool_result
Why this is correct
Returning the actual error message to Claude enables the model's reasoning capabilities to diagnose the failure. When the model sees that a specific parameter or value caused an error, it can adjust its next tool call to fix the issue, which is the standard way to handle recovery in agentic loops.
- ✗
Use a system prompt that strictly forbids the model from repeating itself
Why it's wrong here
While negative constraints in system prompts can sometimes help, they are often brittle and can be ignored by the model during high-complexity tasks. Relying solely on prompting to prevent loops is less reliable than architectural safeguards like iteration limits or providing the model with specific technical feedback via tool results.
- ✗
Enable prompt caching for every message in the tool-use conversation
Why it's wrong here
Prompt caching is a performance and cost optimization tool that reduces latency for long-running conversations. While it is highly beneficial for multi-turn agentic workflows, it has no impact on the logical behavior of the model and does nothing to prevent or detect infinite loops during the tool-use execution phase.
About these practice questions
One of 271 original CCAR-F practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written and reviewed by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
Last reviewed September 2026 · checked against the official Anthropic exam blueprint
This CCAR-F practice question is part of Courseiva's free Anthropic certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the CCAR-F exam.