[{"data":1,"prerenderedAt":965},["ShallowReactive",2],{"navigation_docs":3,"-gateway-context-engine":160,"-gateway-context-engine-surround":960},[4,21,62,82,103,149],{"title":5,"icon":6,"path":7,"stem":8,"children":9,"page":20},"Get Started","i-lucide-rocket","\u002Fgetting-started","1.getting-started",[10,15],{"title":11,"path":12,"stem":13,"icon":14},"Introduction","\u002Fgetting-started\u002Fintroduction","1.getting-started\u002F1.introduction","i-lucide-info",{"title":16,"path":17,"stem":18,"icon":19},"Quickstart","\u002Fgetting-started\u002Fquickstart","1.getting-started\u002F2.quickstart","i-lucide-play-circle",false,{"title":22,"icon":23,"path":24,"stem":25,"children":26,"page":20},"Gateway","i-lucide-network","\u002Fgateway","2.gateway",[27,32,37,42,47,52,57],{"title":28,"path":29,"stem":30,"icon":31},"Overview","\u002Fgateway\u002Foverview","2.gateway\u002F1.overview","i-lucide-waypoints",{"title":33,"path":34,"stem":35,"icon":36},"Models and Routing","\u002Fgateway\u002Fmodels-and-routing","2.gateway\u002F2.models-and-routing","i-lucide-brain",{"title":38,"path":39,"stem":40,"icon":41},"Smart Router","\u002Fgateway\u002Fsmart-routing","2.gateway\u002F3.smart-routing","i-lucide-route",{"title":43,"path":44,"stem":45,"icon":46},"Context Engine","\u002Fgateway\u002Fcontext-engine","2.gateway\u002F4.context-engine","i-product-context-engine",{"title":48,"path":49,"stem":50,"icon":51},"Data Integrations","\u002Fgateway\u002Fdata-integrations","2.gateway\u002F5.data-integrations","i-lucide-database",{"title":53,"path":54,"stem":55,"icon":56},"Tools","\u002Fgateway\u002Ftools","2.gateway\u002F6.tools","i-lucide-wrench",{"title":58,"path":59,"stem":60,"icon":61},"Guardrails","\u002Fgateway\u002Fguardrails","2.gateway\u002F7.guardrails","i-lucide-shield-alert",{"title":63,"icon":64,"path":65,"stem":66,"children":67,"page":20},"Compliance","i-lucide-shield-check","\u002Fcompliance","3.compliance",[68,72,77],{"title":69,"path":70,"stem":71,"icon":64},"Data Governance","\u002Fcompliance\u002Fdata-governance","3.compliance\u002F01.data-governance",{"title":73,"path":74,"stem":75,"icon":76},"Network Access","\u002Fcompliance\u002Fnetwork-access","3.compliance\u002F02.network-access","i-lucide-lock",{"title":78,"path":79,"stem":80,"icon":81},"Audit Logs","\u002Fcompliance\u002Faudit-logs","3.compliance\u002F03.audit-logs","i-lucide-scroll-text",{"title":83,"icon":84,"path":85,"stem":86,"children":87,"page":20},"Observability","i-lucide-eye","\u002Fobservability","4.observability",[88,93,98],{"title":89,"path":90,"stem":91,"icon":92},"Organization","\u002Fobservability\u002Forganization","4.observability\u002F1.organization","i-lucide-building-2",{"title":94,"path":95,"stem":96,"icon":97},"Application","\u002Fobservability\u002Fapplication","4.observability\u002F2.application","i-lucide-activity",{"title":99,"path":100,"stem":101,"icon":102},"Metrics","\u002Fobservability\u002Fmetrics","4.observability\u002F3.metrics","i-lucide-bar-chart-2",{"title":104,"icon":105,"path":106,"stem":107,"children":108,"page":20},"Administration","i-lucide-settings","\u002Fadministration","5.administration",[109,114,119,129,144],{"title":110,"path":111,"stem":112,"icon":113},"Organization and Projects","\u002Fadministration\u002Forganizations-and-projects","5.administration\u002F1.organizations-and-projects","i-lucide-box",{"title":115,"path":116,"stem":117,"icon":118},"Members and Access","\u002Fadministration\u002Fmembers-and-access","5.administration\u002F2.members-and-access","i-lucide-shield-user",{"title":120,"path":121,"stem":122,"children":123,"icon":76},"Authentication","\u002Fadministration\u002Fauthentication","5.administration\u002F3.authentication",[124],{"title":125,"path":126,"stem":127,"icon":128},"Connect Model APIs","\u002Fadministration\u002Fauthentication\u002Fconnect-model-apis","5.administration\u002F3.authentication\u002F31.connect-model-apis","i-lucide-cpu",{"title":130,"path":131,"stem":132,"children":133,"icon":143},"Connections","\u002Fadministration\u002Fconnections","5.administration\u002F4.connections",[134,139],{"title":135,"path":136,"stem":137,"icon":138},"Connect MCP Servers","\u002Fadministration\u002Fconnections\u002Fmcp-connections","5.administration\u002F4.connections\u002F42.mcp-connections","i-lucide-plug",{"title":140,"path":141,"stem":142,"icon":51},"Connect Data Sources","\u002Fadministration\u002Fconnections\u002Fdata-sources-connections","5.administration\u002F4.connections\u002F43.data-sources-connections","i-lucide-link",{"title":145,"path":146,"stem":147,"icon":148},"Budgets","\u002Fadministration\u002Fbudgets","5.administration\u002F5.budgets","i-lucide-wallet",{"title":150,"icon":151,"path":152,"stem":153,"children":154,"page":20},"Reference","i-lucide-book-open","\u002Freference","6.reference",[155],{"title":156,"path":157,"stem":158,"icon":159},"Using the API","\u002Freference\u002Fapi-usage","6.reference\u002F1.api-usage","i-lucide-terminal-square",{"id":161,"title":43,"body":162,"description":953,"extension":954,"links":955,"meta":956,"navigation":957,"path":44,"seo":958,"stem":45,"__hash__":959},"docs\u002F2.gateway\u002F4.context-engine.md",{"type":163,"value":164,"toc":933},"minimark",[165,169,175,180,188,211,215,218,244,255,259,262,276,279,284,287,368,371,376,380,386,459,462,465,468,494,499,507,513,516,522,525,551,554,557,560,563,571,578,581,615,622,639,642,653,656,659,662,672,677,680,693,696,702,706,709,722,725,728,731,741,744,759,762,765,768,772,775,831,834,856,859,863,883,892,896,912,916],[166,167,168],"p",{},"The Context Engine shapes the context an application sends to a model: it compresses redundant content, summarizes retrieved data, and trims long conversations. Fewer input tokens lower the cost of each request and keep long conversations within a token budget you set.",[170,171,174],"who-panel",{":applies-to":172,":roles":173},"[\"LLM requests\"]","[\"Organization Admin\", \"Workspace Admin\", \"Project Admin\", \"App Admin\"]","Admins of an application add the Context Engine's components and choose whether each one only measures or also changes requests. App Viewers can see the configuration but can't change it.",[176,177,179],"h2",{"id":178},"why-use-it","Why use it",[166,181,182,183,187],{},"Input tokens often account for a significant fraction of a request’s cost. As conversations continue and applications include tool results or documents, the context can grow. The Context Engine helps reduce it centrally across all requests from an application, as part of the optimization described in the ",[184,185,11],"a",{"href":186},"\u002Fgetting-started\u002Fintroduction#why-use-optiak",".",[189,190,191,199,205],"ul",{},[192,193,194,198],"li",{},[195,196,197],"strong",{},"Lower input costs"," without changing application code.",[192,200,201,204],{},[195,202,203],{},"Measure before you change anything."," Every component can run in Audit mode, which records what it would remove while the model still receives the original request.",[192,206,207,210],{},[195,208,209],{},"Choose how far to go."," Removing redundant content is a low-risk start. Summarizing retrieved data and trimming history save more, with more risk of removing something the model needs.",[176,212,214],{"id":213},"how-it-works","How it works",[166,216,217],{},"Optiak offers several context reduction components. When a request arrives, each enabled component applies its configured method to the request’s messages in sequence. The Context Engine then sends the resulting messages to the model. Components operate on messages or collections of messages of the following types:",[189,219,220,226,232,238],{},[192,221,222,225],{},[195,223,224],{},"System"," - System and developer instructions.",[192,227,228,231],{},[195,229,230],{},"User"," - A message from the user.",[192,233,234,237],{},[195,235,236],{},"Assistant"," - A reply from the model.",[192,239,240,243],{},[195,241,242],{},"Tool exchange"," - An assistant message that calls one or more tools, the tool results, and the assistant reply that uses them.",[166,245,246,247,250,251,254],{},"Within the Context Engine, each message or complete tool exchange is treated as an ",[195,248,249],{},"item",". A user message plus every item that follows it until the next user message is one ",[195,252,253],{},"turn",". For example:",[256,257],"context-timeline",{":rows":258},"[{\"segments\":[{\"label\":\"System\"},{\"label\":\"User\",\"group\":\"Turn 1\"},{\"label\":\"Assistant\",\"group\":\"Turn 1\"},{\"label\":\"User\",\"group\":\"Turn 2\"},{\"label\":\"Tool exchange\",\"group\":\"Turn 2\"},{\"label\":\"User\",\"group\":\"Active turn\"},{\"label\":\"...\",\"group\":\"Active turn\"}]}]",[166,260,261],{},"Two rules apply to every component:",[189,263,264,270],{},[192,265,266,269],{},[195,267,268],{},"Attachments, metadata and other non-textual information is never altered."," Images, files, tool-call IDs and provider metadata are kept unchanged. Components only remove whole items or rewrite text.",[192,271,272,275],{},[195,273,274],{},"Some content is never removed:"," system and developer instructions, the active user message and all content that follows it as long as the turn is not finished, incomplete tool exchanges, and data that Optiak can't interpret safely, such as reasoning blocks and provider-specific items.",[166,277,278],{},"Components run in the fixed order you see in the console: Smart Compression, Context Compression, Sliding Window, then Context Budgeting, which works on what the others leave.",[280,281,283],"h3",{"id":282},"audit-and-optimize","Audit and Optimize",[166,285,286],{},"Each component can be enabled or disabled. When enabled, it applies one Action to the request:",[288,289,290,312],"table",{},[291,292,293],"thead",{},[294,295,296,300,303,306,309],"tr",{},[297,298,299],"th",{},"Component state",[297,301,302],{},"Action",[297,304,305],{},"Component behavior",[297,307,308],{},"What the model receives",[297,310,311],{},"Request trace",[313,314,315,333,351],"tbody",{},[294,316,317,321,324,327,330],{},[318,319,320],"td",{},"Disabled",[318,322,323],{},"—",[318,325,326],{},"Does not run",[318,328,329],{},"Original request",[318,331,332],{},"No component result",[294,334,335,338,343,346,348],{},[318,336,337],{},"Enabled",[318,339,340],{},[195,341,342],{},"Audit (no action)",[318,344,345],{},"Runs without applying changes",[318,347,329],{},[318,349,350],{},"Component result is recorded",[294,352,353,355,360,363,366],{},[318,354,337],{},[318,356,357],{},[195,358,359],{},"Optimize",[318,361,362],{},"Runs and applies its result",[318,364,365],{},"Updated request",[318,367,350],{},[166,369,370],{},"Audit is the default action for a new component. In both Audit and Optimize modes, Optiak records what each component removed or changed and how much that impacted the input token count, so you can compare them in the request traces.",[372,373,375],"callout",{"color":374,"icon":14},"info","Start each component in Audit, send real traffic, and read the measured savings in the request traces. Switch to Optimize when the numbers and the retained context look right. The effect on the model's answers shows only in Optimize, because in Audit the model still receives the original request.",[176,377,379],{"id":378},"components","Components",[166,381,382,383,385],{},"Add the components your application needs; each one runs under its own ",[195,384,302],{},". They range from removing only redundant content to removing content outright:",[288,387,388,401],{},[291,389,390],{},[294,391,392,395,398],{},[297,393,394],{},"Component",[297,396,397],{},"What it does",[297,399,400],{},"Removes content",[313,402,403,417,431,445],{},[294,404,405,411,414],{},[318,406,407],{},[184,408,410],{"href":409},"#smart-compression","Smart Compression",[318,412,413],{},"Folds repeated content in history and tool results",[318,415,416],{},"Only redundant content",[294,418,419,425,428],{},[318,420,421],{},[184,422,424],{"href":423},"#context-compression","Context Compression",[318,426,427],{},"Summarizes retrieved data against the user's question",[318,429,430],{},"Yes, from retrieved data",[294,432,433,439,442],{},[318,434,435],{},[184,436,438],{"href":437},"#sliding-window","Sliding Window",[318,440,441],{},"Keeps the start and the latest part of the conversation",[318,443,444],{},"Yes, older history",[294,446,447,453,456],{},[318,448,449],{},[184,450,452],{"href":451},"#context-budgeting","Context Budgeting",[318,454,455],{},"Caps the context tokens sent to the model",[318,457,458],{},"Yes, oldest items first",[280,460,410],{"id":461},"smart-compression",[166,463,464],{},"Smart Compression removes redundant content from conversation history and tool results. Repeated content is folded, and nothing is summarized or reworded, and user messages and instructions are never compressed.",[166,466,467],{},"It helps most with verbose tool output:",[189,469,470,476,482,488],{},[192,471,472,475],{},[195,473,474],{},"Logs and build output"," - Terminal colors are stripped, and repeated lines collapse to a repetition marker.",[192,477,478,481],{},[195,479,480],{},"Search results"," - A file path repeated on every match becomes one heading above its matches.",[192,483,484,487],{},[195,485,486],{},"Repeated blocks"," - Identical chunks in YAML, TOML, INI or plain text become a reference.",[192,489,490,493],{},[195,491,492],{},"Diffs"," - Git bookkeeping the model doesn't need is dropped. The changed lines stay as they are, so the diff still applies.",[495,496,498],"h4",{"id":497},"settings","Settings",[189,500,501],{},[192,502,503,506],{},[195,504,505],{},"Minimum tokens to compress"," - Content below this token count is left untouched. The default is 250 tokens, and the lowest accepted value is 20.",[372,508,509,512],{"color":374,"icon":14},[195,510,511],{},"Smart Compression is the lowest-risk place to start."," It only removes redundant content, so the model still receives all the information in the original. Savings are modest.",[280,514,424],{"id":515},"context-compression",[166,517,518,519,521],{},"Context Compression summarizes the data that Optiak retrieves from ",[184,520,48],{"href":49}," against the user's current question. Only the part relevant to the question reaches the model. Requests without retrieved data pass through unchanged.",[495,523,498],{"id":524},"settings-1",[189,526,527,533],{},[192,528,529,532],{},[195,530,531],{},"Dynamic ratio"," - Let the engine choose how much to compress. This is the default.",[192,534,535,538,539,542,543,546,547,550],{},[195,536,537],{},"Compression level"," - With dynamic ratio off, choose how much of the retrieved data to remove: ",[195,540,541],{},"Conservative"," (about 25%), ",[195,544,545],{},"Balanced"," (about 50%) or ",[195,548,549],{},"Aggressive"," (about 75%). Aggressive compression can remove information the model needs.",[166,552,553],{},"The right level depends on your data. Dense data, where most of the content matters, needs a more conservative level. Data with a lot of noise can take a more aggressive one.",[166,555,556],{},"Context Compression runs before the model call, so it adds latency.",[280,558,438],{"id":559},"sliding-window",[166,561,562],{},"Sliding Window keeps the start and the most recent part of a conversation and drops the history in between.",[372,564,567,570],{"color":565,"icon":566},"warning","i-lucide-triangle-alert",[195,568,569],{},"Messages are removed."," What Sliding Window drops is gone from the request. In multi-step agents, a large cut can remove the agent's record of its own work, so it spends extra steps rebuilding it, and it can break the provider's cache.",[372,572,573,574,187],{"color":374,"icon":14},"We recommend that you run it first in Audit mode. Thus, you can adjust the behavior of the component to your applications. For example, this component can be your ally in long chat conversations where older turns are no longer needed. Read more in ",[184,575,577],{"href":576},"#prompt-caching","Prompt caching",[495,579,498],{"id":580},"settings-2",[189,582,583,603,609],{},[192,584,585,588,589],{},[195,586,587],{},"Retention unit"," - What counts as one unit:\n",[189,590,591,597],{},[192,592,593,596],{},[195,594,595],{},"Conversation turns"," - One unit is one conversation turn: user + tools + asisstant response. A turn with many tool calls is still one unit. This is the default.",[192,598,599,602],{},[195,600,601],{},"Context items"," - One unit is a message type, except for the tool exchanges that are maintained as one item. This can keep an assistant message without the user message before it.",[192,604,605,608],{},[195,606,607],{},"Keep first units"," - Units kept from the start of the conversation, which often frame the task. The default is 1.",[192,610,611,614],{},[195,612,613],{},"Keep latest units"," - Units kept from the most recent history. The default is 2.",[166,616,617,618,621],{},"Content that is never removed (see ",[184,619,214],{"href":620},"#how-it-works",") doesn't count toward either quota. In conversation-turn mode, a turn that contains such content is kept whole, and so is an incomplete turn. Nothing is removed when there are no more units than the quotas allow, and the latest unit is kept when a window would leave only instructions.",[166,623,624,627,628,630,631,634,635,638],{},[195,625,626],{},"Example"," - Retention unit ",[195,629,595],{},", keep first ",[195,632,633],{},"1",", keep latest ",[195,636,637],{},"2",":",[256,640],{":rows":641},"[{\"segments\":[{\"label\":\"System prompt\",\"state\":\"protected\"},{\"label\":\"Turn 1\",\"state\":\"kept\"},{\"label\":\"Turn 2\",\"state\":\"dropped\"},{\"label\":\"Turn 3\",\"state\":\"dropped\"},{\"label\":\"Turn 4\",\"state\":\"kept\"},{\"label\":\"Turn 5\",\"state\":\"kept\"},{\"label\":\"Active turn\",\"state\":\"protected\"}]}]",[166,643,644,627,646,630,648,634,650,652],{},[195,645,626],{},[195,647,601],{},[195,649,633],{},[195,651,637],{},". Each item is its own unit, so the window can split a turn:",[256,654],{":rows":655},"[{\"segments\":[{\"label\":\"System prompt\",\"state\":\"protected\"},{\"label\":\"User\",\"state\":\"kept\"},{\"label\":\"Assistant\",\"state\":\"dropped\"},{\"label\":\"User\",\"state\":\"dropped\"},{\"label\":\"Tool exchange\",\"state\":\"dropped\"},{\"label\":\"User\",\"state\":\"kept\"},{\"label\":\"Assistant\",\"state\":\"kept\"},{\"label\":\"Active user message\",\"state\":\"protected\"}]}]",[280,657,452],{"id":658},"context-budgeting",[166,660,661],{},"Context Budgeting limits the number of context tokens sent to the model. It runs last, after the other components.",[372,663,664,667,668,671],{"color":565,"icon":566},[195,665,666],{},"Context may be omitted or trimmed."," When the context exceeds the budget, whole items are left out, oldest first, and with ",[195,669,670],{},"Allow partial content"," on, a message can be cut mid-text. As with Sliding Window, a large cut can make an agent repeat work and break the provider's cache.",[372,673,674,675,187],{"color":374,"icon":14},"We recommend that you run it first in Audit mode to see how much a budget would remove. Thus, you can adjust the behavior of the component to your applications. For example, it can help to not go over the context window of the model for some applications. Read more in ",[184,676,577],{"href":576},[495,678,498],{"id":679},"settings-3",[189,681,682,688],{},[192,683,684,687],{},[195,685,686],{},"Max tokens"," - The application's budget, between 8,192 (the default) and 2,000,000 tokens. Leaving the field empty tells the component to use a budget based on the target model's context window size. Setting a manual budget larger than the model's context window maximum budget has no effect.",[192,689,690,692],{},[195,691,670],{}," - Trim a message to fit when the remaining budget is smaller than the message. With this off, a message that doesn't fit is left out whole.",[166,694,695],{},"Required content is kept first and uses budget first. The remaining context is added from newest to oldest until the budget runs out. Tool calls and their results are never split.",[166,697,698,699,701],{},"The budget isn't a hard cap. Content that is never removed (see ",[184,700,214],{"href":620},") is always kept, even when it alone exceeds the budget. In that case, only that content is sent.",[495,703,705],{"id":704},"the-models-budget-and-the-response-length","The model's budget and the response length",[166,707,708],{},"The model's context budget leaves room for the response. It's 90% of the model's context window minus the room reserved for the response, or the model's input limit if that's lower. That room is the first of these that is set:",[710,711,712,719],"ol",{},[192,713,714,715,187],{},"The request's own maximum output tokens, such as ",[716,717,718],"code",{},"max_completion_tokens",[192,720,721],{},"The model's maximum output tokens.",[166,723,724],{},"A larger response cap leaves less room for context, so Context Budgeting may remove more.",[176,726,577],{"id":727},"prompt-caching",[166,729,730],{},"Model providers cache the start of a prompt and bill the cached part at a lower price on later requests. The cache matches only up to the first difference from the previous request. Everything after that point is billed at the full price.",[372,732,733,736,737,740],{"color":565,"icon":566},[195,734,735],{},"Check your cache usage before you turn on Sliding Window or Context Budgeting."," If your requests already read much of their input from the provider's cache, these components can raise your cost instead of lowering it. Audit doesn't show this effect, because the request is unchanged. Check ",[195,738,739],{},"Cache read"," in your request traces first, and again after you switch to Optimize.",[166,742,743],{},"Sliding Window and Context Budgeting change where the kept history starts, so they can move that point close to the start of the conversation:",[189,745,746,754],{},[192,747,748,750,751,753],{},[195,749,438],{}," - Once the conversation holds more units than the window keeps, each new unit pushes the oldest of the latest units out. ",[195,752,607],{}," sets where that change starts: the system prompt and the units kept from the start stay the same and can still be read from the cache, and everything after them is billed at the full price. The more units you keep from the start, the larger the part that stays cached.",[192,755,756,758],{},[195,757,452],{}," - Once the context exceeds the budget, the budget is filled first with the content that is never removed, such as the system prompt and the active user message. The rest of the history is then added from newest to oldest until the budget runs out, so each new item pushes the oldest kept item out. The history right after the required content changes on that request. While the context stays over budget, this can happen on every request.",[166,760,761],{},"For example, with Sliding Window keeping the first turn and the latest 2, when turn 6 arrives, turn 3 leaves the window. The cache then matches only up to turn 1, so turns 4 and 5 are billed at the full price again:",[256,763],{":rows":764},"[{\"label\":\"Request with turns 1 to 5\",\"segments\":[{\"label\":\"System prompt\",\"state\":\"cached\"},{\"label\":\"Turn 1\",\"state\":\"cached\"},{\"label\":\"Turn 2\",\"state\":\"dropped\"},{\"label\":\"Turn 3\",\"state\":\"cached\"},{\"label\":\"Turn 4\",\"state\":\"cached\"},{\"label\":\"Turn 5\",\"state\":\"new\"}]},{\"label\":\"Next request, with turn 6\",\"segments\":[{\"label\":\"System prompt\",\"state\":\"cached\"},{\"label\":\"Turn 1\",\"state\":\"cached\"},{\"label\":\"Turns 2 and 3\",\"state\":\"dropped\"},{\"label\":\"Turn 4\",\"state\":\"full-price\"},{\"label\":\"Turn 5\",\"state\":\"full-price\"},{\"label\":\"Turn 6\",\"state\":\"new\"}]}]",[166,766,767],{},"Each move trades fewer tokens on every later request for one request that bills the kept history at the full price. Large cuts that happen rarely recover that cost quickly. A cut point that moves on every request bills the kept history at the full price every time.",[176,769,771],{"id":770},"benchmarks","Benchmarks",[166,773,774],{},"We measured each component on internal workloads: conversations with long retrieved documents, and multi-step coding agents with verbose tool output.",[288,776,777,789],{},[291,778,779],{},[294,780,781,783,786],{},[297,782,394],{},[297,784,785],{},"Savings",[297,787,788],{},"Effect on answers",[313,790,791,801,820],{},[294,792,793,795,798],{},[318,794,410],{},[318,796,797],{},"About 1–2% fewer input tokens, more on log-heavy tool output",[318,799,800],{},"No change measured; only redundant content is removed",[294,802,803,805,808],{},[318,804,424],{},[318,806,807],{},"Fewer tokens of retrieved data, based on the compression level you set. The cost saving depends on the model's price",[318,809,810,811,813,814,816,817,819],{},"No measurable change at ",[195,812,541],{}," and ",[195,815,545],{},"; lower accuracy at ",[195,818,549],{},", mostly on questions that combine several documents",[294,821,822,825,828],{},[318,823,824],{},"Sliding Window, Context Budgeting",[318,826,827],{},"The largest cuts",[318,829,830],{},"Agents can need extra steps to recover removed context",[166,832,833],{},"What this means for your application:",[189,835,836,842,848],{},[192,837,838,841],{},[195,839,840],{},"Start with Smart Compression."," It only removes redundant content, so it's the lowest-risk component. Expect about 1–2% fewer input tokens, and more if your tasks produce a lot of logs, build output, search results or other repetitive tool output.",[192,843,844,847],{},[195,845,846],{},"Match Context Compression to your data."," Use a conservative level for dense data and a more aggressive one for noisy data.",[192,849,850,853,854,187],{},[195,851,852],{},"Use Sliding Window and Context Budgeting with care in agents."," They remove the most tokens, but an agent can need extra steps to recover what was removed. Check your cache usage first; see ",[184,855,577],{"href":576},[166,857,858],{},"These results vary with your workload and models. Measure each component in Audit mode on your own traffic before you switch it to Optimize mode.",[176,860,862],{"id":861},"set-it-up","Set it up",[166,864,865,866,869,870,872,873,875,876,879,880,882],{},"In the console, open the application, then ",[195,867,868],{},"Configuration",", then ",[195,871,785],{},", and select the ",[195,874,43],{}," tab. Select ",[195,877,878],{},"Add components",", choose a component, and set its ",[195,881,302],{}," and settings. Components appear as steps in a pipeline, in the order they run, from top to bottom. Removing one leaves the rest of the configuration unchanged.",[166,884,885,886,889,890,187],{},"Each request trace in the application's ",[195,887,888],{},"Requests"," tab shows the Context Engine as its own stage, with one row per component: the action it ran under, items removed or modified, and the approximate token change. Opening request traces needs an admin role; see ",[184,891,115],{"href":116},[176,893,895],{"id":894},"limits-and-behavior","Limits and behavior",[189,897,898,903,906,909],{},[192,899,900,901,187],{},"Sliding Window and Context Budgeting can break the provider's cache. See ",[184,902,577],{"href":576},[192,904,905],{},"The Context Engine can't rescue a request that is already over the model's input limit. Optiak checks that limit before any component runs, and rejects the request with a context-window error.",[192,907,908],{},"Context Budgeting doesn't run when the model's limits are unknown.",[192,910,911],{},"Context Compression affects only retrieved data.",[176,913,915],{"id":914},"related","Related",[189,917,918,923,928],{},[192,919,920,922],{},[184,921,38],{"href":39},": lower costs by choosing the model for each request.",[192,924,925,927],{},[184,926,48],{"href":49},": the retrieved data that Context Compression summarizes.",[192,929,930,932],{},[184,931,94],{"href":95},": request traces and costs.",{"title":934,"searchDepth":935,"depth":935,"links":936},"",2,[937,938,942,948,949,950,951,952],{"id":178,"depth":935,"text":179},{"id":213,"depth":935,"text":214,"children":939},[940],{"id":282,"depth":941,"text":283},3,{"id":378,"depth":935,"text":379,"children":943},[944,945,946,947],{"id":461,"depth":941,"text":410},{"id":515,"depth":941,"text":424},{"id":559,"depth":941,"text":438},{"id":658,"depth":941,"text":452},{"id":727,"depth":935,"text":577},{"id":770,"depth":935,"text":771},{"id":861,"depth":935,"text":862},{"id":894,"depth":935,"text":895},{"id":914,"depth":935,"text":915},"Reduce the input tokens each request sends to the model, and measure the effect before you apply it.","md",null,{},{"icon":46},{"title":43,"description":953},"XCBehp6Snt9fVbc8rAM3CZyf4reoVBfOUqd2D6awbb0",[961,963],{"title":38,"path":39,"stem":40,"description":962,"icon":41,"children":-1},"Let Optiak choose the model for each request to lower model costs while keeping quality.",{"title":48,"path":49,"stem":50,"description":964,"icon":51,"children":-1},"Add relevant passages from your organization's documents to each request.",1795006122079]