Skip to main content
Glama

llm_select_agent

Analyzes a task prompt and recommends the appropriate agent runtime and model based on complexity and budget profile for session-level routing.

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
Behavior5/5

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

No annotations provided, so description carries the full burden. It fully discloses behavior: classification with a decision tree, return JSON structure with fields (primary, fallback, task_type, complexity, confidence, reason, env_check), and that it checks environment variables. No hidden side effects or contradictions.

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?

Description is well-structured with clear sections: purpose, usage, decision tree, return format, args. Each section is informative. Slightly longer than minimal but all content earns its place. Small deduction for minor redundancy (e.g., 'session-level routing' repeated).

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 the tool's moderate complexity and presence of an output schema, the description covers all aspects: decision tree, all return fields, parameter details, and usage context. It is complete enough for an agent to select and invoke correctly.

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

Parameters5/5

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

Schema coverage is 0%, so description must compensate. It explains both parameters: prompt ('task description to classify') and profile ('routing profile') with default and allowed values. This adds essential meaning beyond the basic schema types.

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 recommended agent CLI + model for session-level routing. It uses specific verbs and resources, and distinguishes from sibling tools like llm_route or llm_classify by explicitly noting 'session-level routing'.

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?

Explicit guidance on when to use: 'Use this BEFORE starting a Claude Code / Codex / Gemini CLI session'. The decision tree provides a clear mapping of profile×complexity to agent+model, and distinguishes this from mid-session model selection.

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