Skip to main content
Mythos

Token Optimization is the practice of managing language-model token usage efficiently across agent systems — reducing operating costs in long-running, multi-agent, or autonomous workflows without sacrificing capability.

Token usage in agent collaboration compounds in ways single-prompt usage does not. Every session loads identity context, instructions, memory, and tool definitions into the model's working context; every sub-agent invocation spawns a child session carrying its own load; every scheduled background task contributes additional inference on a schedule. The same workflow that fits comfortably inside a chat window can become operationally expensive when multiple agents run continuously against it. Token Optimization is the discipline of designing those workflows to scale gracefully on cost.

Key Optimization Levers

  • Prompt caching — most provider APIs (Anthropic, OpenAI, etc.) charge a fraction of the standard rate for cached prompt content. Identifying which prompt sections are stable across calls and caching them is usually the single largest cost lever
  • Identity and instruction file trimming — keep system prompts, personality definitions, and instruction sets tight; bloat dilutes attention and wastes tokens on every prompt
  • Model routing — use frontier models for reasoning-heavy tasks; route mechanical tasks (extraction, formatting, simple Q&A) to faster, cheaper models. Most production agent stacks use multiple models matched to task types
  • Context window discipline — load only what the agent needs for the current task; rely on 📝Retrieval-Augmented Generation (RAG) or targeted file reads for on-demand retrieval rather than dumping all available context into every prompt
  • Scheduled task efficiency — for autonomous workflows, check whether tasks need a full agent session or can run as scripts. Agent inference is expensive; shell commands and HTTP calls are not
  • Session compaction — when conversations approach the context window limit, save important state to persistent memory before summarization compresses the rest, so long sessions don't waste tokens re-establishing state
  • Pre-flight token counting — measure assembled prompts with a tokenizer before sending. Catches silent truncation, oversize payloads, and unexpected context bloat before they reach the model

Why It Matters

Operational costs are the difference between an agent system that scales gracefully and one that becomes financially untenable. Multi-agent systems multiply token usage by the number of agents; long-running autonomous workflows multiply it again by the number of scheduled invocations. Practitioners who build production agent stacks without deliberate token discipline routinely see monthly costs grow from low double-digits into the hundreds within weeks — purely as a function of architecture choices, not feature scope.

Token Optimization is also a forcing function for clarity. Tightening identity files, routing tasks to the right model, and trimming context all require knowing what the agent actually needs to do its job. The discipline of token optimization tends to produce more legible, auditable, and ultimately more reliable agent systems alongside the cost savings.

Related

Contexts

Created with 💜 by One Inc | Copyright 2026