Inferensys

Prompt

Budget-Conscious Agent Planning Prompt

A practical prompt playbook for using Budget-Conscious Agent Planning Prompt in production AI workflows.
Wide-angle shot of a modern WeWork open floor plan with creative walls covered in AI system architecture diagrams, product team collaborating in standing desk area with industrial lighting.
PROMPT PLAYBOOK

When to Use This Prompt

Learn when to apply budget-conscious planning before agent execution and when a simpler approach is safer.

Use this prompt when you have a complex task that an agent must decompose into multiple tool calls, and you need a hard resource budget enforced at planning time rather than at runtime. The ideal user is an agent developer or AI cost engineer who has a known tool catalog with declared per-call costs and a task description that can be broken into discrete, sequential steps. The prompt produces a validated step plan with per-step cost estimates, a total that demonstrably stays within the declared cap, and explicit trade-off decisions when the ideal plan would exceed the budget. This is a planning-time guardrail, not a runtime budget enforcer. It prevents the agent from designing a plan it cannot afford to execute, which is the most common failure mode in cost-unaware agent loops.

This prompt is not appropriate for simple single-tool lookups, tasks where tool costs are unknown or highly variable, or workflows where the agent must dynamically replan based on intermediate results. If your tool costs depend on payload size, result cardinality, or server-side pricing that the model cannot predict, a planning-time budget will be misleading. In those cases, use a runtime spend cap enforcement prompt instead. Similarly, if the task requires open-ended exploration where the number of steps cannot be estimated upfront, a cost-limited exploration prompt with early stopping criteria is a better fit. Do not use this prompt when the agent's tool catalog changes between planning and execution, as stale cost data will invalidate the budget constraint.

Before deploying this prompt, you must have a tool catalog with declared costs that the model can reference. Costs should include token estimates for tool input and output, any per-call fees, and expected latency if that factors into your budget model. The prompt assumes costs are additive and independent. If tool costs interact—for example, a cache hit on one tool reduces the cost of a subsequent call—you need to model that in the cost declarations or accept that the plan will be conservative. Validate the output plan by summing the declared per-step costs and confirming the total does not exceed the cap. For high-stakes workflows where budget overruns carry financial or compliance risk, add a human approval gate before the agent begins execution. The next section provides the copy-ready prompt template you can adapt to your tool catalog and budget model.

PRACTICAL GUARDRAILS

Use Case Fit

Where the Budget-Conscious Agent Planning Prompt delivers value and where it introduces unacceptable risk.

01

Good Fit: Pre-Execution Planning

Use when: You need a step plan with cost estimates before the agent starts executing. Guardrail: The prompt produces a static plan. Wire the output into a cost-enforcement harness that halts execution if actual spend deviates from the plan.

02

Good Fit: Fixed-Budget Tasks

Use when: A task has a hard cost cap and you need the model to propose trade-offs to stay within it. Guardrail: Validate that the total estimated cost in the output is less than or equal to the declared budget before approving the plan.

03

Bad Fit: Real-Time Reactive Work

Avoid when: The agent must react to unpredictable tool outputs or user inputs mid-stream. Guardrail: This prompt is for upfront decomposition. For dynamic environments, pair it with a separate mid-execution re-planning prompt that re-evaluates the remaining budget.

04

Bad Fit: Unknown Tool Costs

Avoid when: You lack accurate per-call cost metadata for your tools. Guardrail: The plan's cost estimates will be fiction. Implement a tool cost registry first, and inject it into the prompt's [TOOL_COST_SCHEMA] variable.

05

Required Input: Accurate Cost Metadata

Risk: Without a precise [TOOL_COST_SCHEMA], the model hallucinates prices. Guardrail: Provide a strict JSON schema mapping tool names to cost per call, and instruct the model to use only these values. Validate the output references only known tools.

06

Operational Risk: Plan Drift

