CCDV-F Agents and the Agent SDK Practice Question
A developer is building an agent using the Anthropic Python SDK. The agent's system prompt instructs it to answer questions about a company's internal policies by searching a vector database. The developer wants the agent to autonomously decide when to search and when to answer directly. Which combination of API features should the developer implement to achieve this?
⚠ Common exam trap
The trap here is assuming that tool use must be forced or pre-processed, rather than allowing the model to autonomously decide when to invoke a tool based on its instructions.
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
✓
Define a tool that queries the vector database, include it in the `tools` parameter of the Messages API request, and handle `tool_use` blocks in the response by executing the search and returning a `tool_result` block.
The correct approach is to define the vector search as a tool, include it in the request, and handle the tool_use/tool_result cycle. This enables the model to decide when to search based on the conversation, which is the core of agentic behavior with the Anthropic SDK. Other options either force tool use, embed excessive context, or bypass the model's decision-making entirely.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
Define a tool that queries the vector database, include it in the `tools` parameter of the Messages API request, and handle `tool_use` blocks in the response by executing the search and returning a `tool_result` block.
Why this is correct
This approach correctly uses the Messages API's tool use capability: the model autonomously emits a `tool_use` block when it needs to search, and the developer provides the result via a `tool_result` block. The agent decides when to invoke the tool based on the system prompt and conversation context, fulfilling the requirement for autonomous decision-making.
- ✗
Use the `system` parameter to embed the entire vector database content as context, allowing the model to answer directly without tool use.
Why it's wrong here
Embedding the entire vector database in the system prompt is impractical due to token limits and cost, and it does not allow the agent to dynamically retrieve relevant information. The system prompt should contain instructions, not the full knowledge base. This approach also fails to provide the autonomous search behavior requested.
- ✗
Implement a pre-processing step that always queries the vector database and appends the top result to the user's message before sending it to the model.
Why it's wrong here
This pre-processing approach removes the agent's autonomy: the search is performed unconditionally before the model sees the query, so the model cannot decide whether a search is needed. It also may append irrelevant results, and it does not leverage the model's ability to reason about when to use tools. The agent becomes a simple retrieval-augmented generation pipeline, not an autonomous agent.
- ✗
Set the `tool_choice` parameter to `{"type": "any"}` so the model always calls the vector search tool, and then parse the result to generate the final answer.
Why it's wrong here
Forcing the model to always call a tool with `tool_choice: {"type": "any"}` removes its ability to answer directly without searching. This contradicts the requirement for the agent to decide autonomously when to search. The agent would be forced to search even for questions it already knows the answer to, wasting resources and potentially degrading response quality.
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 →
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.