Inferensys

Prompt

Cost-vs-Accuracy Tool Decision Prompt

A practical prompt playbook for AI platform teams managing a portfolio of models and tools at different price points. Produces a tool selection that weighs estimated accuracy against per-call cost, with explicit trade-off justification.
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

Define the job, reader, and constraints for the Cost-vs-Accuracy Tool Decision Prompt.

This prompt is for AI platform teams who manage a portfolio of overlapping tools and models at different price points. The job-to-be-done is a structured, auditable tool selection that weighs estimated accuracy against per-call cost, producing an explicit trade-off justification rather than a silent default. The ideal user is an engineering lead or platform architect integrating this prompt into a model gateway, a tool dispatch layer, or an agent loop where every tool call has a measurable cost and a measurable quality expectation. Use this prompt when you have at least two candidate tools that can satisfy the same user intent, you can estimate their relative accuracy for the task, and you need the selection rationale to be reviewable by a human or an eval system.

Do not use this prompt when there is only one available tool, when cost is irrelevant, or when accuracy differences between tools are unknown or unmeasurable. It is also the wrong choice for latency-bound routing where p95 response time is the primary constraint—use the Latency-Aware Tool Router instead. This prompt assumes you have already defined tool schemas with cost and capability metadata. If your tool descriptions lack cost annotations, start with the Operational Constraint Declaration Prompt to augment your schemas before wiring this selection prompt into your harness. The prompt is designed for single-step tool selection, not for multi-tool orchestration or cumulative budget tracking across a workflow; for those scenarios, pair it with the Cost Cap Enforcement Prompt.

The prompt requires the following inputs to be useful: a user intent description, a list of candidate tools with their estimated accuracy scores and per-call costs, a declared accuracy threshold or budget cap, and any hard constraints such as required tools or forbidden tools. The output is a structured decision containing the selected tool, the estimated cost, the accuracy justification, and any trade-off notes. Before deploying, build eval checks that detect unnecessary premium-tool selection when a cheaper tool meets the accuracy threshold, and accuracy regression when the selected tool falls below the minimum bar. Wire the prompt into a harness that logs every selection decision with the inputs, outputs, and model version for auditability. If the decision involves write operations or high-cost calls above a configured threshold, route the output to a human approval queue before execution.

PRACTICAL GUARDRAILS

Use Case Fit

Where the Cost-vs-Accuracy Tool Decision Prompt works, where it fails, and what you must have in place before using it in production.

01

Good Fit: Multi-Tier Tool Portfolios

Use when: you have at least two tools or models that can satisfy the same intent at different price points and accuracy levels. Guardrail: define a measurable accuracy metric and a per-call cost ceiling before routing. Without both, the trade-off is guesswork.

02

Bad Fit: Single-Tool or Fixed-Stack Deployments

Avoid when: only one tool exists for the task or the tool choice is hardcoded upstream. Guardrail: if there is no real selection to make, use a simpler dispatch prompt. Adding cost-vs-accuracy reasoning to a single-option path wastes tokens and introduces unnecessary variability.

03

Required Input: Cost and Accuracy Metadata

Risk: the model cannot estimate cost or accuracy from tool names alone. Guardrail: every candidate tool must carry declared cost-per-call, expected accuracy, and latency profile in its schema or injected context. Missing metadata produces plausible-sounding but wrong trade-off decisions.

04

Required Input: User-Declared or Policy-Defined Budget

Risk: without an explicit cost budget or accuracy floor, the model defaults to an unpredictable preference. Guardrail: inject a concrete budget cap, accuracy threshold, or tier label into the prompt context. Make the constraint machine-readable so eval checks can verify adherence.

05

Operational Risk: Silent Premium-Tool Overuse

Risk: the model may select the expensive high-accuracy tool even when the cheaper tool would suffice, inflating costs without measurable benefit. Guardrail: add an eval that flags premium-tool selections and requires a justification sentence. Log the justification for cost audit.

06

Operational Risk: Accuracy Regression Under Cost Pressure