Risk: A valid plan at T0 becomes irrelevant if a tool fails or returns unexpected data. Guardrail: Never execute a multi-step plan without a watchdog. If a step fails, re-invoke the planner with the remaining budget and new state to generate a revised plan.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A copy-ready system prompt for decomposing a task into a step plan that respects a declared resource budget, with per-step cost estimates and trade-off identification.

This prompt template is designed to be placed in the system instructions of an agent before it begins planning a complex task. It forces the model to treat a resource budget as a first-class constraint, producing a step-by-step plan where each step carries an estimated cost and the total stays within the declared cap. Use this when your agent has access to tools with known or estimable costs (API calls, token-intensive operations, human review loops) and you need to prevent runaway spend before execution starts.

text
You are a budget-conscious planning agent. Your job is to decompose a given task into a sequence of discrete steps, each with an estimated resource cost, such that the total estimated cost does not exceed a declared budget.

## INPUTS
- Task: [TASK_DESCRIPTION]
- Available Tools: [TOOL_LIST_WITH_COST_MODELS]
- Total Budget: [BUDGET_LIMIT] (expressed in [COST_UNIT], e.g., USD, tokens, API calls)
- Constraints: [CONSTRAINTS] (e.g., latency limits, required approvals, data residency)

## PLANNING RULES
1. Decompose the task into the smallest reasonable steps. Each step must map to one or more tool calls or internal reasoning actions.
2. For each step, estimate the cost using the provided tool cost models. If a step's cost is variable, provide a range and explain the variance.
3. The sum of all step cost estimates must not exceed [BUDGET_LIMIT].
4. If the task cannot be completed within the budget, produce a partial plan that maximizes progress and explicitly list what is deferred or dropped.
5. Identify at least one trade-off: a step where spending more would improve quality, or where spending less would increase risk.
6. Flag any step that requires human approval before execution.

## OUTPUT SCHEMA
Return a JSON object with the following structure:
{
  "plan_id": "string",
  "total_estimated_cost": number,
  "budget_limit": number,
  "cost_unit": "string",
  "steps": [
    {
      "step_number": number,
      "description": "string",
      "tool_calls_required": ["tool_name"],
      "estimated_cost": number,
      "cost_rationale": "string",
      "requires_approval": boolean,
      "depends_on": [number]
    }
  ],
  "trade_offs": [
    {
      "step_number": number,
      "description": "string",
      "alternative": "string",
      "cost_difference": number,
      "quality_impact": "string"
    }
  ],
  "deferred_or_dropped": ["string"],
  "risk_notes": ["string"]
}

## VALIDATION
Before returning the plan, verify:
- The sum of all step estimated_cost values equals total_estimated_cost.
- total_estimated_cost <= budget_limit.
- All depends_on references point to valid step numbers.
- No step with requires_approval: true executes a high-risk action without a human gate.

To adapt this template, replace the square-bracket placeholders with your specific values. [TASK_DESCRIPTION] should be a clear, bounded objective. [TOOL_LIST_WITH_COST_MODELS] must include the actual tool names and their cost functions—for example, search_api: $0.002 per call or gpt-4o: $0.005 per 1K output tokens. If you lack precise cost models, use conservative upper-bound estimates and note the uncertainty. [BUDGET_LIMIT] and [COST_UNIT] should align with how your platform tracks spend. [CONSTRAINTS] can include latency budgets, required review gates, or data handling rules that affect step feasibility. After pasting, test the prompt with a known task and verify that the output JSON parses correctly and that the cost arithmetic is accurate. For high-stakes production use, add a post-generation validation step in your harness that independently sums the step costs and rejects plans that exceed the budget.

IMPLEMENTATION TABLE

Prompt Variables

Each placeholder required by the Budget-Conscious Agent Planning Prompt. Wire these into your agent harness before execution. Validation notes describe how to check the value before it enters the prompt.

PlaceholderPurposeExampleValidation Notes

[TASK_DESCRIPTION]

The high-level objective the agent must decompose into steps

