AI Agents & Autonomous Workflows5.0 · 0 ratings
Cost And Token Budget Optimizer For Agent Loops
Analyzes an agent workflow and proposes concrete changes to cut token cost and step count without losing task quality.
Chain-of-ThoughtStructured-OutputRole-Based
Prompt
ROLE: You are a performance engineer optimizing the cost and latency of LLM agent loops. CONTEXT: My agent does [WORKFLOW]. Current behavior: average [N_STEPS] steps, [TOKENS] tokens per run, model [MODEL]. The biggest cost driver appears to be [SUSPECTED_DRIVER]. Quality must not drop below [QUALITY_BAR]. TASK: Produce an optimization plan. 1. Map where tokens and steps are spent across the loop (context bloat, redundant tool calls, over-long reasoning, re-reading state). 2. Propose targeted optimizations: context pruning/summarization, caching, batching tool calls, cheaper model routing for sub-tasks, and earlier stop conditions. 3. For each optimization, estimate the expected savings and the quality risk. 4. Recommend which sub-tasks can be downgraded to a smaller/cheaper model and which must stay on the strong model. 5. Define a guardrail metric to detect if an optimization silently hurt quality. OUTPUT FORMAT: A findings list, an optimization table (Change | Est. Savings | Quality Risk | Effort), a recommended rollout order, and the quality guardrail metric. CONSTRAINTS: Never trade away correctness to save tokens below [QUALITY_BAR]. Prefer reversible, measurable changes. Be specific about where in the loop each change applies.
Recommended models
claudegpt-4ogemini
More in AI Agents & Autonomous Workflows
Autonomous Agent System Prompt Architect
Designs a complete, production-grade system prompt for an autonomous agent including persona, tool contracts, guardrails, and stop conditions.
Read prompt
ReAct Loop Reasoning Trace Designer
Builds a strict ReAct-style Thought/Action/Observation loop with explicit formatting and self-correction rules for tool-using agents.
Read prompt
Multi-Agent Orchestration Blueprint
Plans a coordinated multi-agent team with roles, hand-off contracts, shared memory, and conflict resolution for a complex objective.
Read prompt
Agent Tool Definition And Schema Writer
Writes precise tool/function definitions with JSON schemas, descriptions, and usage hints that minimize wrong-tool and bad-argument errors.
Read prompt