A short request can trigger a long AI workflow. Retrieval, repeated model calls, tool actions and generated output all consume resources, so counting incoming HTTP requests alone does not describe the workload. A useful budget connects a user's permitted task with the maximum work the service will perform, and explains what happens when that budget is reached.
Define a unit of permitted work
Identify the resources the workflow can spend: input and output tokens, tool calls, retrieved documents, uploaded data, concurrent jobs and wall-clock time. Some costs arise before the model produces a response, such as document conversion or search. Associate these resources with the relevant user, tenant and job rather than one global counter. A fixed limit per model call still allows a long chain of calls to exceed the intended task budget. The system needs an aggregate boundary that follows the workflow across its components.
Propagate cancellation across dependencies
When a user cancels a task or the gateway times out, downstream processing should stop where the platform permits it. Document which operations can be interrupted, which finish independently and which may already have created a side effect. Retrying an apparently failed request must not silently duplicate expensive jobs or external actions. Use identifiable job records and deliberate retry policies. Resource accounting should include work completed after the client disconnects, otherwise dashboards can show a harmless failed request while background workers continue consuming capacity.
Test a bounded research example
A fictional research assistant is allowed to review twelve supplied documents and produce one summary. Its policy caps document processing, retrieval rounds and output length, then returns a partial-result explanation if additional work would exceed the budget. Testing includes cancellation during document preparation and during generation. The expected outcome is a clear stopped or partial state with a stable job identifier. It is not an endless internal retry that preserves the appearance of success while bypassing the original budget.
Balance availability with usable recovery
Decide who can request a larger budget and what evidence supports that exception. A legitimate large job may belong in a scheduled queue rather than an interactive session. Monitor rejected work, wait time and tenant fairness without collecting unnecessary prompt content. Distinguish protective resource limits from provider billing estimates; a provider may count work differently. Record the assumptions and retest when models or tool integrations change. A resource control succeeds when it bounds actual work and gives users an understandable recovery path, not merely when it blocks a particular request shape.
The budget follows the whole workflow, including work that starts before generation or continues after a client disconnect.
Take this into your next review
- Bound aggregate workflow work, not only incoming requests.
- Test cancellation and retry behavior.
- Keep limits and recovery understandable for legitimate users.
Primary references
- OWASP Top 10 for Large Language Model Applications ↗
- NIST AI Risk Management Framework ↗
- MITRE ATLAS knowledge base ↗
AgentX Editorial · AI-assisted educational writing. Historical analysis is separated from hypothetical future scenarios; publication does not imply independent field investigation. Referenced organizations do not endorse AgentX. Report a correction.
Continue reading
Trust boundaries: draw where data becomes authority
How to make architecture diagrams explain security decisions rather than merely list components.
AI security mechanismsPrompt injection: do not let a document rewrite the assignment
Separate untrusted document content from the authority that controls an AI workflow.
AI security mechanismsAgent tool permissions: review the action that will actually execute
Bind an agent action to a specific user, resource, scope and transaction before execution.