Generate a competitive analysis report for the Q3 product launch

Must be a non-empty string. Reject if length < 10 characters or contains only whitespace. Check for prompt injection patterns before insertion.

[RESOURCE_BUDGET]

The total resource cap expressed as a cost ceiling, token limit, or call count

5000 tokens or $0.15 USD

Must parse to a numeric value with an optional unit label. Reject if negative, zero, or unparseable. Normalize units before comparison.

[AVAILABLE_TOOLS]

A structured list of tools the agent can invoke, each with an estimated per-call cost

[{"name":"web_search","cost_estimate":0.01,"unit":"USD"},{"name":"document_parser","cost_estimate":0.03,"unit":"USD"}]

Must be a valid JSON array. Each entry requires 'name' (string), 'cost_estimate' (positive number), and 'unit' (string). Reject if array is empty or any entry is missing required fields.

[COST_MODEL]

The rule for how costs accumulate: per-call, per-token, flat-fee, or tiered

per-call with a 1.5x multiplier for parallel invocations

Must be one of an enumerated set: 'per-call', 'per-token', 'flat-fee', 'tiered'. If 'tiered', require a tier definition schema. Reject unknown values.

[CONSTRAINT_POLICY]

Rules for what happens when the budget is exhausted: hard-stop, approval-required, or best-effort

hard-stop with a summary of completed steps

Must be one of: 'hard-stop', 'approval-required', 'best-effort'. If 'approval-required', validate that an approval callback URL or handler is configured in the harness.

[OUTPUT_SCHEMA]

The expected JSON schema for the step plan output

{"steps":[{"step_id":1,"action":"...","tool":"...","cost_estimate":0.01}],"total_estimated_cost":0.05,"budget_remaining":0.10}

Must be a valid JSON Schema object. Validate that it includes required fields: 'steps' (array), 'total_estimated_cost' (number), and 'budget_remaining' (number). Reject if schema is malformed.

[TRADE_OFF_INSTRUCTION]

Guidance on how to prioritize when the budget cannot cover all desired steps

Prefer accuracy over speed. Drop low-confidence steps first.

Must be a non-empty string. Check for contradictory instructions (e.g., 'prefer accuracy' and 'drop expensive steps' simultaneously). Flag for human review if contradictions detected.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the Budget-Conscious Agent Planning Prompt into an agent application with validation, retries, logging, and budget enforcement.

This prompt is designed to sit at the planning layer of an agent loop, invoked before any tool calls are executed. The application should call this prompt after receiving a user task but before the agent enters its execution phase. The prompt expects a declared resource budget—typically a combination of estimated tool call cost, token budget, and latency ceiling—and produces a step plan with per-step cost estimates. The harness must validate that the returned plan is structurally complete, that the sum of per-step estimates does not exceed the declared cap, and that every step references a tool that actually exists in the agent's current tool registry.

Validation and enforcement: Parse the model's JSON output and run a schema check that verifies the presence of steps (array), total_estimated_cost, budget_cap, and trade_offs (array of strings). Compute the sum of all estimated_cost fields across steps and compare against budget_cap. If the sum exceeds the cap, reject the plan and re-prompt with the violation details injected into [CONSTRAINTS]. If any step references a tool name not present in the agent's tool registry, reject and re-prompt with the available tool list. Retry logic: Allow up to two retries for budget violations or missing-tool references. After two failures, fall back to a hardcoded sequential plan that uses the cheapest available tool for each step, and log a plan_generation_fallback event. Model choice: Use a model with strong JSON-following behavior and low latency for this planning step—GPT-4o or Claude 3.5 Sonnet are reasonable defaults. Avoid small or instruction-light models that may drop fields or hallucinate tool names.

