This prompt is for agent developers and AI engineers who need to convert a written tool selection policy—a set of rules dictating which tool to call and how to populate its arguments—into a compact set of few-shot examples. The job-to-be-done is behavioral teaching: you want the model to internalize a decision boundary through demonstrations rather than through a long, procedural system prompt. The ideal user has a documented policy, a defined set of function schemas, and a need to reduce token costs or improve tool-selection accuracy in production. Required context includes the raw policy text, the JSON schema for each available tool, and a set of representative user requests that span the policy's decision surface.
Prompt
Tool Selection Policy to Argument Construction Example Prompt

When to Use This Prompt
Defines the job-to-be-done, ideal user, required context, and when not to use this prompt for converting tool selection policies into function-calling demonstrations.
You should use this prompt when your current instruction-based approach is brittle, verbose, or produces inconsistent tool choices. It is particularly effective when the policy involves nuanced trade-offs—for example, choosing between a fast cached lookup and a live API call based on data freshness requirements. The prompt works by having the model analyze the policy, identify distinct decision scenarios, and generate user_request -> tool_call pairs that demonstrate correct selection and argument construction. The output is not just a list of examples; it should include a coverage map showing which policy clauses each example addresses, allowing you to audit for gaps before deployment.
Do not use this prompt when the tool selection policy is trivial (a single tool or a simple keyword match), when the policy changes faster than you can regenerate and revalidate examples, or when the available tools have overlapping functionality that requires real-time context the model cannot access during example generation. This prompt is also inappropriate for high-risk agentic workflows where tool calls trigger irreversible actions (e.g., financial transactions, patient record modifications) without a human-in-the-loop review step. In those cases, the generated examples should feed into a separate approval harness, not directly into an autonomous agent. After using this prompt, your next step is to run the generated examples through an eval harness that measures tool selection accuracy and argument hallucination rates against a golden test set derived from your policy.
Use Case Fit
Where the Tool Selection Policy to Argument Construction Example Prompt works and where it does not.
Good Fit: Multi-Tool Agent Environments
Use when: Your agent has access to 3+ tools with overlapping functionality and needs to learn nuanced selection criteria. Why: Few-shot examples teach the model to disambiguate tools based on subtle differences in user intent, which is difficult to encode in procedural instructions alone.
Bad Fit: Single-Tool or Zero-Tool Setups
Avoid when: The agent has only one tool or no tools at all. Why: Tool selection examples add unnecessary tokens and can confuse the model into expecting tool calls when none are available. Use direct instruction prompts instead.
Required Input: Complete Tool Schemas
What to watch: Examples that reference tool names or parameters not present in the actual function-calling schema. Guardrail: Validate that every tool name, parameter, and enum value in your examples exactly matches the live tool definitions. Schema drift between examples and reality causes hallucinated arguments.
Operational Risk: Argument Hallucination
What to watch: The model correctly selects the right tool but populates arguments with plausible-sounding values not present in the user's request. Guardrail: Implement argument grounding checks that verify every extracted parameter value appears in or is directly inferable from the user input. Log and flag fabricated arguments for review.
Operational Risk: Tool Selection Overfitting
What to watch: Examples that are too specific to a narrow set of user phrasings cause the model to miss valid tool selections when users rephrase requests. Guardrail: Include diverse paraphrases in your example set and run regression tests with varied user inputs before deployment. Monitor tool selection accuracy across different user segments.
Boundary: When to Use Instructions Instead
What to watch: Tool selection policies that change frequently or have many conditional branches become hard to maintain as examples. Guardrail: If your policy changes weekly or has more than 10 distinct selection rules, prefer a system prompt with explicit rules plus a smaller set of illustrative examples. Reserve example-heavy approaches for stable, well-defined tool landscapes.
Copy-Ready Prompt Template
A reusable prompt template that converts tool selection policies into function-calling demonstrations.
This prompt template transforms a written tool selection policy into a set of few-shot examples that teach a model which tool to pick and how to construct its arguments. The template is designed for agent developers who need to move from abstract rules—such as 'use the search tool for factual queries and the calculator for arithmetic'—to concrete user-request-to-tool-call pairs that can be inserted directly into a system prompt or fine-tuning dataset. Each generated example includes the user's natural-language request, the correct tool name, and a fully populated arguments object. The prompt also produces negative examples showing incorrect tool selections and common argument errors, which are critical for preventing hallucinated parameters and tool misuse in production.
textYou are converting a tool selection policy into few-shot function-calling demonstrations. ## TOOLS AVAILABLE [TOOLS] ## TOOL SELECTION POLICY [POLICY] ## OUTPUT SCHEMA Return a JSON object with the following structure: { "positive_examples": [ { "user_request": "string (the natural-language user input)", "selected_tool": "string (exact tool name from TOOLS)", "arguments": { }, "rationale": "string (one-sentence explanation of why this tool was selected)" } ], "negative_examples": [ { "user_request": "string", "incorrect_tool": "string (a plausible but wrong tool choice)", "incorrect_arguments": { }, "error_type": "string (wrong_tool | hallucinated_parameter | missing_required | type_mismatch)", "correct_tool": "string", "correct_arguments": { }, "rationale": "string (why the incorrect choice fails and what the correct choice is)" } ], "boundary_examples": [ { "user_request": "string (ambiguous, multi-intent, or out-of-scope request)", "expected_behavior": "string (ask_clarification | refuse | escalate | fallback_tool)", "rationale": "string" } ] } ## CONSTRAINTS - Generate exactly [NUM_POSITIVE] positive examples and [NUM_NEGATIVE] negative examples. - Cover every tool listed in TOOLS at least once across the positive examples. - Negative examples must include at least one instance of each error_type. - Arguments must use the exact parameter names and types defined in TOOLS. - Never invent parameters that are not in the tool definitions. - For boundary examples, include requests that fall between tool capabilities, have conflicting intents, or are outside the policy scope. - If [RISK_LEVEL] is "high", add an "approval_required" boolean field to each example and set it to true for any tool call that modifies data, sends messages, or accesses sensitive resources. ## EXAMPLES OF DESIRED OUTPUT [EXAMPLES] ## INPUT Generate the demonstration set for the policy and tools above.
To adapt this template, replace the square-bracket placeholders with your actual values. [TOOLS] should contain the full function definitions in your model's native tool format—include parameter names, types, descriptions, and required fields exactly as the model will see them at inference time. [POLICY] is the natural-language policy document you are converting; paste it in full, including any priority rules, conflict resolution instructions, and domain-specific constraints. [NUM_POSITIVE] and [NUM_NEGATIVE] control the size of the generated example set; start with 5–8 positive and 3–5 negative examples for most policies, then increase if coverage gaps appear during evaluation. [EXAMPLES] is optional but strongly recommended—provide 1–2 completed demonstrations in the exact output schema to anchor the model's format and quality expectations. Set [RISK_LEVEL] to "high" if any tool in your set can modify data, send external communications, or access production systems; this activates the approval flag and ensures your downstream harness can gate those calls behind human review. After generating the examples, run them through your tool selection eval suite to measure selection accuracy and argument hallucination rates before inserting them into your agent's system prompt.
Prompt Variables
Required inputs for the Tool Selection Policy to Argument Construction Example Prompt. Each placeholder must be populated before the prompt can generate reliable tool-call demonstrations.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[TOOL_SCHEMAS] | JSON array of available tool definitions with names, descriptions, and parameter schemas | [ {"name": "search_kb", "description": "Search the knowledge base", "parameters": {"query": "string", "max_results": "integer"}} ] | Validate as valid JSON array. Each tool must have name, description, and parameters fields. Schema parse check required. |
[USER_REQUEST] | Natural language user input that should trigger a tool call | "Find me the latest pricing for enterprise plan" | Must be a non-empty string. Should represent a realistic user query that maps to at least one available tool. Null not allowed. |
[CORRECT_TOOL_NAME] | The expected tool the model should select for this request | "search_kb" | Must match exactly one tool name from [TOOL_SCHEMAS]. Case-sensitive match required. Validate against tool list. |
[CORRECT_ARGUMENTS] | The expected arguments the model should construct for the selected tool | {"query": "enterprise plan pricing", "max_results": 5} | Must be valid JSON object. All required parameters from the selected tool schema must be present. No hallucinated parameter names allowed. |
[NEGATIVE_TOOL_NAME] | A plausible but incorrect tool name for teaching avoidance patterns | "get_pricing_api" | Must be a plausible but incorrect tool name not present in [TOOL_SCHEMAS]. Used to teach the model to reject unavailable tools. Null allowed if no negative example needed. |
[NEGATIVE_ARGUMENTS] | Plausible but incorrect arguments that demonstrate common hallucination patterns | {"plan_type": "enterprise"} | Must contain at least one parameter not in the target tool schema or a missing required parameter. Used to teach argument discipline. Null allowed. |
[CLARIFICATION_TRIGGER] | User request that should cause the model to ask for clarification instead of calling a tool | "I need help with something" | Must be a string that is ambiguous or missing required parameters across all available tools. Used to teach when not to call any tool. Null allowed if no clarification example needed. |
[OUTPUT_FORMAT] | Expected structure of the demonstration output including tool call and reasoning | {"reasoning": "string", "tool_name": "string|null", "arguments": "object|null", "clarification_question": "string|null"} | Must be valid JSON schema definition. All fields must have type annotations. Nullable fields must be explicitly marked. Schema parse check required. |
Implementation Harness Notes
How to wire the tool selection and argument construction prompt into an agent application with validation, retries, and observability.
This prompt is designed to sit inside an agent's tool-calling loop, converting a user request and a list of available tool schemas into a specific function call. The implementation harness must treat the model's output as a structured function invocation, not free text. The application layer should parse the model's response into a tool name and a dictionary of arguments, then validate both against the actual tool registry before execution. This prompt is not a standalone chatbot; it is a component that feeds into a tool executor, and the harness is responsible for enforcing the contract between the model's suggestion and the system's capabilities.
To wire this into an application, start by constructing the prompt payload with three dynamic inputs: the user's natural-language request, a JSON array of available tool definitions (each with a name, description, and a JSON Schema for parameters), and a set of few-shot examples that demonstrate correct tool selection and argument construction. The model should be called with tool_choice set to "required" or the equivalent for your provider, forcing a structured tool-call response rather than a text completion. After receiving the response, validate the tool name against the registry; if the model hallucinates a tool that doesn't exist, log the mismatch and either retry with a stronger constraint or fall back to a clarification request. For the arguments, validate them against the tool's parameter schema using a JSON Schema validator. Common failure modes include the model inventing parameter names, omitting required fields, or passing values of the wrong type. If validation fails, construct a retry prompt that includes the original request, the invalid tool call, and the specific validation errors, asking the model to correct only the argument payload. Limit retries to two attempts before escalating to a human or a fallback model.
For production observability, log every tool selection event with the user request, the model's chosen tool, the raw arguments, the validation result, and whether the tool execution succeeded. This trace data is essential for measuring tool selection accuracy and argument hallucination rates over time. Use these logs to build an eval set: sample 100–200 real user requests, run them through the prompt, and check whether the selected tool and arguments match expected behavior. Pay special attention to near-miss failures where the model picks a plausible but incorrect tool—these are the hardest to detect without structured evaluation. If your agent operates in a high-risk domain where incorrect tool execution could cause harm, insert a human approval step before any tool call that modifies external state, creates financial transactions, or accesses sensitive data. The prompt itself should not be the only safety boundary; the harness must enforce execution gates.
Expected Output Contract
Defines the required fields, types, and validation rules for each tool-call demonstration generated by the prompt. Use this contract to build a parser, validator, and retry logic in your application harness.
| Field or Element | Type or Format | Required | Validation Rule |
|---|---|---|---|
[USER_REQUEST] | string | Must be a non-empty string. Validate length > 0. If null or empty, reject the example row. | |
[SELECTED_TOOL] | string | Must exactly match a tool name from the provided [TOOL_LIST]. Validate against an allowlist of tool names. | |
[TOOL_ARGUMENTS] | object | Must be a valid JSON object. Validate parse success. Keys must match the selected tool's parameter schema from [TOOL_SCHEMAS]. | |
[ARGUMENT_RATIONALE] | string | Must be a non-empty string explaining why each argument value was chosen. Validate length > 20 characters to prevent empty rationales. | |
[REJECTED_TOOLS] | array of strings | If present, each element must be a tool name from [TOOL_LIST] not selected. Validate all elements are in the allowlist and none equal [SELECTED_TOOL]. | |
[REJECTION_REASON] | string | Required if [REJECTED_TOOLS] is non-empty. Must explain why each rejected tool was inappropriate. Validate presence when [REJECTED_TOOLS] has elements. | |
[CONFIDENCE_SCORE] | number | If present, must be a float between 0.0 and 1.0. Validate range. If absent, the application should treat confidence as null, not default to 1.0. | |
[HALLUCINATION_CHECK] | object | Must contain keys 'arguments_in_schema' (boolean) and 'tool_exists' (boolean). Validate both are true before accepting the example. If false, trigger retry or discard. |
Common Failure Modes
When converting tool selection policies into few-shot demonstrations, these failures surface first in production. Each card pairs a specific failure with a concrete guardrail you can implement before deployment.
Tool Selection Confusion Under Ambiguity
What to watch: The model selects the wrong tool when user requests overlap multiple tool capabilities, especially when examples don't cover boundary cases. A request like 'find and update the record' triggers search instead of update because the demonstration set only shows isolated tool calls. Guardrail: Include at least one example per ambiguous tool pair showing explicit disambiguation logic. Add a pre-selection classification step that narrows tool candidates before argument construction.
Hallucinated Parameters from Underspecified Examples
What to watch: The model invents parameter values (IDs, timestamps, enums) when demonstrations show populated arguments but the user request omits those fields. If every example shows a complete user_id field, the model will hallucinate one rather than asking for clarification. Guardrail: Include at least one demonstration where a required parameter is missing and the correct behavior is to return a clarification request, not to guess. Validate output arguments against input context before execution.
Argument Format Drift Across Model Versions
What to watch: Demonstrations that work perfectly on one model version produce malformed arguments on another, especially for nested objects, date formats, and enum serialization. A date shown as '2024-01-15' in examples may be output as 'January 15th' after a model update. Guardrail: Pin argument format expectations with explicit format notes alongside examples. Run schema validation on generated arguments in your harness, not just in the prompt. Maintain version-specific golden test sets.
Overfitting to Demonstration Tool Sequence
What to watch: The model mimics the exact sequence of tool calls from examples even when the current request requires a different order or subset. If demonstrations always show search-then-update, the model applies that pattern to read-only requests. Guardrail: Include demonstrations with varied tool sequences, single-tool calls, and early termination. Add a constraint in the system prompt that tool selection must be justified from the user request, not from example patterns.
Silent Argument Dropping on Long Contexts
What to watch: When the prompt contains many demonstrations plus a long user request, the model drops optional or later-positioned arguments from the tool call. A filters object with three conditions becomes one condition with no warning. Guardrail: Place the most critical argument demonstrations closest to the user request. Implement post-generation argument completeness checks that compare required fields against the tool schema. Log dropped-argument rates by context length.
Policy-to-Example Coverage Gaps
What to watch: The original tool selection policy contains rules that never appear in the demonstration set, so the model never learns them. A policy requiring 'never call delete tools without confirmation' is absent from examples, and the model happily constructs delete arguments. Guardrail: Map every policy clause to at least one demonstration or counterexample before deployment. Use a coverage matrix that traces each policy rule to specific examples. Run adversarial tests that probe for untaught policy violations.
Evaluation Rubric
Use this rubric to evaluate the quality of few-shot examples generated for tool selection and argument construction before integrating them into an agent harness.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Tool Selection Accuracy | Correct tool chosen for each user request in the example set | Wrong tool selected or hallucinated tool name | Compare selected tool against a golden label for each example |
Argument Schema Compliance | All required parameters are present and no extra parameters are hallucinated | Missing required field or unknown parameter present in the tool call | Validate generated arguments against the function's JSON Schema definition |
Argument Value Grounding | Argument values are directly extracted or reasonably inferred from the user request | Argument value is fabricated without any basis in the user input | Manual spot-check or LLM-as-judge comparison of arguments to source text |
Ambiguity Handling | Model asks for clarification or selects a safe default when the user request is ambiguous | Model guesses a specific value for a critically ambiguous parameter without asking | Test with deliberately underspecified user requests and check for clarification behavior |
Negative Example Quality | Negative examples clearly show incorrect tool choice or argument misuse with explanation | Negative example is confusing, trivial, or teaches an incorrect pattern | Review that the negative example output is structurally invalid or semantically wrong |
Schema Drift Resistance | Examples use the current tool schema and argument types without deprecated fields | Example contains a field removed in the latest API version or uses an incorrect type | Automated schema validation of all tool calls in the example set against the live spec |
Token Efficiency | Example set achieves correct behavior with fewer tokens than the equivalent procedural instruction | Example set is longer than the original instruction without measurable accuracy gain | Compare token count of instruction-only prompt vs. example-based prompt at equal accuracy |
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Adapt This Prompt
How to adapt
Start with the base prompt and 3-5 tool-selection examples. Use inline comments to annotate why each tool was chosen. Skip formal eval harnesses; manually spot-check argument correctness against your function signatures.
Prompt modification
code[SYSTEM] You are an agent that selects tools and constructs arguments. [EXAMPLES] User: [USER_REQUEST] Tool: [TOOL_NAME] Arguments: [ARGUMENTS_JSON] # Why: [BRIEF_RATIONALE]
Watch for
- Argument hallucination on optional parameters
- Tool selection drift when requests are ambiguous
- No validation of argument types against function schemas

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.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us