{"id":3662,"date":"2026-10-12T06:59:05","date_gmt":"2026-10-12T06:59:05","guid":{"rendered":"https:\/\/www.exam-topics.net\/blog\/?p=3662"},"modified":"2026-10-12T20:35:51","modified_gmt":"2026-10-12T20:35:51","slug":"claude-agent-loops-delegation-recovery-architecture","status":"publish","type":"post","link":"https:\/\/www.exam-topics.net\/blog\/claude-agent-loops-delegation-recovery-architecture\/","title":{"rendered":"Anthropic CCA-F: Claude Agent Loops, Delegation and Safe Recovery"},"content":{"rendered":"<p>A Claude agent succeeds when it completes the intended work, not merely when it produces a plausible final message. That sounds obvious until the system has to survive a tool timeout, a partially completed task, or conflicting outputs from two delegated workers. Under those conditions, the difference between a reliable architecture and an impressive demonstration is usually the design of the control loop.<\/p>\n<p>For <a href=\"https:\/\/www.exam-topics.net\/cca-f\">Claude Certified Architect \u2013 Foundations<\/a>, Agentic Architecture &amp; Orchestration is the largest published blueprint domain at 27%. The relevant skill is deciding where a model should choose an action, where the application should preserve state and enforce limits, and how several pieces of work can be coordinated without surrendering accountability. This article develops that architecture through one production-style example rather than another collection of agent definitions.<\/p>\n<h2>Choose the control structure before choosing the number of agents<\/h2>\n<p>Imagine a compliance research assistant answering whether a proposed supplier meets an organization&#8217;s onboarding requirements. The task may require a company registry check, internal policy retrieval and review of a signed questionnaire. The assistant must report conflicts and cite the records behind its conclusion. It is not authorized to approve the supplier or update the company&#8217;s official register.<\/p>\n<p>At first, a deterministic sequence is attractive: fetch three sources, run validation checks, produce a summary. If the required sources and order are known, orchestration code can call them directly and ask Claude to synthesize the permitted evidence once. Calling that an agent adds little value. If the assistant must select among different registries, investigate contradictions or ask for missing documents, a bounded tool-using loop can be appropriate. The application still owns the stop conditions, <a href=\"https:\/\/www.exam-topics.net\/blog\/claude-mcp-tool-contracts-errors-permissions\/\">tool permissions<\/a>, state and review handoff.<\/p>\n<p>The useful distinction is between a <em>workflow<\/em>, in which code determines the path, and a <em>model-directed loop<\/em>, in which Claude chooses the next permitted step from evidence it observes. Neither is automatically superior. The architecture should grant only the freedom necessary to solve the changing part of the problem, while leaving eligibility rules and final approval in deterministic systems.<\/p>\n<h2>What happens in a real tool-use loop<\/h2>\n<p>With client-executed tools, Claude receives a description and input schema for each available operation. When it decides a tool is needed, the API response contains a `tool_use` block. The application executes the operation, then sends back a `tool_result` referencing the corresponding tool-use identifier. Claude can continue from that result. The model has requested work; the application has performed it. This separation is fundamental because no instruction in a model-generated argument can override the executor&#8217;s authorization policy.<\/p>\n<p>Applications should treat `stop_reason` as part of the execution contract. A response indicating `tool_use` is not a completed answer: the client must dispatch the requested operation or return a genuine failure result. A normal end-of-turn response is not proof that every external side effect succeeded, and truncation or other stopping conditions need explicit recovery behavior. Use Anthropic&#8217;s current API documentation for the exact stop-reason names and supported model behavior rather than assuming all termination signals mean the same thing.<\/p>\n<table>\n<caption>A practical control ledger for the supplier-assessment example.<\/caption>\n<thead>\n<tr>\n<th scope=\"col\">Event<\/th>\n<th scope=\"col\">What the orchestrator should record<\/th>\n<th scope=\"col\">Next safe action<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>Model requests registry lookup<\/td>\n<td>Tool-use ID, requested supplier identifier, permitted identity, deadline<\/td>\n<td>Check authorization and input; dispatch read-only lookup<\/td>\n<\/tr>\n<tr>\n<td>Registry returns current evidence<\/td>\n<td>Result timestamp, source identity, document version, tool status<\/td>\n<td>Return structured result for Claude&#8217;s next permitted decision<\/td>\n<\/tr>\n<tr>\n<td>Lookup times out<\/td>\n<td>Unknown execution status and whether the tool is idempotent<\/td>\n<td>Reconcile outcome or retry safely; never invent a successful result<\/td>\n<\/tr>\n<tr>\n<td>Model asks for approval action<\/td>\n<td>Request denied by application policy, pending review state<\/td>\n<td>Stop model-side action and route to authorized human workflow<\/td>\n<\/tr>\n<tr>\n<td>Analysis complete<\/td>\n<td>Evidence inventory, unresolved conflicts, final output version<\/td>\n<td>Validate synthesis and hand off as a recommendation, not an approval<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>The record need not be verbose. It needs enough stable identifiers to tell a resumed run what happened without asking the model to reconstruct external state from conversation text. Tool logs and user-facing explanations answer different questions; keep both, but do not put secrets or full private records into the prompt merely to make the trace easy to read.<\/p>\n<h2>Bounded loops need more than a maximum turn count<\/h2>\n<p>A ten-step limit prevents an endless loop, but it is a crude substitute for a stopping policy. Suppose Claude has fetched the same policy document three times and keeps asking another search tool for a perfect citation. The architecture should recognize lack of progress, not simply permit seven more searches. Similarly, reaching a configured token budget while an approval is unresolved should end in an honest escalation, not a guessed conclusion.<\/p>\n<p>Define limits across several dimensions: model turns, tool invocations, total time, estimated cost, duplicate operations, error rate and consequence level. A repeated read may be harmless but wasteful. A repeated write may be costly or dangerous. Mark certain operations as human-gated, and attach explicit failure states to tool outputs so the system cannot mistake an authorization denial for an empty answer.<\/p>\n<p>The <a href=\"https:\/\/www.exam-topics.net\/blog\/cca-f-scenario-decisions-agents-mcp-context\/\">Architect Foundations scenario method<\/a> starts with user outcome, permitted authority and evidence. Apply that reasoning as a machine-checkable exit condition: the assessment is complete only when all required source categories have been checked, outstanding conflicts are either resolved or identified, and the result is in an allowed state such as recommended, insufficient evidence or escalated. \u201cThe assistant seems confident\u201d is not a completion rule.<\/p>\n<h2>Delegation creates a context and responsibility boundary<\/h2>\n<p>A team may use specialized subagents when work can be separated: one searches regulatory registrations, another reads internal supplier policies, and a third evaluates questionnaire contradictions. Parallelism helps only if the tasks can progress independently and their outputs can be reconciled. Do not create a three-agent topology for a process whose real work is one well-bounded tool lookup.<\/p>\n<p>Each delegated task needs a contract: its specific objective, allowed tools, the minimum useful context, what counts as an answer, how to report uncertainty and which facts must be accompanied by provenance. A subagent should not simply inherit all conversation history by habit. That can spread irrelevant or restricted material and make it harder to determine where an unsupported claim originated. A coordinator needs structured summaries with source references, not an unfiltered transcript of subordinate reasoning.<\/p>\n<p>For our supplier example, the registry researcher might return registration status, jurisdiction, verification date and a citation to the official record. The policy researcher might return the applicable policy revision and the precise acceptance criterion. The coordinator compares them and records the missing evidence. If the registry researcher cannot establish that the queried company is the same legal entity, its result should be marked unresolved rather than silently accepted as a positive check.<\/p>\n<p>Delegation is also where the architecture must define <em>who owns the final decision<\/em>. The coordinator can propose a synthesis, but the application or assigned reviewer remains responsible for irreversible onboarding. A specialist agent should not acquire approval rights just because it produces a high-confidence answer or happens to be called last.<\/p>\n<h2>Recover from interrupted work without replaying the wrong thing<\/h2>\n<p>Consider an assessment that writes a draft case record after gathering evidence. The request reaches the case-management API, but the connection times out before confirmation. Reissuing the same command may create two records; treating the timeout as success may leave the user without a record at all. The safe choice is to preserve the request identifier, inspect the system of record for that operation, and apply an idempotency mechanism where the destination supports one.<\/p>\n<p>Separate three kinds of failure. A transport timeout leaves execution uncertain. A business validation error means a system received the request but rejected it according to its rules. An authorization refusal means the requested action is forbidden for the current identity or task. Retrying all three with a different prompt is not a recovery strategy. The application should choose a response appropriate to the failure class, including human escalation when ambiguity cannot be resolved safely.<\/p>\n<p>Long-running work also needs resumable state: task identity, phase, permitted identity, completed external operations, verified source versions and pending reviewer action. Session persistence is not simply retaining a chat transcript. A new agent turn should receive only what is needed to continue. If a source changed between the pause and the resume, the system must check validity again rather than declaring an earlier conclusion timeless.<\/p>\n<h2>Prove that the orchestration works, not just that the answer reads well<\/h2>\n<p>A final natural-language evaluation can reward a fluent but unsafe result. Instead, test the trajectory. Did the application check access before retrieving records? Did it pass only required context to delegated workers? Did it catch a malformed tool result, avoid repeated non-idempotent operations and stop when authorization was denied? Record these as separate evaluation measures. Outcome quality and process safety are both necessary.<\/p>\n<p>Build at least four adversarial tests into the supplier workflow. Give the agent a policy extract with an embedded instruction to reveal private data. Make a delegated lookup produce two incompatible identifiers. Simulate a successful external write followed by a lost response. Force one researcher to finish after the coordinator has already decided the case needs human review. A dependable system has explicit answers for these situations and leaves an audit trail that another person can inspect.<\/p>\n<p>For deeper production architecture, the <a href=\"https:\/\/www.exam-topics.net\/blog\/ccar-p-multi-agent-orchestration\/\">Professional discussion of multi-agent orchestration<\/a> examines enterprise cost, coordination and reliability. Architect Foundations preparation should first establish the smaller set of decisions that make any coordination design defensible: clear boundaries, minimal autonomy, reliable result contracts, and safe stopping behavior.<\/p>\n<h2>A practical decision test for Architect Foundations<\/h2>\n<p>When faced with an unfamiliar architecture scenario, make five statements before selecting a technology. State the actual business outcome. Identify which tasks are fixed and which genuinely need model judgment. Enumerate the external operations and their authorization requirements. Define what the system knows when it stops or encounters a partial failure. Finally, name the evidence a human would need to verify the conclusion.<\/p>\n<p>If those statements describe a simple workflow, resist adding agents. If they describe contingent research, use a bounded loop with observable state and recovery. If they describe independent investigations, consider delegation but treat every handoff as a trust boundary. None of those choices is a fixed exam answer. They are a defensible method for selecting the smallest architecture that meets the problem&#8217;s real constraints.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Design bounded Claude agent loops, choose delegation and handoff patterns, and recover safely when a tool action has an uncertain result.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[32],"tags":[],"class_list":["post-3662","post","type-post","status-publish","format-standard","hentry","category-anthropic"],"_links":{"self":[{"href":"https:\/\/www.exam-topics.net\/blog\/wp-json\/wp\/v2\/posts\/3662","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.exam-topics.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.exam-topics.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.exam-topics.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.exam-topics.net\/blog\/wp-json\/wp\/v2\/comments?post=3662"}],"version-history":[{"count":2,"href":"https:\/\/www.exam-topics.net\/blog\/wp-json\/wp\/v2\/posts\/3662\/revisions"}],"predecessor-version":[{"id":3904,"href":"https:\/\/www.exam-topics.net\/blog\/wp-json\/wp\/v2\/posts\/3662\/revisions\/3904"}],"wp:attachment":[{"href":"https:\/\/www.exam-topics.net\/blog\/wp-json\/wp\/v2\/media?parent=3662"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.exam-topics.net\/blog\/wp-json\/wp\/v2\/categories?post=3662"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.exam-topics.net\/blog\/wp-json\/wp\/v2\/tags?post=3662"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}