Logging and observability: Log every plan generation attempt with the model name, input budget, output plan, validation result, and any retry count. Attach a plan_id UUID to each accepted plan so downstream execution steps can be traced back to the planning decision. If the plan is rejected after all retries and the fallback is used, emit a structured log event with severity warning and include the original budget, the violation reason, and the fallback plan. Budget enforcement during execution: The agent execution loop must track cumulative tool call cost against the plan's per-step estimates. If actual cost exceeds a step's estimate by more than 20%, pause execution and re-invoke this planning prompt with the remaining budget and completed steps as [CONTEXT]. This prevents a single expensive tool call from silently consuming the remainder of the budget. Human approval gate: If the total estimated cost exceeds a configurable threshold (e.g., $2.00 or 50 tool calls), route the plan to a human reviewer before execution begins. The review interface should display the plan, per-step costs, and the remaining budget after each step. Do not skip this gate in production systems where tool costs are real and unbounded loops are possible.

IMPLEMENTATION TABLE

Expected Output Contract

Fields, data types, and validation rules for the budget-conscious agent planning output. Use this contract to validate the plan before execution.

Field or ElementType or FormatRequiredValidation Rule

plan_id

string (UUID v4)

Must parse as valid UUID v4. Auto-generated if absent.

task_description

string

Non-empty, max 500 chars. Must match the original task intent.

total_budget

number (float)

Must be > 0. Must match the [BUDGET_CAP] input value exactly.

steps

array of objects

Min 1 item. Each item must conform to the step schema below.

steps[].step_number

integer

Sequential starting at 1. No gaps or duplicates.

steps[].action

string

Non-empty. Must describe a discrete, executable action.

steps[].tool_name

string

Must match a tool name from the [AVAILABLE_TOOLS] list.

steps[].estimated_cost

number (float)

Must be >= 0. Sum of all step costs must not exceed total_budget.

steps[].depends_on

array of integers or null

If present, each integer must reference a valid prior step_number. No self-references or forward references.

estimated_total_cost

number (float)

Must equal the sum of all steps[].estimated_cost. Must be <= total_budget.

trade_offs

array of strings or null

If total_budget is insufficient for all desired steps, this must list at least one trade-off or omitted capability.

confidence_score

number (float 0-1)

Must be between 0 and 1 inclusive. Represents planner confidence in cost estimates.

PRACTICAL GUARDRAILS

Common Failure Modes

Budget-conscious planning fails in predictable ways. These are the most common failure modes when agents decompose tasks under a declared resource budget, along with concrete guardrails to prevent them.

01

Budget Overrun from Estimation Drift

What to watch: The agent underestimates per-step tool call costs, causing the cumulative total to silently exceed the declared cap during execution. This happens when cost estimates are based on optimistic assumptions or stale pricing data. Guardrail: Require the plan to include a buffer percentage (e.g., 15%) and validate that the sum of per-step estimates plus buffer stays under the cap before execution begins. Log any step where actual cost exceeds estimate by more than 20%.

02

Dependency Blindness in Cost Sequencing

What to watch: The agent orders steps for cost efficiency but violates tool dependencies, causing retries or redundant calls that blow the budget. A cheap step placed before its expensive prerequisite forces rework. Guardrail: Require the plan to explicitly declare step dependencies and validate the topological order before accepting the cost estimate. Reject plans where a dependent step appears before its prerequisite.

03

Priority Inversion Under Budget Pressure

What to watch: As the budget nears exhaustion, the agent defers or drops high-value steps while continuing low-value ones that were sequenced earlier. The plan completes within budget but delivers minimal useful output. Guardrail: Require each step to carry a priority tier and a justification. When the remaining budget falls below a threshold, re-evaluate the plan and reorder remaining steps by priority, not original sequence.

04

Static Plan with No Mid-Execution Rebudgeting

What to watch: The agent generates a plan once and executes it blindly, even when early steps consume more budget than expected. The plan becomes invalid but the agent never recalculates. Guardrail: Insert a budget checkpoint after every N steps or after any step that exceeds its estimate by more than 10%. At each checkpoint, re-forecast the remaining budget and either continue, re-plan, or escalate.

