Your internal AI application can produce a plausible answer after losing the document that should have constrained it. AI API context limits become a product risk when the application handles an oversized request by silently discarding material.
The workflow owner should decide what evidence the task requires and whether a narrower task is acceptable. The engineering owner should enforce that decision before sending the request. Our recommended policy is to block generation whenever required evidence is missing, even if the remaining input fits.
Set a policy for AI API context limits
Start with the task, then define its required inputs. For a support reply, those might be the current ticket, the applicable policy and an approved exception. Mark older discussion as optional only when the support workflow owner agrees that omitting it cannot change the permitted reply.
Anthropic’s Context windows documentation describes a shared window containing the request and generated output. It says the system prompt, messages, tool results, images, documents and tool definitions count towards it. Counting only the employee’s latest message therefore misses other parts of the request.
Have the engineering owner maintain the capacity rules for the selected provider, endpoint and model. Reserve room for the intended output and any applicable reasoning allowance. Choose a safety margin from representative requests; the workflow owner should approve the operational consequence, such as asking staff to narrow a request sooner.
That margin addresses capacity uncertainty. It cannot establish that the application included the right policy or extracted a complete document.
Choose between rejection, narrowing and controlled trimming
Use this proposed decision table when the assembled request exceeds the application’s budget.
| Choice | When it fits | Owner and condition |
|---|---|---|
| Reject the request | Required material cannot fit, or completeness is unknown | Engineering blocks the call; the workflow owner chooses a manual route or redesign |
| Narrow the task | A smaller question can be answered using an agreed subset | The workflow owner approves the changed scope and required sources before rebuilding |
| Trim optional material | The task remains valid without specifically identified content | Engineering removes only content permitted by the workflow owner, then repeats all checks |
Show staff what changes: “Remove archived discussion; keep the current ticket and policy” is a reviewable choice. “Optimise context” gives them too little information to assess.
Do not treat a model-generated summary as an interchangeable replacement for required source text. If the owner authorises that substitution, define a separate workflow with its own review conditions. Our guide to checking long-document summaries covers that human review; the input check here establishes what was actually sent.
Check the content in the final request
Have the request builder keep a record of required sources: document identity, revision and whether the task needs the full text or named sections. After retrieval, extraction and any permitted removal, compare that record with the content attached to the final request.
A filename or document identifier alone is insufficient. A file can be selected while its extracted text is empty or incomplete. Engineering should check the required sections and document boundaries against the source representation the workflow has approved. Where full text is mandatory, verify that the submitted representation contains that text; block the call when extraction is unresolved.
Then count the assembled input using a method appropriate to that provider. Anthropic’s Token counting documentation describes an endpoint accepting structured message inputs, including system prompts and supported tools, images and PDFs. Its support restrictions matter: confirm that the counting method covers the request features your application uses.
Keep the checked payload tied to the version that is sent. If a ticket revision, document, tool definition or message changes after checking, rebuild and check again. Apply the same rule to later model calls that incorporate tool results.
Store the source revisions, scope approval and check outcome with the attempt, using references rather than copying confidential content into routine logs. This gives the engineering owner evidence to investigate a missing-input incident.
Keep required evidence out of automatic trimming
Provider behaviour needs an explicit setting in the adapter. OpenAI’s Responses Create reference says truncation: auto can fit input by dropping items from the beginning of the conversation. With truncation: disabled, the documented default, input exceeding the context window causes an error. The reference also warns that some models can begin trimming earlier because their maximum output allowance is reserved, even when a lower output cap is requested.
For workflows with mandatory evidence, our recommendation is to disable provider-side truncation and remove optional content in the application, where engineering can inspect the result. Placing an important document later in the conversation is no substitute for a completeness check.
If provider-managed history or another context-management feature prevents engineering from establishing what remains available, do not claim the required evidence survived. Rebuild an explicit request from the approved sources, or use the workflow’s manual route.
Automatic trimming can suit an exploratory conversation whose owner accepts losing earlier discussion. It is a poor fit when the answer must account for every required source. Preserving a source also does not prove that the model will interpret it correctly; output review remains necessary.
A hypothetical support escalation
Imagine an internal assistant drafting an escalation recommendation from a current ticket, a service policy and an exception appendix. Archived conversation pushes the assembled request over budget. This is an illustrative design example, not a customer result.
The support workflow owner has marked the ticket, policy and appendix as required, and archived conversation as removable. Engineering removes the archive, confirms the approved revisions and required text are still present, recounts the request and sends only if the budget check passes.
Now change the scenario: the appendix alone prevents the request from fitting. The assistant must stop. The support owner can authorise a narrower question with a different evidence requirement, or assign manual review. A request-builder fallback must not silently delete the appendix and continue answering the original question.
Test the missing-evidence path
Before release, have engineering demonstrate these acceptance checks to the workflow owner:
- Required source selected, but extraction empty: generation remains blocked.
- Mandatory appendix omitted during assembly: the content check identifies the missing material.
- Optional history removed: all required sources survive and the rebuilt request is counted again.
- Required content still exceeds capacity: staff receive the approved narrowing or manual-review route.
- Ticket or policy changes after checking: the earlier check cannot authorise the changed payload.
- Provider configuration enables automatic trimming unexpectedly: the adapter fails the workflow’s configuration check.
The workflow owner sets the tolerance for optional omissions. Before release, engineering lists unresolved content errors for that owner; affected requests stay blocked until fixed or routed to manual review. Engineering demonstrates the checks again after fixes or changes to the model, endpoint, SDK or context-management settings.
Sources
- Anthropic, Context windows, current documentation checked November 2026; context components and output capacity.
- Anthropic, Token counting, current documentation checked November 2026; structured inputs and supported counting features.
- OpenAI, Create a model response, current API reference checked November 2026; truncation settings and model-specific reservation behaviour.
Your next step
Required evidence is a workflow rule that the request builder must preserve. Choose an internal AI task, have its owner approve the table’s conditions, and ask engineering to demonstrate the missing-appendix case before release. Use our AI API integration guide to place this check immediately before the provider call.

