An agent is useful when the next step cannot be chosen reliably in advance. It might inspect a failed deployment, compare contradictory billing records or ask a tool for evidence that changes its initial assessment. That flexibility is also where risk enters: the model can choose an unnecessary tool, repeat an action after a timeout or produce a convincing answer before the work is finished. Good Claude architecture separates the model’s investigative freedom from the application’s authority to act. It defines which decisions are reversible, which require approval and which facts must survive a restart. The test is not how many tools an agent can call, but whether the system reaches a defensible result without losing control of the process.
A customer asks why a shipment was charged twice. A simple language-model call can draft a helpful explanation if the facts are already known. A fixed workflow can look up the order, apply a documented rule and send the case to a representative. An agent becomes useful when the system must decide which evidence to gather, discover conflicting records and adapt its next step. The distinction is not whether the interface feels intelligent. It is who decides the sequence of actions while the task is running.
A Claude agent can investigate a duplicate charge without receiving authority to settle it. It may collect transaction and shipment records, explain why their timestamps disagree, and recommend what evidence is still missing; a deterministic service must enforce the refund policy and record any authorized side effect. This boundary is a central architecture judgment in Anthropic CCA-F preparation: autonomy is valuable for examining uncertainty, while application code owns approvals, irreversible actions, and recovery after an ambiguous result. A successful agent is not simply one that finishes its conversation. It must leave a traceable account of what it learned, what it changed, and what it deliberately refused to do.
Choose the least autonomous design that works
The most consequential architecture decision happens before a tool is registered. If a request is bounded, the evidence is already available and there is no need to change course, a single model call can be sufficient. When a predictable series of checks must run every time, explicit application code provides better observability and simpler failure handling than asking a model to rediscover that sequence.
Agents earn their place when a system needs to choose tools, investigate uncertain evidence and revise a working hypothesis. Troubleshooting a failed deployment might require checking logs, inspecting configuration, identifying the most likely dependency and then selecting another diagnostic step. A fixed flow that anticipates every branch could become brittle. Even then, the agent should receive a narrow objective and operate within deterministic controls.
| Pattern | Appropriate task | Main failure to guard against |
|---|---|---|
| Single model call | Summarize a known incident report or classify a supported category. | Invented facts when evidence is missing. |
| Deterministic workflow | Validate a refund request through fixed eligibility and authorization checks. | Unhandled exceptions and incorrect business rules. |
| Single tool-using agent | Investigate an unfamiliar billing discrepancy across approved read-only systems. | Repeated calls, wrong tool choices or action without adequate evidence. |
| Orchestrator with specialists | Research independent compliance, engineering and account findings before synthesis. | Coordination overhead, contradictory findings and lost provenance. |
One common error is to treat the final row as the inevitable upgrade. It is not. Parallel agents can consume substantially more tokens and add new handoff and review steps. On a narrow task, a well-instrumented single agent can be safer and faster. The right Claude architecture depends on measured task quality, latency, cost and failure rate—not novelty.
Build a loop with observable stopping rules
A Claude tool-use agent normally moves through a simple control cycle: send a request, inspect the response, execute authorized client tools when requested, return their results and continue. The decisive signal is not whether the generated text sounds final. For applications using the Messages API, the response’s stop_reason communicates why the model stopped generating.
For example, tool_use means the application has client tool calls to handle; end_turn means Claude finished that assistant turn. A max_tokens stop is a truncation condition, not evidence of success. A pause_turn may require continuation of server-side work, and a refusal must be handled as a defined outcome rather than silently routed around. A production loop needs a distinct branch for each relevant condition instead of an indiscriminate retry.
# Simplified application control flow; not drop-in SDK code.
for step in range(MAX_STEPS):
response = ask_claude(conversation, approved_tools)
if response.stop_reason == "end_turn":
return validate_final_response(response)
if response.stop_reason == "tool_use":
calls = extract_client_tool_calls(response)
for call in calls:
check_authorization_and_side_effect_policy(call)
result = execute_with_timeout_and_audit(call)
conversation.add_matching_tool_result(call.id, result)
continue
if response.stop_reason == "max_tokens":
return escalate_incomplete_output()
return handle_other_stop_reason(response.stop_reason)
return escalate_step_budget_exceeded()
The pseudocode leaves out the exact message blocks and server-tool continuation protocol on purpose: those must follow the applicable current API contract. It illustrates where the application—not a prompt—owns the iteration budget, authorization decision, tool response matching and stop policy. If the model emits several client tool calls in one response, the application must account for every call and match the corresponding result to the proper tool-use identifier.
Real systems should also enforce elapsed-time, token and spending limits, plus tool-specific retry budgets. A retryable timeout on a read-only lookup differs from uncertainty after a payment or cancellation request. Repeating an action without an idempotency mechanism can create a second side effect. The correct result after exhausting a budget may be a concise handoff record containing what was verified, what remains unknown and what needs human attention.
Design tools and approvals around consequences
Give the agent capabilities that match its responsibility. In the billing example, get_order_status and get_payment_events are read operations. draft_resolution prepares a proposed next step. issue_refund changes customer and financial state; it therefore deserves tighter authorization, server-side policy enforcement and a recorded approval. Combining all of these inside a vague manage_account tool makes it harder to understand whether the model is merely investigating or about to act.
A tool contract should say what an operation returns, validate identifiers before access, and distinguish a lookup from an action that changes business state. A narrow MCP tool schema makes the capability discoverable and its inputs checkable, but the backing service must still reject requests outside the caller’s permissions. A descriptive interface reduces mistaken calls; it never grants authority to refund an account.
Failure responses should distinguish bad input, denied access, business-rule conflict and temporary infrastructure trouble. Each demands a different next step: correct an argument, stop, reconcile the business state or attempt a bounded retry. A defined tool recovery policy prevents the model from converting missing information into an unsafe repeated write.
Use Claude Agent SDK hooks or a corresponding interception layer where programmatic checkpoints are useful. For example, a pre-tool hook can block a prohibited operation or require a review token. But an application should not depend on the agent to honor a natural-language instruction such as “ask before refunding” when policy is mandatory. The actual refund service should validate identity, amount, eligibility, approval and idempotency independently of the model. Hooks improve enforcement at the orchestration boundary; service-side checks remain the final authority.
An operational approval should be a verifiable event, not a sentence the agent writes about itself. For the billing assistant, the application can record the request identifier, proposed operation, affected transaction, policy version, authenticated approver, approval scope and resulting execution identifier. The model may explain why a refund appears appropriate, but it cannot create a valid approval merely by returning the words ‘approved by manager.’ The tool gateway must verify that the approval applies to this transaction, this amount and this action before it changes financial state. That separation is particularly important when the same case resumes in a different session.
An agent’s stopping rule must account for evidence quality as well as the remaining number of turns. If two payment records conflict, a further lookup may be justified; if the only remaining step is an unauthorized write, another model call cannot make that write permissible. The system should stop with a precise unresolved state, such as payment evidence checked but settlement unconfirmed, and identify the next authorized action. This produces a case record a second operator can continue without reconstructing the model’s private assumptions or accidentally repeating a financial operation.
Delegate only when the work genuinely separates
Parallel research is a reasonable candidate for multiple agents. A lead coordinator might assign one worker to payment evidence, another to account history and a third to policy interpretation. Each worker can use a purpose-specific tool set and return a structured finding. The coordinator then checks contradictions, requests follow-up research only when necessary and makes the final synthesis.
But splitting work is worthwhile only if the subtasks can proceed with limited dependence on each other. If three workers repeatedly need the same evolving account state, their parallelism may create more stale information than useful speed. If a sensitive action requires a shared authorization decision, that should remain centralized rather than being delegated as a text instruction to multiple agents.
A coordinator receiving three polished summaries but no source identifiers cannot establish which explanation is correct. In multi-agent orchestration, each worker must return the question it investigated, supporting evidence, unresolved conflicts and a completion state. The lead agent then reconciles those findings and retains responsibility for any approval or action. Missing evidence remains an open issue, not implied agreement.
Keep durable state separate from the model’s context
Long-running investigations can exceed a single working session. The system needs to preserve an audit trail and a restartable task state even if the model’s conversation is compacted or a worker is restarted. Store the objective, relevant order identifiers, approval status, verified evidence, tool outcomes, idempotency keys and outstanding questions in an application-controlled record. Treat the transcript as useful context, not the only record of what happened.
When resuming an agent session, the application must recheck whether the underlying world changed. A quote may have expired, a payment status may have updated, or a manager may have revoked approval while the agent was idle. Simply replaying the previous plan is not a safe substitute for revalidating high-impact preconditions. Similarly, a forked investigation should carry forward explicitly approved context and source references rather than inheriting every unrelated tool result from another branch.
There is a difference between storing facts and keeping the model’s attention on the right ones. An accumulated transcript can contain abandoned hypotheses and outdated results. Effective context management preserves verified evidence separately from the conversation and retrieves only what the current decision requires.
Evaluate outcomes, not just fluent explanations
Before deploying an agent, decide which outcomes qualify as correct. A support agent that writes an excellent apology but refunds the wrong transaction has failed. So has an agent that arrives at the right answer by exposing restricted payment details. Evaluation must measure both the task result and the route used to reach it.
| Scenario | Expected behavior | Evidence to collect |
|---|---|---|
| Order facts disagree | Investigate the conflict or escalate; do not invent an explanation. | Source identifiers, conflict notes and escalation outcome. |
| Unauthorized refund request | Deny the write operation even if the model proposes it. | Authorization denial and unchanged transaction record. |
| Tool timeout | Apply a bounded retry only when the operation is safe to repeat. | Attempts, backoff, timing and final disposition. |
| Insufficient evidence | Stop and request missing information, not infinite research. | Termination reason, remaining unknowns and handoff. |
| Duplicate incoming request | Prevent a duplicate financial side effect. | Idempotency record and resulting state. |
Include normal cases, ambiguous requests, malformed tool results, prompt-injection attempts in retrieved text and deliberately adversarial cases. Track task completion, inappropriate-tool rate, unsafe-action blocks, human-escalation precision, token cost and latency. For probabilistic judgments, use repeatable evaluation fixtures and inspect failures qualitatively; an aggregate score can conceal a dangerous behavior that only appears in a minority of runs.
Evaluation also helps decide whether the architecture should be simpler. If a workflow meets the acceptance criteria with fewer calls and no unsafe writes, there is little reason to preserve an agent simply because its intermediate reasoning is impressive.
A practical design review: duplicate-charge support case
Suppose an account holder reports two charges for one shipment. The agent’s authorized goal is to assemble the relevant facts and recommend a resolution—not to refund automatically. It receives a read-only order tool, a payment-event lookup, a documented policy lookup, a strict call budget and an escalation path. It can compare identifiers, ask for the missing receipt and draft a proposed resolution. It cannot bypass the approval rule with a persuasive explanation.
A sensible sequence begins with the order and payment records. If they agree that one payment was captured and the other was only an authorization hold, the agent can explain the difference with a cited account event. If both were captured, it can prepare a candidate refund request with transaction identifiers and policy evidence. If the records disagree, it should record that disagreement and stop for manual review. These branches are grounded in observed records; they are not guesses about what usually happens in billing systems.
Only after authorization is checked and a human approval is recorded should a separate refund service perform the write, protected by an idempotency key. The agent then observes the authoritative transaction result instead of announcing success from its own proposal. If a network error hides that result, the system queries the transaction state before any retry. This example combines bounded autonomy, consequence-based tools, explicit state and evidence-led termination without needing a swarm of agents.
Architecture review checklist: Before accepting an agent design, confirm that you can answer these questions:
- What real uncertainty requires the model to select actions dynamically?
- Which tools can only read, and which can change business state?
- What observable signals end the loop, trigger escalation or indicate truncation?
- How do the app and tool services enforce budgets, permissions and approvals?
- Which evidence and decisions must persist when the session is resumed?
- Which adversarial and failure scenarios must pass before deployment?
The duplicate-charge example makes the governing distinction concrete: Claude may decide which evidence to request, but it cannot turn that evidence into spending authority. An accountable design can trace every lookup, explain why it stopped, and identify the person or service authorized to act. That remains the standard whether the investigation uses one tool, one agent or several specialists.