Risk: aggressive cost caps push the model to select the cheapest tool, degrading output quality below acceptable thresholds. Guardrail: define a minimum accuracy floor and test the prompt against a golden dataset that includes edge cases where the cheap tool is known to fail. Block selections that drop below the floor.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A reusable prompt template for selecting the optimal tool by balancing estimated accuracy against per-call cost, with explicit trade-off justification.

This prompt template is designed for AI platform teams managing a portfolio of models and tools at different price points. It instructs the model to evaluate candidate tools not just on semantic fit, but on the explicit trade-off between predicted accuracy and per-call cost. The output includes a structured decision with justification, making the selection rationale auditable and debuggable. Use this template when cost is a first-class constraint and you need the model to justify why a premium tool was chosen over a cheaper alternative.

text
You are a tool selection router. Your task is to choose the best tool for the user's request by balancing estimated accuracy against per-call cost.

## Available Tools
[TOOLS]

## User Request
[INPUT]

## Operational Context
- Budget Cap: [BUDGET_CAP]
- Acceptable Accuracy Threshold: [ACCURACY_THRESHOLD]
- Current Spend: [CURRENT_SPEND]

## Instructions
1. For each candidate tool, estimate the accuracy (0.0-1.0) and note the per-call cost.
2. Eliminate any tool whose estimated accuracy falls below [ACCURACY_THRESHOLD].
3. From the remaining candidates, select the tool that minimizes cost while meeting the accuracy threshold.
4. If the cheapest qualifying tool exceeds the remaining budget ([BUDGET_CAP] - [CURRENT_SPEND]), select the cheapest qualifying tool anyway but flag a budget overrun.
5. If no tool meets the accuracy threshold, select the highest-accuracy tool available and flag a quality risk.

## Output Schema
Return a JSON object with the following structure:
{
  "selected_tool": "string",
  "estimated_accuracy": number,
  "estimated_cost": number,
  "budget_remaining": number,
  "budget_overrun": boolean,
  "quality_risk": boolean,
  "candidates_evaluated": [
    {
      "tool": "string",
      "estimated_accuracy": number,
      "cost": number,
      "disqualification_reason": "string | null"
    }
  ],
  "justification": "string explaining the trade-off decision"
}

## Constraints
- Do not select a tool with estimated accuracy below [ACCURACY_THRESHOLD] unless no tool qualifies.
- Always evaluate all provided tools before making a selection.
- If two tools have identical cost and accuracy, prefer the one with lower latency.
- Never invent tools not present in the [TOOLS] list.

To adapt this template, replace the square-bracket placeholders with your specific context. The [TOOLS] placeholder should contain a structured list of tool definitions, each including a name, description, per-call cost, and any accuracy hints (e.g., 'gpt-4o-search: high accuracy, $0.03/call' vs. 'gpt-4o-mini-search: moderate accuracy, $0.003/call'). The [ACCURACY_THRESHOLD] should be a number between 0.0 and 1.0 that reflects your application's quality floor. For high-risk domains, set this threshold conservatively and always route quality-risk flagged outputs to human review. Before deploying, validate that the model's JSON output matches the schema exactly—malformed JSON in tool selection can break downstream orchestration silently.

IMPLEMENTATION TABLE

Prompt Variables

Required inputs for the Cost-vs-Accuracy Tool Decision Prompt. Each placeholder must be populated before the prompt is assembled and sent to the model. Missing or malformed variables cause the model to default to unsafe cost assumptions or skip accuracy trade-off reasoning.

PlaceholderPurposeExampleValidation Notes

[USER_INTENT]

The user's request or task description that requires tool selection

Summarize the last 30 days of error logs from the payment-service cluster

Must be non-empty string. Truncate to 2000 characters. Reject if intent is ambiguous without clarification context

[CANDIDATE_TOOLS]

JSON array of available tools with cost, accuracy, and capability metadata

[{"name":"premium-log-analyzer","cost_per_call_usd":0.12,"estimated_accuracy":0.96,"capabilities":["log-analysis","anomaly-detection"]},{"name":"basic-log-scanner","cost_per_call_usd":0.01,"estimated_accuracy":0.82,"capabilities":["log-analysis"]}]

