LLM Agent Deployment: Performance Evaluation and Architecture Design Essentials
As the application of Large Language Models (LLMs) shifts from simple question-answering to executing complex tasks autonomously, the focus moves from benchmark scores to closed-loop task completion. This article explores how to design agent systems effectively, covering performance evaluation metrics, task scheduling in agent clusters, comparisons between single agents and clusters, and common failure modes in enterprise applications.
The application methods of large models are changing. In the past, people primarily used them to answer questions, but now more teams expect them to complete work directly. This shift changes the focus from a model’s benchmark test scores to whether tasks can be completed in a closed loop. This article explains how agent systems should be designed from four perspectives: evaluation, scheduling, failure modes, and deployment.
Differences Between Agents and QA Models
QA models take an input and return text. Users can judge, modify, or ignore the result, so the cost of errors is usually low. Agents, however, must understand the environment state, decide the next action, generate code or call APIs, and continue advancing based on the returned results. The entire process might involve a dozen or more model and tool calls. An error in any step means subsequent steps will execute based on incorrect results.
Therefore, evaluating agents cannot rely solely on single-answer quality. Better metrics include task completion rate, human intervention frequency, average execution steps, tool call success rate, and cost per task. These metrics collectively reflect whether a model can independently complete a closed-loop task.
How to Evaluate Agent Performance
Some industry materials mention that new-generation models have significantly improved completion accuracy in agent tasks compared to previous generations, citing figures around fifty percent. Such numbers require cautious interpretation. The relative baseline, task types, tool permissions, evaluation set size, and judging criteria all significantly impact results. A model performing well on one evaluation set might drop noticeably on a different business process.
Therefore, this article does not cite specific improvement ratios. A more feasible approach for teams is to build a custom evaluation set. Extract 100 to 300 typical tasks from real business scenarios, record human-annotated correct results, and let candidate models run the full process. During evaluation, fix parameters like temperature, record steps, duration, and cost for each run, and analyze the distribution of failure causes. Only then are differences between models comparable.
The evaluation set should also cover abnormal scenarios, such as tools returning empty results, API timeouts, insufficient permissions, and contradictory user inputs. Many agents perform well on normal paths but fail to recover from abnormal paths.
Task Scheduling in Agent Clusters
The concept of an agent cluster involves assigning business objectives to an orchestration model, which decomposes them into subtasks and marks dependencies between them. Dependencies are typically represented as a Directed Acyclic Graph (DAG). Only tasks with all dependencies completed can be executed. Agents with different roles, such as requirements analysis, coding, code review, and test verification, undertake their respective subtasks.
The prerequisite for parallel execution is clear dependencies. If the scheduler only traverses ready tasks sequentially, it remains serial execution. The following code skeleton solves this. The scheduler continuously checks which task dependencies are complete in a loop, puts ready tasks into a concurrency pool, and uses a semaphore to limit the number of concurrently running tasks. Each task has a timeout and retry limit; upon failure, it is handed over to the upper layer for replanning.
import asynciofrom dataclasses import dataclass, field@dataclassclass Task:id: strrole: strprompt: strdeps: list[str] = field(default_factory=list)class AgentCluster:def __init__(self, orchestrator, agents: dict,max_concurrency: int = 8, max_retries: int = 2,timeout_s: float = 120):self.orchestrator = orchestrator # Orchestration model, responsible for decomposition and summarizationself.agents = agents # role -> agent, implements async run(prompt, context)self.sem = asyncio.Semaphore(max_concurrency)self.max_retries = max_retriesself.timeout_s = timeout_sasync def _run_task(self, task: Task, results: dict):async with self.sem:ctx = {d: results[d] for d in task.deps}error = Nonefor _ in range(self.max_retries + 1):try:res = await asyncio.wait_for(self.agents[task.role].run(task.prompt, context=ctx),timeout=self.timeout_s,)if res.success:return res.dataerror = res.errorexcept asyncio.TimeoutError:error = "timeout"raise RuntimeError(f"Task {task.id} failed: {error}")async def execute_objective(self, goal: str):graph = await self.orchestrator.decompose_goal(goal) # Returns {id: Task}tasks = graphresults, done, running = {}, set(), {}while len(done) < len(tasks):ready = [t for t in tasks.values()if t.id not in done and t.id not in runningand all(d in done for d in t.deps)]for t in ready:running[t.id] = asyncio.create_task(self._run_task(t, results))if not running:raise RuntimeError("Dependency loop exists, or dependencies cannot be satisfied")finished, _ = await asyncio.wait(running.values(), return_when=asyncio.FIRST_COMPLETED)for task_id, job in list(running.items()):if job in finished:results[task_id] = job.result() # Throws on failure, triggering upper-layer replanningdone.add(task_id)del running[task_id]return await self.orchestrator.summarize(results)
This code remains a skeleton; actual systems need additional components. Each write operation requires an idempotency key to prevent duplicate orders or data writes during retries. After completing each task, write the result to persistent storage so it can resume from the breakpoint after a process restart. Tool calls should have independent rate-limiting rules. The orchestration model’s output also requires structural validation to reject unparseable results and task graphs with loops.
Comparison Between Single Agent and Agent Clusters
| Dimension | Single Agent | Agent Cluster |
|---|---|---|
| Task Decomposition | Model implicitly completes it in one session | Orchestration model explicitly outputs task graph |
| Parallelism | Usually 1 | Constrained by dependencies and concurrency limit |
| Failure Recovery | Restart entirely or human takeover | Retry by subtask or local replanning |
| Observability | Logs are centralized, but hard to locate stage | Trackable by task, role, and node |
| Cost | Long context, high cost per call | Context is distributed, but total call count increases |
Agent clusters are not always the better choice. For simple tasks with fixed steps, a single agent is easier to maintain and less costly. Clusters only show advantages when tasks can genuinely be decomposed and dependencies between subtasks are clear.
Common Failure Modes in Enterprise Applications
When piloting digital employees, enterprises often encounter the following issues:
First, task loops. The agent repeatedly calls the same tool, getting the same result without adjusting its strategy. The solution is to set a maximum step count and detect continuous repeated actions.
Second, tool call timeouts. When external APIs respond slowly, the agent might repeatedly submit requests. Set a timeout for each call and enable idempotency keys for write operations.
Third, context bloat. As steps increase, historical messages grow longer, diluting the model’s attention and rapidly increasing costs. Periodically summarize historical content, retaining only the state relevant to the current subtask.
Fourth, permission overreach. If agents are granted excessive permissions, they might delete data or send incorrect information. Follow the principle of least privilege, set manual confirmation for write operations, and log comprehensive audit trails.
Fifth, unsmooth human takeover. After system errors, operators cannot see which steps the agent executed. Provide step replay and support pausing, modifying, and resuming at any node.
Some enterprises have publicly introduced their digital employee pilots. These introductions typically emphasize efficiency improvements but rarely provide detailed cost analyses.
