Your team is building a multi-step document processing application that needs to extract structured data from PDFs, validate the extracted content against business rules, and then route documents to different approval workflows based on content type. You are evaluating whether to use an agent or a workflow architecture.Which of the following factors should most strongly influence your decision toward using an agent rather than a workflow?
Answer(s): A
Agents excel at handling dynamic, unpredictable scenarios where the system must adapt its behavior based on emerging patterns and make autonomous decisions. In this scenario, the need for dynamic routing based on document variations that weren't pre-defined is a key indicator that an agent's iterative decision-making loop would be more appropriate than a rigid workflow.The other options point toward workflow characteristics: deterministic sequences (workflows), strict audit requirements (workflows provide better determinism and traceability), declarative step-by-step orchestration (workflows by design), and caching concerns (an optimization orthogonal to the agent vs. workflow choice). Agents are more flexible but less predictable and auditable, while workflows provide explicit control and repeatability.
You are implementing a Claude agent using a custom agent loop that needs to call external APIs, process tool outputs, and make decisions about when to stop iterating. Your team wants to ensure that certain high-risk actions—such as deleting records or transferring funds—always require explicit human approval before execution.Which combination of approaches best implements this safety requirement within a Claude agent architecture?
Claude hooks provide a mechanism to intercept and modify agent behavior at runtime, making them ideal for implementing deterministic safety controls. Combining hooks with an approval tool ensures that high-risk actions are paused, visible to a human, and only proceed with explicit approval. This is a best-practice pattern for guardrails in agentic systems.Relying on system prompt instructions alone is insufficient because models can be misled or jailbroken. Removing tools entirely eliminates functionality. Post-execution logging is a detective control, not preventive. Sub-agent hierarchies add organizational structure but don't inherently prevent the supervisor from approving dangerous actions without additional approval logic—hooks provide that deterministic enforcement layer.
Your team is optimizing the cost of a Claude application that makes thousands of API calls daily to process customer support tickets. The tickets often reference common company policies and product information that rarely changes. You have identified that about 40% of tokens in each request are spent transmitting this stable reference material.Which of the following techniques would most effectively reduce costs in this scenario, and what is the primary reason?
Prompt caching is specifically designed to address this cost optimization scenario: when the same prefix of tokens appears repeatedly across requests, Claude stores a cached version and charges a significantly reduced rate (90% discount) for cache hits. With 40% of tokens being stable reference material, caching directly targets the waste and provides immediate cost savings across those thousands of daily calls.Model switching (Haiku) reduces per-token cost but still charges full price for each token transmitted, including the reference material. Batch processing offers discount only when latency is not a concern and doesn't solve the repeated transmission problem. Truncating context either loses important information or requires sophisticated summarization logic. RAG is a valid architectural alternative but introduces database infrastructure, latency, and complexity; it's not a simple optimization for the existing prompt-based approach.
MULTIPLE CHOICEYour Claude application needs to validate user input before sending it to the Claude API to prevent prompt injection attacks. You are designing input sanitization logic and have identified that users will provide unstructured text from various sources, including customer feedback, external emails, and user-uploaded documents.Which of the following strategies should be part of your defense-in-depth approach? (Select all that apply.)
Answer(s): A,B,D
Effective prompt injection defense requires multiple layers. Character filtering/escaping (option 1) prevents attackers from using structural delimiters. Whitelisting (option 2) is stricter than blacklisting and reduces the attack surface, though it may constrain legitimate use cases. Role-based access control (option 4) is part of the defense-in-depth principle—limiting who can submit input and auditing submissions ensures accountability and reduces attack vectors.Option 3 is incorrect because Claude's safety measures are content filters for output, not input validation, and they cannot be relied upon as the sole defense against prompt injection. Option 5 (ML classifiers) is not a standard recommendation for prompt injection defense because injection attacks often mimic legitimate instructions, making ML detection unreliable and adding latency without deterministic guarantees. The best approach combines explicit input validation at the application layer (sanitization, whitelisting) with identity and access controls.
You are building a Claude application that uses an MCP server to connect to a company's internal database and expose a set of tools for querying customer records. The MCP server runs as a separate process and communicates with your Claude application over stdio. During testing, you notice that database queries occasionally fail due to network timeouts or database unavailability.Which of the following error handling and recovery strategies should be implemented at the tool level to ensure the agent can respond gracefully?
The correct approach is to handle errors at the tool layer where context about the failure is available. The MCP server tool should catch exceptions, return structured error information to Claude, and allow Claude's agentic logic to decide the best recovery strategy (retry with different parameters, use cached results, or inform the user). This maintains the separation of concerns and gives the agent visibility into what went wrong.Automatic stdio retries without Claude awareness can cause unexpected delays and duplicate operations. Circuit breaker logic (option 3) prevents cascading failures but is typically implemented at infrastructure layers, not at the tool level, and a fixed 10-minute block may be overly aggressive. System prompt instructions (option 4) cannot reliably enforce timeouts or retry logic—the model cannot control socket-level behavior. Hardcoding connection strings (option 5) introduces security risks and tight coupling; tools are designed to abstract external system details.
Post your Comments and Discuss Anthropic CCDV-F exam prep with other Community members: