CertSafari
    Databricks Certified Context Engineer Associate· Lessons

    Domain 1 · Lesson 5/45

    Attention budget: finding what crowds an agent's context

    Given a described agent configuration, identify which context elements are consuming disproportionate attention budget and select the change most likely to improve model focus.

    12 min read
    2.29% of exam
    5 sources
    Published 22 Oct 2026
    Docs as of 30 Sep 2026

    What you will be able to do

    • Explain why every token in context competes for the model's finite attention, and how low-value tokens dilute focus
    • Inventory an agent configuration into standing and accumulating elements and find which one dominates the budget
    • Spot redundant standing context across instructions, metadata and examples, and keep one copy
    • Match an overconsuming element to its one fix: fewer or staged tools, deduplicated instructions, fewer examples, or cleared history and retrieved content
    • Recognise when pruning cannot restore focus and the work needs to be split across agents

    Key concept

    Attention budget — The model has only so much attention for everything in its context window. Each token draws on that budget, so a token that carries little value for the current task takes focus away from the tokens that do.

    1.Every token competes for the same attention

    A model does not read its context the way a database reads a table, looking up only the rows it needs. On every call it attends over everything it has been given: the system prompt, every tool definition, every example, the conversation so far, and every retrieved chunk. That attention is finite. When ten thousand tokens of an unused tool catalogue sit beside two hundred tokens of the user's actual question, the question gets a smaller share of the model's focus than it deserves.

    This is the attention budget, and it is different from the context window limit. An agent can be far below its token limit and still answer badly, because the relevant material is outnumbered by material that is merely present. Budget pressure also builds on every turn, since an agent loop sends the accumulated context back to the model each time. Databricks describes Genie Code this way: each turn re-sends the whole chat's context, so the twentieth message costs more than the first.

    Genie Agents show one platform's response to the same pressure. As a space approaches its token limit, Genie filters context to prioritise what it judges most relevant, and the troubleshooting guide warns that answer quality can drop if something important gets filtered out. The lesson generalises even though the mechanism does not. When low-value context is crowding the window, something valuable loses out, whether a filter drops it or the model's attention simply passes over it.

    Checkpoint 1 of 5· Check yourself

    An agent uses about 12,000 tokens of a 128,000-token context window. Most of that is a catalogue of tool definitions it rarely calls, alongside a user question of about 200 tokens. Its answers keep drifting off the question. Which change is most likely to bring back its focus?

    Sources12

    2.Inventory the configuration and find the dominant element

    Diagnosis starts with an inventory. Split everything that reaches the model into two groups, because they grow differently and need different fixes:

    • Standing context is loaded before any work starts and is the same on every call: system prompt instructions, tool definitions, few-shot examples, and table or column metadata.
    • Accumulating context grows as the agent works: conversation history, raw tool outputs, and retrieved chunks.
    • The task itself is the user's request and whatever the current step needs. Everything else is judged by how much it helps this.

    Per-call token counts from MLflow Tracing tell you which group to look at. MLflow records token usage on each LLM span, so you can read input tokens call by call through a trace. Two patterns are worth recognising. If the first call is already heavy, before the agent has done anything, the cost is standing context. In a tool-calling agent the usual culprit is tool definitions, because every schema is loaded whether or not the task needs it (Upfront tool-schema cost explains why). If input tokens climb with each turn, accumulating context is to blame, and stale tool outputs left in history are the first thing to check (Which raw tool outputs can be cleared).

    Reading input and output tokens for each LLM call in an MLflow tracepython
    # Print the token usage for each LLM call
    print("\n== Detailed usage for each LLM call: ==")
    for span in trace.data.spans:
        if usage := span.get_attribute("mlflow.chat.tokenUsage"):
            print(f"{span.name}:")
            print(f"  Input tokens: {usage['input_tokens']}")
            print(f"  Output tokens: {usage['output_tokens']}")
            print(f"  Total tokens: {usage['total_tokens']}")

    Span counts show which call is heavy, not which element inside it. To break the cost down by element, you read the configuration itself. The rule for choosing what to cut is to remove or shrink the largest low-value element first, and both words matter. A twelve-thousand-token retrieved contract that contains the answer is large but valuable. Eight thousand tokens of schemas for tools the task never calls are large and nearly worthless. Cut the second.

    Checkpoint 2 of 5· Check yourself

    A contract-review agent answers poorly. One LLM call holds a 9,000-token retrieved contract that contains the clause the user is asking about, 8,000 tokens of schemas for 30 tools (the task uses 2 of them), a 1,500-token system prompt and a 200-token question. Which change should come first?

    Sources3

    3.Redundant standing context: keep one copy

    Redundancy is the cheapest cut because it removes tokens without removing information. Standing context accumulates duplication over time. A rule gets written into the system prompt, then repeated in a tool description, then shown again in three examples that all demonstrate the same thing. Each copy costs tokens on every call and teaches the model nothing the first copy did not.

    Duplication shows up in three standard places:

    • Metadata that restates names. A column called account_name with the description "the name of your account" adds tokens and nothing else. Keep descriptions that add meaning, such as units, valid values or business definitions, and drop the ones that repeat the name.
    • Examples that overlap. Twelve examples of four patterns carry roughly the information of four. Keep one example per distinct pattern, and keep variety rather than count.
    • Instructions repeated across layers. If the system prompt and a tool description both state the same rule, keep it where the model needs it at decision time and delete the other copy.

    Columns the agent never uses belong to the same family of waste. They are not duplicates, but they take budget without informing the answer. Databricks recommends creating views or hiding columns in a Genie space so the model never sees them.

    Checkpoint 3 of 5· Check yourself

    You are trimming a Genie space's column metadata to free attention budget without losing information. Which column description should you keep?

    Sources2

    4.Match each overconsuming element to its change

    Once you know which element dominates, the fix is close to fixed. Each overconsuming element has one change that targets it, and a change aimed at the wrong element leaves the budget problem in place. A better compaction prompt does nothing for a bloated tool list, and removing tools does nothing for a history full of stale query results.

    Overconsuming element, how it shows up, and the change that targets it
    Overconsuming elementTypical sign in the configurationChange most likely to restore focus
    Tool definitionsHeavy first call; dozens of tools, most unused by the task; wrong tool pickedFewer tools, or staged tool loading
    Instructions and metadataThe same rule in several places; descriptions that repeat column namesDeduplicate and keep one copy; simplify wording
    Few-shot examplesMany examples covering the same few patternsFewer examples, one per distinct pattern
    Conversation history and tool outputsInput tokens climb each turn; old results the task no longer needsClear stale history; start a fresh session
    Retrieved contentMany chunks per query, most irrelevant to itRetrieve less, or clear chunks once used

    Tools deserve the closest look because their failure is visible. An agent with too many tools to choose from does not only spend tokens. It picks the wrong one, as the BASF Coatings team found when its agents grew. Accumulated history is the other common offender, and the Genie guidance is direct: when responses turn slow or fail, start a new chat rather than adding more instructions to the old one.

    Checkpoint 4 of 5· Match them up

    Each symptom below points to a different element that is taking too much of an agent's attention budget. Match each symptom to the change that targets that element.

    Tap a term, then the definition that fits it.

    Sources24

    5.When pruning cannot restore focus

    Sometimes nothing can be cut without breaking something. A single agent that serves finance, operations and marketing really does need all three tool sets, all three instruction blocks and all three example sets, so every element is high-value for some request and low-value for most others. Pruning stops working at that point, because the problem is no longer waste. It is too many concerns sharing one context.

    The change then is structural: give each concern its own agent and its own context, so each one carries only the tools, instructions and examples its domain needs. Recognising that boundaries were drawn too wide is covered in Under-split agent boundaries. What this lesson adds is the trigger. Split when the dominant element is legitimately needed by part of the workload, and prune when it is not.

    Checkpoint 5 of 5· Check yourself

    One agent handles finance, operations and marketing requests. Its instructions have already been deduplicated, and each domain's tool set, instruction block and example set is used by that domain's requests and ignored by the others. It still loses focus. What is the best next step?

    Sources5

    Sources

    (5)

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

    1. 1.
      “Each turn re-sends the whole chat's context to the model”
      ↩︎ Every token competes for the same attention
      “The goal is to keep each chat's context relevant to the task at hand.”
      ↩︎ Key concept
    2. 2.
      “Genie uses context filtering to prioritize the tokens it considers most relevant to a question.”
      ↩︎ Every token competes for the same attention
      “quality may be reduced if important context is filtered out”
      ↩︎ Every token competes for the same attention
      “avoid duplicating information already conveyed by column names”
      ↩︎ Redundant standing context: keep one copy
      “Unnecessary columns in your tables can significantly contribute to token usage.”
      ↩︎ Redundant standing context: keep one copy
      “Start a new chat if Genie starts to generate slow or failing responses.”
      ↩︎ Match each overconsuming element to its change
      “Review your instructions and try to focus the agent by removing irrelevant tables or instructions.”
      ↩︎ Exam trap 1
      “avoid duplicating information already conveyed by column names”
      ↩︎ Exam trap 2
      “Start a new chat if Genie starts to generate slow or failing responses.”
      ↩︎ Exam trap 3
      “Review your instructions and try to focus the agent by removing irrelevant tables or instructions.”
      ↩︎ Checkpoint
      “Review your instructions and try to focus the agent by removing irrelevant tables or instructions.”
      ↩︎ Checkpoint
      “Include a diverse range of example SQL queries to cover various types of questions, but remove overlapping or redundant examples.”
      ↩︎ Prediction
    3. 3.
      “The total token usage throughout the trace is available in the token_usage field of the trace info object.”
      ↩︎ Inventory the configuration and find the dominant element
    4. 4.
      “an agent can have too many tools at its disposal and make poor decisions about which tool to call next”
      ↩︎ Match each overconsuming element to its change
    5. 5.
      “You still need carefully designed prompts and constraints to keep the agent focused and relevant.”
      ↩︎ When pruning cannot restore focus
      “If your application spans radically different sub-domains (finance, devops, marketing, etc.), a single agent can become unwieldy or overloaded with functionality requirements.”
      ↩︎ When pruning cannot restore focus
      “If your application spans radically different sub-domains (finance, devops, marketing, etc.), a single agent can become unwieldy or overloaded with functionality requirements.”
      ↩︎ Exam trap 4

    Ready to test yourself?

    Practise Databricks Certified Context Engineer Associate in quiz mode.

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