Building a Simple Agent with LLMs: Practical Lessons on Framework and Model Selection
This article shares hands-on experience from building a basic text analysis agent with large language models. It compares two integration approaches—native framework with native models versus a general-purpose framework with third-party model APIs—proposes a five-dimension evaluation framework for assessing a model's agent capabilities, breaks down the token cost structure of agent tasks, and offers practical recommendations for cost control, evaluation, and model selection.
1. Background: A Simple Agent Task That Raised a Selection Question
Recently I built a fairly basic multi-dimensional text analysis agent: given a batch of unstructured text, the agent must autonomously complete four stages—data cleaning, dimension splitting, statistical analysis, and conclusion summarization. The task itself is not complex, but it serves as a good test of how different LLMs actually perform on “agent capability.” After all, being strong at conversational Q&A does not guarantee that a model can reliably run a multi-step task from start to finish.
During validation, I tried two mainstream integration routes and ran into plenty of pitfalls. This article lays out the selection rationale, evaluation dimensions, and cost math for developers with similar needs.
2. Trade-offs Between Two Integration Routes
2.1 Native Framework + Native Model
Common intelligent coding tools in the industry are typically built by pairing an official framework with the vendor’s own models. In theory this delivers the best end-to-end experience: tool-calling protocols, context management, and error-retry mechanisms are all designed around the vendor’s own model, so the fit is tightest.
But this route has a practical problem: models iterate extremely fast. You may have just adapted to one generation’s output habits and prompting style when the next generation arrives, forcing you to rework your workflow, renew subscriptions, and retest everything. For engineering scenarios that need long-term stability, the maintenance cost of this “constant switching” cannot be ignored.
2.2 General-Purpose Framework + Third-Party Model APIs
The compromise is to use a mature, general-purpose agent framework as the shell and graft on different models via APIs. The framework handles task orchestration, tool calling, and session management, while the model layer can be swapped at any time. The advantages are clear:
- Low switching cost: changing models only requires updating an endpoint and an API key;
- Reusable framework capabilities: prompt templates, tool registration, and logging/tracing don’t need to be rewritten;
- Easy horizontal comparison: the same task scripts can run against different models, making evaluation results comparable.
The cost is that “grafting” naturally involves friction—mismatches can occur between the framework’s tool-call format and the model’s function-understanding ability, requiring an extra adaptation layer.
I ultimately chose the second route because it better fits the needs of a rapid validation phase.
3. Evaluation Dimensions: How to Judge Whether a Model “Can Do Agent Work”
After multiple rounds of testing, I broke agent capability down into five observable dimensions. I recommend evaluating candidates against this framework:
- Instruction understanding: Can the model grasp the essence of a requirement rather than executing literally? Weaker models “move only when poked”—they do one step per instruction and lack global understanding.
- Solution planning: Upon receiving a task, can the model first decompose it into a reasonable execution plan instead of improvising step by step?
- Self-checking and error correction: When an intermediate step fails, can the model analyze the stack trace, locate the cause, fix it, and retry—rather than repeating the same mistake?
- Coding ability: Are the generated analysis scripts runnable on the first try, with thorough boundary handling?
- Transfer learning: After completing task A, can the model transfer the learned pattern to a structurally similar task B?
Dimensions 1, 2, and 5 are where models diverge the most—and they are exactly the capabilities that pure conversational benchmarks fail to reveal.
4. The Cost Math: Pay-per-Token vs. Subscription
This point deserves its own section. The cost structure of agent tasks is completely different from ordinary chat:
- Agents “think”: multi-step planning generates large volumes of internal reasoning tokens;
- Agents “read”: tool outputs are fed back into the context, and the longer the context grows, the faster consumption accelerates;
- Agents “retry”: self-checking and correction mean the same task may run multiple rounds.
In my tests, a task lasting about 10 minutes cost roughly 1 CNY under pay-per-token pricing; a full agent design test consumed about 30 CNY over 5 hours. At that rate, pay-per-token costs for daily development validation quickly spiral out of control.
My recommendation: use subscription/monthly plans during the exploration phase to cap costs, then switch to fine-tuned pay-per-use after productionizing. Also pay attention to the token quota in subscriptions—some models have lengthy reasoning processes, and their chains of thought burn through quotas so fast that even simple tasks can exhaust them quickly. Before subscribing, it’s best to run a small-scale trial to assess “token throughput efficiency.”
5. Practical Recommendations
Based on this round of testing, here are several actionable takeaways:
- Choose a mature, general-purpose framework and keep the model layer replaceable. Don’t bind business logic to a specific model’s particular behaviors; write prompts in a model-agnostic form whenever possible.
- Build a fixed evaluation set. Prepare 5–10 representative agent tasks and run the same set every time you switch models, scoring across the five dimensions above. Avoid switching models based on gut feeling.
- Set a budget for long reasoning. For reasoning-oriented models, configure maximum reasoning rounds and token caps at the framework level to prevent a single task from consuming the entire quota.
- Watch how fast the open-source ecosystem is catching up. The coding ability of current open-source models is already sufficient for most basic agent tasks; the remaining gap lies mainly in instruction understanding and autonomous planning, and that gap is closing quickly. When selecting a model, there’s no need to blindly chase the newest release—“good enough and stable” is the right bar.
6. Conclusion
The core of agent capability is not the quality of a single response, but the stability of understanding, planning, and error correction across multi-step tasks. The combination of framework and model determines your iteration efficiency, while the billing model determines your validation cost. I recommend making selections with a fixed evaluation task set plus an architecture with a replaceable model layer, so you can save your energy for real business problems. As open-source models continue to improve on agent scenarios and approach or surpass leading closed-source models, the architectural advantage of low switching costs will truly pay off.
