Docs/Guides/Token optimization

Token optimization

MeshFlow has a systematic token governance layer. Cost caps, model routing, prompt caching, context pruning, RAG budgeting, and context deduplication work together to reduce spend.

python
from meshflow import Agent, CostCapGuardrail, ModelRouter

agent = Agent(
name="cost_aware",
role="researcher",
input_guardrails=[CostCapGuardrail(max_cost_usd=0.10)],
model_router=ModelRouter(),
)