LLM Selection and Agent Engineering: A Practical Guide to Controlled Evaluation and Production Hardening
This guide presents a controlled experiment for choosing a large language model for AI Agent projects, where the model is the only variable while the framework, memory, skills, constraints, and tools stay fixed. It defines five evaluation tasks—skill packaging, web development, presentation and copywriting, knowledge base management, and browser automation—along with the observation points for each, a two-dimensional cost framework, common model failure modes, and engineering safeguards such as confirmation gates, budget limits, idempotency, and observability. Readers will learn how to run a reproducible selection process and a shadow deployment before switching models in production.
1. Why Changing Only the Model Is the Most Reliable Experiment Design
In AI Agent projects, the most common debate is “which model is stronger.” However, most comparisons produce results that cannot be reused because they change too many variables at once: different prompts, different tool sets, different memory strategies, and even different task descriptions. The resulting scores can be attributed neither to the model nor transferred back to your own business.
A more rigorous approach is to build a controlled experiment: keep the Agent framework, memory content, skill set, system constraints, and callable tool list fixed, with the underlying LLM as the only variable. Only then can the observed differences be explained as model capability differences rather than engineering configuration differences.
One boundary condition must be defined in advance: reasoning effort should be set uniformly, with high reasoning enabled everywhere it is available. Otherwise, you are comparing budget strategies rather than models. In addition, the task set must reflect the distribution of real workloads instead of cherry-picking a few small samples that a model happens to handle well. This article breaks the evaluation into five stages: skill packaging, web development, presentation and copywriting generation, knowledge base management, and browser automation. The rationale for these five stages is as follows: the first two assess structured output and coding ability; the third assesses the organization of multimodal artifacts; the fourth assesses long-context handling and retrieval discipline; and the fifth assesses tool-calling stability and cost control.
2. Neutral Description of Candidate Models and a Cost Framework
To avoid turning this into a specific product review, candidate types are described only by capability profile:
- Type A: A flagship model with ultra-large parameter count, a significant parameter increase over the previous generation, usually with extended capabilities such as image recognition, currently in a limited-time discount period. Known failure modes are unstable skill recognition in Agent scenarios, lack of confirmation before high-risk actions, and high token consumption.
- Type B: Known for the cost-effectiveness of its coding subscription plan, the plan bundles capabilities such as speech synthesis, music generation, and video generation, and it has open-sourced a companion command-line tool; usage is accounted for with allocated quotas.
- Type C: A small, cost-effective model that community feedback says can rival larger-parameter models, but whose quota is consumed extremely fast—a five-minute coding task may eat half of the monthly quota.
- Type D: A balanced general-purpose model used as the control baseline.
Cost must be assessed on two dimensions, not by unit price alone:
| Dimension | Metric | Description |
|---|---|---|
| Unit price | Price per million input/output tokens | Reflects only the nominal cost |
| Subscription | Monthly plan quota and allocation rules | Determines sustainable runtime |
| Actual | Token consumption multiplier per task | The main driver of real cost |
| Risk | Extra consumption from failed retries | A frequently overlooked hidden cost |
The empirical rule is that the per-task token consumption multiplier often has a greater impact on the total bill than unit price differences. A model that is cheaper on paper but consumes eight times as much may cost far more in practice than one that is twice as expensive.
3. Five-Stage Task Design and Observation Points
Stage 1: Package a Prompt into a Publishable Skill
Task: Turn a local system prompt file for a design-related task into a skill package that can be published online, with the requirement that it is “not a copy of the prompt, but a capability package that works as soon as it is installed,” and perform a self-check after output to point out where errors may occur.
Observation points: Whether it produces a complete directory structure (documentation, entry definition, parameter schema, examples, version number); whether it distinguishes “capability boundaries” from the “original text”; whether the self-check is specific and identifies real risks such as path resolution, permissions, and platform differences.
This stage is the entry threshold. If a model cannot reliably turn experience into a skill, subsequent tests are meaningless.
Stage 2: Web Development
Task: Given a one-sentence requirement, produce a runnable single-page application with a responsive layout and one asynchronous data load.
Observation points: Whether the build passes on the first attempt; whether loading and error states are handled; whether unnecessary dependencies are introduced.
Stage 3: Presentation and Copywriting
Task: Produce an outline, per-slide key points, and a speaker script around a given topic.
Observation points: Whether the structure is progressive; whether the key points can be supported by data; whether empty adjectives are avoided.
Stage 4: Knowledge Base Management
Task: Classify, deduplicate, and generate an index and summaries for a batch of mixed-format documents.
Observation points: Whether tail content is missed under long context; whether nonexistent entries are fabricated; whether the deduplication criteria are explainable.
Stage 5: Browser Automation (High-Consumption Stage)
Task: Complete a multi-step operation on a web page and scrape the results.
Observation points: Recovery strategy after a step fails; whether confirmation is requested before write operations; the token consumption curve.
4. Failure Modes and Engineering Hardening
Model-side instability must be covered by engineering-side safeguards. Five are recommended:
- High-risk action whitelist: deletion, payment, publishing, and bulk write operations must require secondary confirmation, and the confirmation logic should sit in the framework layer rather than in the prompt.
- Skill loading validation: at startup, validate the consistency between the skill list and local files; if they are inconsistent, refuse to execute rather than degrade to guessing.
- Budget guardrails: set a token limit and a step limit per task; abort immediately when exceeded and return diagnostic information.
- Idempotency and rollback: attach an idempotency key to all write operations and keep rollback scripts.
- Full-chain observability: log a summary of each step’s input, tool return codes, and elapsed time, making it easier to attribute whether an issue is a model problem or an environment problem.
Illustrative pseudocode:
def run_step(action, ctx):if action.risk == "high" and not ctx.confirmed(action):return {"status": "pending_confirm", "action": action.id}if ctx.tokens_used > ctx.budget:return {"status": "aborted", "reason": "budget_exceeded"}result = tool_registry.call(action, idempotency_key=ctx.step_id)ctx.log(action, result)return result
5. Selection Conclusions and Implementation Recommendations
The conclusion is not to “pick the strongest” but to divide labor by scenario: for long-chain tasks with heavy tool calling, prioritize models with stable execution and robust confirmation mechanisms; for high-consumption tasks, set strict budgets and split them into smaller pieces; for coding-intensive tasks, use a subscription-based option to spread cost; and for quota-sensitive scenarios, draft with a small model first and then have a large model review.
For implementation, it is recommended to first run a two-week shadow deployment: run the old and new configurations in parallel, log only without executing write operations, use real traffic to calibrate the consumption multiplier and failure rate, and then decide the primary and backup models as well as the fallback path.
