Courseiva
Agents and the Agent SDK →mediumMultiple Select

CCDV-F Agents and the Agent SDK Practice Question

When designing agentic loops with the Anthropic SDK, which TWO practices help prevent infinite tool-use cycles? (Select exactly 2)

⚠ Common exam trap

Candidates focus on complex logic to 'fix' the agent mid-loop, ignoring that simple constraints like hard limits or specific termination tools are the most effective ways to prevent infinite recursion.

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

✓

Implementing a hard limit on the number of sequential tool calls.

Preventing infinite loops is crucial for cost management and system stability. By enforcing step limits and providing clear stop conditions, developers ensure the agent acts as a bounded processor. These patterns are fundamental to building predictable AI agents that fulfill user requests without falling into recursive tool-calling patterns that exhaust token budgets and latency thresholds.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✓

    Implementing a hard limit on the number of sequential tool calls.

    Why this is correct

    Tracking the iteration count and forcing termination after a defined threshold prevents the agent from infinitely searching or processing data. This is a standard safety pattern that protects your infrastructure from runaway costs and ensures the agent provides an answer even if imperfect.

  • ✓

    Providing the agent with a 'terminate' or 'no-op' tool.

    Why this is correct

    Giving the agent an explicit mechanism to acknowledge that no further actions are necessary provides a clear exit path. When the agent recognizes its task is complete, it invokes the termination tool, signaling the orchestrator to stop the loop and return the final result.

  • ✗

    Increasing the max_tokens parameter to allow longer reasoning.

    Why it's wrong here

    Increasing token limits does not solve infinite loops; it only delays their impact while increasing costs. More tokens provide more space for the agent to continue its cycle, potentially worsening the effect of an unconstrained loop rather than resolving the underlying logical issue.

  • ✗

    Using a higher temperature to encourage creativity.

    Why it's wrong here

    Higher temperature increases randomness, which is generally detrimental when trying to control agent behavior. It makes the model less likely to follow a deterministic stopping pattern, potentially increasing the likelihood of erratic tool usage and unintended recursive behavior in complex workflows.

  • ✗

    Caching all tool outputs for faster retrieval.

    Why it's wrong here

    Caching improves performance but does not address the logic of the loop itself. If the agent is trapped in a logical cycle, caching the output will simply provide the same input or output faster, without helping the agent realize it should stop acting.

About these practice questions

This CCDV-F question is part of Courseiva's 257-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

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 CCDV-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 CCDV-F exam.