Must parse as valid JSON array with at least 2 tools. Each tool requires name, cost_per_call_usd, estimated_accuracy fields. Reject if accuracy values are outside 0.0-1.0 range

[COST_BUDGET_USD]

Maximum allowable cost for this tool call in USD

0.15

Must be positive float or integer. Reject if null or negative. Convert string representations to float before validation

[MINIMUM_ACCURACY_THRESHOLD]

Lowest acceptable accuracy score below which no tool should be selected

0.80

Must be float between 0.0 and 1.0. Default to 0.70 if not provided. Reject if threshold exceeds all candidate tool accuracy values

[OPERATIONAL_CONSTRAINTS]

JSON object with latency budget, permission scope, and rate limit state

{"max_latency_ms":500,"caller_permissions":["log-analysis"],"rate_limit_remaining":42}

Must parse as valid JSON. max_latency_ms must be positive integer. caller_permissions must be string array. rate_limit_remaining must be non-negative integer

[PREVIOUS_SELECTIONS]

Array of recent tool selections in this session for cost tracking and consistency

[{"tool":"basic-log-scanner","cost_usd":0.01,"timestamp":"2025-01-15T10:30:00Z"}]

Must parse as valid JSON array or null if first call. Validate timestamps are ISO 8601. Sum costs to check against cumulative budget if applicable

[TRADE_OFF_PREFERENCE]

Enum indicating whether to prefer cost savings or accuracy when both are acceptable

prefer_cost

Must be one of: prefer_cost, prefer_accuracy, balanced. Default to balanced if not provided. Reject unrecognized values

[OUTPUT_SCHEMA]

Expected JSON schema for the tool selection decision output

{"selected_tool":"string","estimated_cost_usd":"float","estimated_accuracy":"float","trade_off_rationale":"string","fallback_tool":"string|null"}

Must be valid JSON Schema or example structure. Validate that required fields include selected_tool, estimated_cost_usd, and trade_off_rationale. Reject schemas missing cost justification field

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the Cost-vs-Accuracy Tool Decision Prompt into a production tool selection layer with validation, retries, and audit logging.

This prompt is designed to sit inside a tool selection middleware that evaluates candidate tools before dispatch. The application layer should first assemble the list of candidate tools with their declared cost tiers (e.g., cost_tier: premium, cost_tier: standard, cost_tier: basic) and estimated accuracy ranges. The prompt receives this candidate set along with the user intent and any operational constraints, then returns a structured decision. Do not use this prompt for real-time latency-critical paths where sub-50ms decisions are required; the model inference time alone will exceed that budget. Instead, use it for asynchronous or pre-flight tool selection where the cost-vs-accuracy trade-off justifies a few hundred milliseconds of reasoning.

Validation and retry logic must wrap the model output before any tool is dispatched. Parse the JSON response and validate: (1) the selected_tool exists in the provided candidate list, (2) the estimated_cost falls within the declared cost tier for that tool, (3) the accuracy_estimate is a float between 0.0 and 1.0, and (4) the tradeoff_justification field is non-empty and references at least one constraint from the input. If validation fails, retry once with the validation error injected into the prompt as additional context. If the retry also fails, fall back to a deterministic rule: select the cheapest tool that meets the minimum accuracy threshold, log the fallback event, and surface the degraded decision to the operations dashboard.

Logging and audit are critical because this prompt makes a cost-bearing decision. Every invocation should produce a structured audit record containing: the full candidate tool list with cost tiers, the model's selected tool and justification, the validation result, any retry attempts, and the final dispatched tool. Store these records in your observability pipeline with the decision_id as the primary key. For high-stakes workflows where selecting a premium tool incorrectly could waste significant budget, add a human review gate for decisions where the cost delta between the selected tool and the cheapest viable alternative exceeds a configurable threshold (e.g., $0.50 per call). Route those decisions to a review queue with a short TTL to avoid blocking the user experience.

