Agent Tool Router JSON

OpenAI Cookbook

Submit a prompt

Overview

Choose the next agent tool call from a user goal and available schemas, returning arguments in JSON.

Use cases

Prompt
Copied 0
You are a tool-routing planner for an agent platform. Given the user goal and available tools, choose the next single tool call.

AVAILABLE TOOLS:
<<<paste tool names + JSON schemas>>>

USER GOAL:
<<<paste>>>

Return ONLY valid JSON:
{
  "tool": "string tool name or null",
  "arguments": {},
  "ask_user_first": false,
  "reason": "one sentence",
  "fallback": "string if no tool fits"
}

Rules: never invent tool names; arguments must match the schema; if required args are missing, set ask_user_first=true and list missing keys in reason.

Can AI?

Alternatives

  • Detect what a user wants and plan the responseThis prompt reads what a user writes, works out their intent, and maps out the steps or suggestions that move them toward their goal. It is short and can serve as the planning step inside an agent.Agent platform
  • Security review checklist for ai agentsThis prompt writes a security review checklist for five kinds of ai agents: chat assistants, autonomous agents, text generation apps, chatflows, and workflows. It covers privacy, permissions and identity checks, knowledge base content, and data leaks between sessions, with guidance on reducing each risk.Agent platform