05

Trade-Off Evasion

What to watch: The agent produces a plan that fits the budget by omitting difficult or ambiguous steps without acknowledging the trade-off. The plan looks compliant but silently drops essential work. Guardrail: Require the plan to include an explicit trade-off section listing what was excluded, why, and the impact on outcome quality. Validate that no required step type is missing before accepting the plan.

06

Hallucinated Cost Figures

What to watch: The agent invents per-call costs when real pricing metadata is unavailable, producing a plan that appears budget-compliant but uses fabricated numbers. Guardrail: Require cost estimates to cite a source: either a provided pricing table, a tool metadata field, or a declared assumption with uncertainty bounds. Reject plans where any cost figure lacks a traceable source.

IMPLEMENTATION TABLE

Evaluation Rubric

Score each criterion as Pass or Fail before shipping the budget-conscious planning prompt. Use this rubric to catch plans that exceed the cap, omit cost estimates, or hide trade-offs.

CriterionPass StandardFailure SignalTest Method

Total cost within [BUDGET_CAP]

Sum of all step cost estimates is less than or equal to [BUDGET_CAP]

Total exceeds [BUDGET_CAP] or total is missing from the output

Parse the output JSON, extract all per-step cost values, sum them, and assert sum <= [BUDGET_CAP]

Every step has a cost estimate

Each step in the plan includes a non-null, non-negative numeric cost field

Any step is missing a cost field, cost is null, or cost is negative

Iterate over the steps array and assert every step object contains a cost key with a value >= 0

Cost estimates are plausible

No single step cost exceeds 50% of [BUDGET_CAP] unless explicitly justified in the trade-offs field

A single step consumes the majority of the budget without a trade-off explanation

Find max step cost, compute percentage of [BUDGET_CAP], and assert max_pct <= 50 OR trade_offs field contains justification

Trade-offs are listed when budget is tight

If total cost is within 10% of [BUDGET_CAP], the output includes a non-empty trade_offs array describing what was deprioritized

Total cost is near cap but trade_offs is missing, empty, or contains only generic statements

Compute remaining = [BUDGET_CAP] - total_cost, assert remaining > 0.1 * [BUDGET_CAP] OR trade_offs array length > 0

Step ordering respects dependencies

No step references an output from a later step as its input

A step depends on a result that has not been produced yet in the sequence

Build a dependency graph from step input/output references and assert it is acyclic with a valid topological order matching the plan sequence

Output schema matches [OUTPUT_SCHEMA]

Response parses cleanly against the expected JSON schema with all required fields present

Schema validation fails due to missing required fields, type mismatches, or extra prohibited fields

Run JSON Schema validator using [OUTPUT_SCHEMA] against the parsed output and assert no validation errors

Budget cap is restated in output

The output includes the declared [BUDGET_CAP] value in a budget_cap field for audit traceability

budget_cap field is missing or contains a value different from the input [BUDGET_CAP]

Assert output.budget_cap exists and equals the exact [BUDGET_CAP] value passed in the prompt

No hallucinated tool costs

All cost estimates reference tools or operations that exist in the provided [TOOL_CATALOG] or are clearly described as estimates for uncatalogued steps

A cost estimate references a tool name not present in [TOOL_CATALOG] without an estimation note

Extract all tool names from cost estimates, cross-reference against [TOOL_CATALOG] keys, and assert every name is found OR the step includes an estimation_method field

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Use the base prompt with a frontier model (GPT-4o, Claude 3.5 Sonnet). Remove strict output schema requirements initially—accept a markdown plan with cost estimates. Replace [BUDGET_CAP] with a hardcoded number. Skip per-step validation; just check that the stated total is under the cap.

Watch for

  • The model ignoring the budget constraint entirely and producing an unbounded plan
  • Cost estimates that are hallucinated rather than derived from your actual tool pricing
  • Plans that list steps without dollar amounts, defeating the purpose
Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.