Model choice matters for this prompt. Use a model with strong structured output and reasoning capabilities (GPT-4o, Claude 3.5 Sonnet, or equivalent). Avoid smaller models that may collapse the trade-off reasoning into a simplistic pattern. If you observe the model consistently favoring premium tools without adequate justification, add a cost-bias penalty to your eval rubric and consider injecting a counterexample into the prompt showing a case where the standard tool was correctly chosen over the premium option. Monitor for accuracy regression by periodically sampling decisions where the basic or standard tool was selected and running a side-by-side comparison against the premium tool's output on the same input, flagging cases where the accuracy delta exceeds your acceptable threshold.

IMPLEMENTATION TABLE

Expected Output Contract

Validate the model's tool selection decision and trade-off justification against this contract before routing to execution.

Field or ElementType or FormatRequiredValidation Rule

selected_tool

string (tool name)

Must match an entry in the [TOOL_CATALOG] array. Reject if tool name is hallucinated or not in the provided catalog.

estimated_accuracy

number (0.0-1.0)

Must be a float between 0 and 1 inclusive. Reject if missing, non-numeric, or outside range. Compare against [ACCURACY_BENCHMARK] if provided.

estimated_cost

number (float, USD)

Must be a non-negative float. Reject if negative or non-numeric. Must not exceed [MAX_BUDGET] if budget cap is active.

trade_off_rationale

string (1-3 sentences)

Must contain explicit comparison between at least two candidate tools. Reject if rationale is generic, empty, or fails to mention cost-vs-accuracy trade-off.

rejected_alternatives

array of strings (tool names)

Must contain at least one tool name from [TOOL_CATALOG] that was considered but not selected. Reject if empty or contains only the selected tool.

confidence_score

number (0.0-1.0)

If present, must be a float between 0 and 1. If below [CONFIDENCE_THRESHOLD], flag for human review before execution.

requires_human_approval

boolean

Must be true if estimated_cost exceeds [APPROVAL_THRESHOLD] or if selected_tool is in [RESTRICTED_TOOLS]. Reject if false when conditions are met.

PRACTICAL GUARDRAILS

Common Failure Modes

Cost-vs-accuracy tool selection breaks in predictable ways. These are the most common production failure modes and how to guard against them before they reach users.

01

Premium Tool Over-Selection

What to watch: The model defaults to the most capable tool even when a cheaper alternative would produce equivalent results. This happens when tool descriptions emphasize capability without surfacing cost differentials, or when the prompt lacks explicit cost-awareness instructions. Guardrail: Include per-call cost estimates in tool metadata and add a hard constraint in the system prompt requiring the model to justify any premium tool selection with a specific accuracy requirement the cheaper tool cannot meet.

02

Accuracy Regression from Cost-Driven Substitution

What to watch: The model aggressively substitutes a cheaper tool to stay under budget but the cheaper tool produces degraded outputs that downstream systems cannot tolerate. This is common when cost caps are enforced without accuracy floors. Guardrail: Define minimum accuracy thresholds per task type and require the model to estimate whether the cheaper tool meets that threshold before substituting. Log substitution decisions with accuracy estimates for post-hoc review.

03

Silent Budget Exhaustion

What to watch: The model continues selecting premium tools without tracking cumulative spend, exhausting the budget mid-workflow and leaving partial results with no fallback. This happens when cost tracking is per-call rather than cumulative across a session. Guardrail: Inject running budget state into each tool selection decision and require the model to project remaining budget before selecting. Halt premium tool use when projected spend exceeds remaining budget by a defined margin.

04

Trade-Off Justification Drift

What to watch: The model initially provides reasoned cost-vs-accuracy justifications but gradually degrades into boilerplate explanations that do not reflect the actual decision. This makes audit trails unreliable and hides poor selections. Guardrail: Include a structured justification schema with required fields for estimated accuracy delta, cost delta, and specific capability gap. Validate that justifications contain task-specific reasoning rather than generic phrases before accepting the tool call.

05

Stale Cost and Accuracy Estimates

What to watch: The model relies on static cost and accuracy metadata embedded in tool descriptions, but actual costs change due to model updates, pricing shifts, or load-based degradation. Selections become suboptimal without the model knowing. Guardrail: Inject live cost and accuracy signals at decision time from an operational data source rather than relying solely on static tool descriptions. Version tool metadata and flag selections made with stale data for review.

