CertSafari
    Anthropic Claude Certified Architect – Foundations (CCAR-F)· Lessons

    Domain 5 · Lesson 25/30

    Position Effects and Structured Subagent Outputs

    Manage conversation context to preserve critical information across long interactions

    9 min read
    2.5% of exam
    5 sources
    Published 4 Oct 2026
    Docs as of 30 Sep 2026

    What you will be able to do

    • Explain the lost-in-the-middle effect and how it changes the way you lay out long inputs
    • Organize aggregated inputs with key findings first, explicit section headers and source metadata
    • Specify subagent outputs that carry dates, sources and method context for downstream synthesis
    • Change upstream agents to return compact structured data instead of verbose reasoning when a downstream agent has a tight budget

    1.The lost-in-the-middle effect

    Context rot describes recall dropping as total length grows. The lost-in-the-middle effect adds that the drop is uneven across positions. Anthropic Academy compares it to the human serial position effect: items at the start of a list benefit from primacy and items at the end benefit from recency. The Academy page reports that language models show the same pattern. In a 2023 Stanford study, accuracy was highest when the key fact sat at the very beginning or very end of a long context, and fell by more than 30% when the fact was in the middle. The page attributes this to how attention works: transformer attention gives more weight to the edges of the context window.

    This matters most when an agent aggregates results. A coordinator that pastes eight subagent reports one after another has put reports three to six in the weakest positions. A finding that appears only in report five is the one most likely to be left out of the final synthesis, even when everything fits easily in the window.

    Checkpoint 1 of 5· Check yourself

    A coordinator joins six subagent reports in the order they arrived. The final synthesis keeps leaving out a finding that only appears in the fourth report. What is the best diagnosis?

    Sources1

    2.Laying out aggregated inputs to work with position

    You can't get rid of position effects, but you can choose what goes in the strong positions. Start the aggregated input with a short summary of the key findings, so the conclusions most likely to be needed sit where attention is strongest. Then put the detailed results under explicit section headers, one per source or subtask, so each finding is clearly separated rather than lost in continuous text.

    Anthropic's prompting guidance supports this layout for inputs over about 20k tokens. Put the long material near the top, above the query and instructions. Wrap each document in its own tags with a source subtag and any other metadata. For long-document tasks, ask Claude to quote the relevant passages before answering, which helps it focus on the parts that matter. Note that this guidance puts the query at the end, after the documents, so a findings summary at the top and the question at the bottom fit together.

    One document entry from Anthropic's multi-document structure: content plus a source tagxml
    <documents> <document index="1"> <source>annual_report_2023.pdf</source> <document_content> {{ANNUAL_REPORT}} </document_content> </document>

    Checkpoint 2 of 5· Check yourself

    Which layout best reduces position effects for a 40k-token aggregated research input?

    Sources2

    3.Subagent outputs must carry their metadata

    A coordinator can only synthesize accurately if it can tell where each claim came from and how old it is. When a subagent returns a paragraph of conclusions with no dates or sources, the coordinator has nothing to go on when two subagents disagree. It can't tell which price is current or which source is more authoritative. The fix belongs in the delegation instructions. Anthropic's multi-agent research write-up says every subagent needs an objective, an output format, guidance on tools and sources, and clear task boundaries. The output format should require metadata alongside each finding: the date of the information, the source location, and the method used to get it.

    This is the same principle as the source tags in the multi-document prompt structure, applied to agent-to-agent handoffs. The research system goes further at the end: a dedicated citation agent matches each claim in the report to a specific location in the sources. That step only works if the source information made it through every handoff before it.

    Checkpoint 3 of 5· Exam question

    A returns-processing agent calls an order-lookup tool that returns a JSON payload with 40+ fields (shipping carrier metadata, internal warehouse codes, marketing tags, etc.) for every order it checks, and after a dozen lookups the raw payloads dominate the context window even though only 5 fields (order status, purchase date, item, amount, return-window deadline) matter for return eligibility. What should the agent do before adding each lookup result to context?

    Checkpoint 4 of 5· Check yourself

    Two pricing subagents report different prices for the same product, and the orchestrator can't decide between them. Which change to the subagent output format fixes this most directly?

    Sources32

    4.Return structured data, not reasoning chains

    The other half of the subagent contract is size. A subagent may use tens of thousands of tokens exploring a problem, but in Anthropic's description it returns only a condensed summary, often 1,000 to 2,000 tokens. That keeps the detailed search work inside the subagent and the coordinator's context free for synthesis. If a downstream agent has a limited budget, change the upstream agents to return key facts and citations as structured data instead of their full reasoning and verbose content. The narrative of how a subagent got there costs the coordinator tokens and adds nothing to the synthesis. (The exam guide also lists relevance scores as an output field. None of the sources here discuss them specifically.)

    For large artifacts, the multi-agent research system goes a step further. Subagents save their output to external storage and pass lightweight references back to the coordinator. This avoids the token cost of copying large outputs through conversation history and reduces information loss across stages. In all of these cases the goal is the same: make each token that reaches the downstream agent carry information it needs.

    Checkpoint 5 of 5· Check yourself

    A synthesis agent with a small context budget gets full reasoning traces from five research subagents and starts missing findings. What is the best upstream change?

    Sources435

    Exam traps

    Each one states something that sounds right. Open it to see what is actually true.

    1. 1.If every subagent report fits in the context window, the model will weigh all of them equally.Why is that wrong?

      Fitting in the window doesn't mean getting equal attention. Content in the middle of a long input is the most likely to be missed.

      Covered in The lost-in-the-middle effect

    2. 2.Subagents should return only clean conclusions. Dates and sources are clutter the coordinator doesn't need.Why is that wrong?

      Without source and date metadata the coordinator can't settle conflicting findings, and claims can't be attributed to their sources.

      Covered in Subagent outputs must carry their metadata

    Practise it for real

    Turn on tool result clearing for a tool-heavy agent while protecting the tool that holds case facts

    1. 1.Send a request with context_management={"edits": [{"type": "clear_tool_uses_20250919"}]} and the context-management-2025-06-27 beta header

      Why: With only the type set, clearing starts at the default trigger of 100,000 input tokens and keeps the last 3 tool uses

      You should see: A normal response. Clearing only starts once the prompt passes the trigger

    2. 2.Add trigger, keep and exclude_tools to the edit, listing your case-facts or memory tool in exclude_tools

      Why: exclude_tools ensures the results your facts depend on are never cleared

      You should see: In a long run, old results from other tools are replaced with placeholder text, and the excluded tool's results stay in full

    3. 3.Compare the usage field on responses before and after clearing starts

      Why: Every response reports how many tokens the request used

      You should see: Input token counts drop once clearing starts, while your local history stays complete

    Stuck? Get a nudge

    If you also use prompt caching, set clear_at_least so each clear frees enough tokens to justify invalidating the cache.

    Sources

    Every claim above is drawn from one of these pages, quoted as it was written on the date shown.

    1. 1.
      “Items at the beginning of a list benefit from primacy”
      ↩︎ The lost-in-the-middle effect
      “Transformer attention patterns naturally weight the edges of the context window more heavily.”
      ↩︎ The lost-in-the-middle effect
      “the model is more likely to miss it than something on page 1 or page 20”
      ↩︎ Exam trap 1
      “the model is more likely to miss it than something on page 1 or page 20”
      ↩︎ Prediction
    2. 2.
      “wrap each document in <document> tags with <document_content> and <source> (and other metadata) subtags for clarity”
      ↩︎ Laying out aggregated inputs to work with position
      “ask Claude to quote relevant parts of the documents first before carrying out its task”
      ↩︎ Laying out aggregated inputs to work with position
      “wrap each document in <document> tags with <document_content> and <source> (and other metadata) subtags for clarity”
      ↩︎ Subagent outputs must carry their metadata
      “Place your long documents and inputs near the top of your prompt, above your query, instructions, and examples.”
      ↩︎ Checkpoint
    3. 3.
      “Each subagent needs an objective, an output format, guidance on the tools and sources to use, and clear task boundaries.”
      ↩︎ Subagent outputs must carry their metadata
      “This ensures all claims are properly attributed to their sources.”
      ↩︎ Subagent outputs must carry their metadata
      “pass lightweight references back to the coordinator”
      ↩︎ Return structured data, not reasoning chains
      “This ensures all claims are properly attributed to their sources.”
      ↩︎ Exam trap 2
    4. 4.
      “returns only a condensed, distilled summary of its work (often 1,000-2,000 tokens)”
      ↩︎ Return structured data, not reasoning chains
      “the detailed search context remains isolated within sub-agents, while the lead agent focuses on synthesizing and analyzing the results”
      ↩︎ Checkpoint
    5. 5.
      “This makes curating what's in context just as important as how much space is available.”
      ↩︎ Return structured data, not reasoning chains

    Spotted a mistake, or was something unclear? Tell us.