Skip to main content
Glama

llm_select_agent

Classifies task prompts to recommend the optimal agent and model for session-level routing, enabling informed selection before starting a coding session.

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 details that the tool returns JSON with fields like primary, primary_model, fallback, task_type, complexity, confidence, reason, and env_check. It explains the classification logic via the decision tree but does not disclose if the tool requires network access or makes external API calls, which is a minor gap.

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

Conciseness4/5

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

The description is well-structured with a core purpose, usage context, decision tree, output fields, and parameter definitions. It is front-loaded and each section adds value. While slightly lengthy, it avoids unnecessary repetition and earns its length.

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?

Given there are only 2 parameters and an output schema is present, the description thoroughly covers the tool's behavior. It explains the decision tree, output fields, and environment check, leaving no significant gaps. The tool's complexity is well-addressed.

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 does so by explaining both parameters: 'prompt' as the task description to classify and 'profile' as the routing profile with valid values ('budget', 'balanced', 'premium') and default. This adds significant meaning beyond the schema's type and name fields.

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 classifies a task prompt and returns a recommended agent CLI and model for session-level routing. It specifies the verb 'classify' and the resource 'agent CLI + model', and distinguishes itself from sibling llm_* tools by emphasizing it is for session-level routing, not mid-session model selection.

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

Usage Guidelines5/5

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

The description explicitly says to use this tool 'BEFORE starting a Claude Code / Codex / Gemini CLI session' and clarifies it is 'session-level routing' not for mid-session calls. It provides a decision tree based on profile and complexity, offering clear when-to-use and when-not-to-use guidance.

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