Skip to content

Optimize Context Window

Context tuning is an operator workflow once the runtime supports the relevant policy fields. Use the Admin Console first so you can see the agent, make a small edit, validate it, and preview a long conversation before saving.

Agent editor Advanced tab showing context window policy fields, compaction mode, autocompact threshold, and preview chat.
Open the agent editor, review the draft, then use Advanced/JSON preview for context-policy changes.
  1. Open Agents and choose the agent that is hitting context limits.
  2. Check Basics for model choice and max rounds. A different model or lower max rounds may solve the issue before policy tuning.
  3. Open Advanced and review the final draft shape.
  4. Adjust the context policy fields your server exposes for the agent.
  5. Click Validate.
  6. Use preview chat with a long scenario: several turns, tool results, and a final answer that should still remember earlier facts.
  7. Save only after the preview keeps the important context.
  8. For repeatable verification, capture the scenario as a dataset and run an eval.
Behavior you seeTry in the UIConfirm with
Agent forgets recent user intentIncrease recent-message retention or lower noisy tool outputPreview chat with the same multi-turn prompt
Prompt grows too largeEnable or lower auto-compaction thresholdTrace/eval with long tool results
Final answer cuts offIncrease output-token limit, or choose a model with a larger output windowPreview answer length and eval output
Long task loopsPair context tuning with stop policy limitsConfigure Stop Policies
Important tool results disappearKeep a larger raw suffix or summarize only after safe pointsTrace detail and eval fixtures
Agents list with model metadata and runtime inference statistics.
Agents list shows runtime signals when stats are wired.
Eval run detail page with pass/fail fixture output.
Eval runs catch regressions in long-context behavior.

Use preview for fast feedback, then use evals for cases that must not regress. If the change is worse, restore the previous version from History and save that known-good draft.

Use API writes when context policies are generated by deployment tooling. The operator loop stays the same: validate, write, run, compare.