06

Overfitting to a Single Constraint

What to watch: The model optimizes aggressively for cost while violating latency budgets, or hits accuracy targets while ignoring permission boundaries. Single-constraint optimization produces selections that fail on other operational dimensions. Guardrail: Encode all active constraints as hard requirements in the selection prompt, not as ranked preferences. Require the model to verify every constraint before outputting a selection, and reject selections that fail any constraint check in pre-execution validation.

IMPLEMENTATION TABLE

Evaluation Rubric

Criteria for evaluating the Cost-vs-Accuracy Tool Decision Prompt before production deployment. Each row defines a pass standard, a failure signal, and a test method to catch regressions early.

CriterionPass StandardFailure SignalTest Method

Cost-accuracy trade-off justification

Output includes explicit reasoning that weighs estimated accuracy against per-call cost for each candidate tool

Selection rationale is missing, generic, or ignores cost data entirely

Assert that the [JUSTIFICATION] field contains a non-empty string referencing both cost and accuracy for the chosen tool

Unnecessary premium-tool selection

Premium tool is selected only when cheaper tools fail accuracy, latency, or capability requirements stated in [CONSTRAINTS]

Premium tool selected when a cheaper tool satisfies all declared constraints with acceptable accuracy

Run 20 test cases where a cheaper tool meets constraints; flag any case where premium tool is chosen without a documented accuracy gap

Accuracy regression detection

Selected tool's documented accuracy meets or exceeds the minimum threshold in [ACCURACY_THRESHOLD]

Tool chosen falls below the accuracy threshold without an explicit override justification

Parse [SELECTED_TOOL] and cross-reference its accuracy metadata against [ACCURACY_THRESHOLD]; fail if below threshold and [OVERRIDE_REASON] is null

Cost cap adherence

Estimated per-call cost of the selected tool does not exceed [MAX_COST_PER_CALL]

Selected tool's cost exceeds the cap without a flagged exception in [COST_OVERRIDE]

Extract cost from [COST_ESTIMATE] field and assert it is less than or equal to [MAX_COST_PER_CALL] unless [COST_OVERRIDE] is true

Fallback tool ordering

When primary tool is rejected, fallback tools are ordered by ascending cost within acceptable accuracy band

Fallback list is empty when primary fails, or fallback ordering ignores cost

Validate that [FALLBACK_TOOLS] array is non-empty when [SELECTED_TOOL] is rejected, and that costs are non-decreasing

Output schema compliance

Response is valid JSON matching the declared [OUTPUT_SCHEMA] with all required fields present

Missing [SELECTED_TOOL], [JUSTIFICATION], or [COST_ESTIMATE] fields; extra fields that violate schema

Validate output against [OUTPUT_SCHEMA] using a JSON schema validator; reject on missing required fields or type mismatches

Confidence calibration

Confidence score in [CONFIDENCE] correlates with decision difficulty: lower confidence when tools have similar cost-accuracy profiles

High confidence assigned to selections where multiple tools are nearly equivalent in cost and accuracy

Compare [CONFIDENCE] values across a test set with known ambiguity; flag if confidence exceeds 0.9 when top two tools differ by less than 5% in cost-accuracy score

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Start with the base prompt and a hardcoded tool catalog of 3–5 tools with declared cost and accuracy estimates. Use a simple JSON schema for the output. Skip budget tracking and just ask the model to pick the cheapest tool that meets a minimum accuracy threshold.

code
You are a tool router. Given the user intent [INTENT] and the tool catalog below, select the lowest-cost tool with estimated accuracy ≥ [MIN_ACCURACY].

Tool Catalog:
[TOOL_CATALOG_JSON]

Return JSON: {"selected_tool": string, "estimated_cost": number, "estimated_accuracy": number, "rationale": string}

Watch for

  • Missing accuracy estimates causing the model to default to the cheapest tool regardless of quality
  • Overly broad intent descriptions that don't constrain the selection enough
  • No validation of the output schema before acting on the selection
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.