Skip to main content
Glama

llm_select_agent

Routes task prompts to the recommended agent and model by classifying complexity and applying your budget profile, enabling correct session-level setup.

Instructions

Classify a task prompt and return the recommended agent CLI + model for session-level routing.

Use this BEFORE starting a Claude Code / Codex / Gemini CLI session to pick the right agent runtime for the task. This is session-level routing — it selects which agent to invoke, not which model to call mid-session.

Decision tree (profile × complexity): budget + simple/moderate → codex + gpt-4o-mini budget + complex → codex + gpt-4o (Codex handles most coding; escalate if needed) balanced + simple → codex + gpt-4o-mini balanced + moderate → claude_code + sonnet balanced + complex → claude_code + opus premium + any → claude_code + opus

Returns JSON with: primary — agent binary name: "claude_code" | "codex" | "gemini_cli" primary_model — model flag value (pass via -m or --model) fallback — fallback agent if primary unavailable fallback_model — model for fallback task_type — classified task type (code / analyze / generate / research / query) complexity — simple | moderate | complex confidence — classifier confidence 0–1 reason — one-line classification rationale env_check — dict of required env vars and whether they're set

Args: prompt: The task description to classify (same text you'd pass to the agent). profile: Routing profile — "budget", "balanced", or "premium" (default: "balanced").

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
promptYes
profileNobalanced

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden. It describes the tool's behavior (classification, recommendation), provides decision tree details, and lists output fields. It does not disclose side effects, but the tool is clearly a read-only classifier. The description adds good behavioral context beyond what is expected.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with bullet points, a code block for the decision tree, and a clear return format. It is front-loaded with the core purpose. Every section adds value, and the length is justified by the complexity of the routing logic.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description is complete: it covers the purpose, decision logic, both parameters, and the full output schema (documented in text). Given that there is no output schema in the input (but described in text), the tool is fully specified. An AI agent can correctly invoke and interpret the results.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. It explains both parameters: 'prompt' (the task description) and 'profile' (routing profile with default 'balanced'). It adds meaning by linking them to the decision tree. This is sufficient for correct invocation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Classify a task prompt and return the recommended agent CLI + model for session-level routing.' It uses specific verbs (classify, return) and a specific resource (task prompt). The decision tree and return JSON structure further clarify the function, distinguishing it from sibling tools that focus on other LLM operations.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly tells when to use the tool: 'Use this BEFORE starting a Claude Code / Codex / Gemini CLI session' for session-level routing. It provides detailed decision tree rules and parameter guidance. However, it does not explicitly specify when not to use it or list alternatives among siblings, though the context is clear.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ypollak2/llm-router'

If you have feedback or need assistance with the MCP directory API, please join our Discord server