The most expensive part of my agent stack wasn’t tokens — it was the invoice roulette
Описание и применение
В продакшн‑стеке агентов стоимость определяется не только токенами, а поведением рабочего процесса: повторные попытки, откаты, фоновые задачи и кэширование. Понимание этих факторов позволяет выбирать подходящие модели (batch, кэш) и управлять затратами.
Задача
Agent stacks that run 24/7 incur unpredictable and often higher costs than token‑based forecasts suggest, because workflow behaviors such as retries, fallbacks, background jobs, and caching significantly affect billing.
Результат
Recognizing that billing volatility stems from workflow design rather than token count led to a shift in cost‑management strategy: use OpenAI Batch for offline jobs, apply Anthropic caching only when prompts are stable, and separate async work for Gemini batch. This reduces unexpected spikes and aligns cost with architectural choices.
Рабочий процесс
- 1. Receive event (e.g., support ticket webhook).
- 2. AI Agent classifies urgency via LLM call.
- 3. Agent calls CRM tool.
- 4. Agent calls knowledge base tool.
- 5. Agent drafts reply via LLM call.
- 6. If a tool call times out, retry the step.
- 7. On retry, earlier steps may run again, increasing token usage.
- 8. Background jobs (nightly summarization, cache refresh) run independently of user events.
Доказательства
If you run agents 24/7, especially across n8n, Make, Zapier, OpenClaw, or custom workflows, this matters more than most pricing pages admit.
OpenAI Batch is a solid option for offline work. 50% lower cost than synchronous API usage.
Anthropic caching looks fantastic on paper. It can be a huge win if your prompt prefixes are stable and requests arrive inside the cache window.
- Дата записи: 2026-09-21T16:30:21.223Z