Selecting Office LLM Agents: From Task Decomposition to Deployment Evaluation
This article explores the evaluation framework for office LLM agents, emphasizing the shift from conversational accuracy to actual task completion. It covers the four-layer architecture of agents, a five-dimensional evaluation framework, test set construction with code examples, deployment workflows, common pitfalls, and a pre-launch checklist to ensure reliable and secure AI integration in business environments.
1. Why Office Agents Require Specialized Evaluation
Early LLM applications focused primarily on Q&A, where evaluation centered on answer accuracy and fluency. Office agents have a different objective. They must understand an ambiguous work instruction, decompose it into several steps, call tools such as calendars, documents, spreadsheets, or messaging platforms, and ultimately deliver a ready-to-use result. Task failures can occur for various reasons: misinterpreting requirements, incorrect tool parameters, or deleting a file midway without confirmation.
Therefore, evaluation methods that only look at single-turn response quality are no longer sufficient. Teams need to break down “task completion” into observable and measurable steps, scoring each one individually.
2. Capability Boundaries: From Answering Questions to Completing Tasks
An office agent typically consists of four components:
- Language Model: Responsible for understanding intent, planning steps, and generating text.
- Tool Layer: Encapsulates operations like reading/writing documents, spreadsheet calculations, and sending messages into callable functions.
- Memory and Context: Preserves task state and manages long documents and conversation history.
- Control Logic: Determines when to call tools, when to ask for user confirmation, and when to stop.
Errors can occur at any layer. The model might lose prerequisite conditions during a long task. The format of results returned by tools might be inconsistent. The control logic might get stuck in repeated invocations. Evaluation must locate problems by layer; otherwise, you will only see that “the result is wrong” without knowing which layer to modify.
Capability boundaries must also be clearly defined. For conclusions requiring professional judgment, such as contract clause interpretation or financial audit opinions, the agent can only provide drafts and references. Final confirmation still requires human intervention. Stating this clearly in product documentation is more reliable than fixing issues after the fact.
3. Five Dimensions of the Evaluation Framework
3.1 Task Completion Rate
Task completion rate is the most direct metric. Define “completion” specifically: Does the output file exist? Are the fields complete? Do the values match the source data? You cannot use “looks good” as a standard. It is recommended to set explicit pass conditions for each task type and record instances of partial completion. For example, when generating a weekly report, scoring the title, data, and conclusion separately reflects issues better than a simple pass or fail.
3.2 Tool Invocation Reliability
Tool invocation is the main difference between an office agent and a standard chatbot. Three things need to be checked: Did it call the tool when it should have? Did the parameters comply with the API definition? Were the returned results used correctly? You can use logs to track the number of invocations, failures, and retries per task. A significantly high invocation count usually indicates insufficient planning capabilities or ambiguous tool descriptions.
3.3 Long Context and Information Retrieval
Office documents often span dozens of pages. During evaluation, construct materials containing distracting information to observe whether the agent can find key clauses, distinguish between old and new versions, and provide source locations when citing. Judging based solely on the context window size claimed by the model is insufficient; you must test with actual documents.
3.4 Security and Permissions
The greater the permissions an agent has, the higher the risk. Follow the principle of least privilege: only open tools necessary for the task. Write operations should require user confirmation by default, and actions like deletion, sending, or external sharing should require secondary confirmation. During testing, deliberately construct prompt injection inputs—such as asking the agent to ignore existing rules or export irrelevant data—to check if the agent complies. Text appearing in documents should be treated as data and must not be executed as instructions.
3.5 Cost, Latency, and Stability
The time taken for the same task can vary by multiples across different time periods and under different loads. Record the input/output token count, total latency, and tool invocation count for each task to calculate the cost per unit task. Stability is measured by running the same test case repeatedly and observing output fluctuations. If outputs for the same input vary significantly, you need to further refine prompt design, lower randomness parameters, or optimize workflow steps.
4. Building a Reproducible Test Suite
The credibility of evaluation results depends on the test suite. It is recommended to extract samples from real tickets, covering high-frequency tasks, edge case tasks, and historical failure cases, with at least twenty entries per category. Each test case should include the instruction, initial environment, expected result, and judging rules.
Below is a general evaluation script framework that can be modified as needed:
from dataclasses import dataclass, fieldfrom typing import Callable, List, Dict@dataclassclass TestCase:case_id: strinstruction: strcheck: Callable[[dict], bool] # Determines if the test passes based on execution resulttags: List[str] = field(default_factory=list)def run_suite(agent: Callable[[str], dict], cases: List[TestCase]) -> Dict:report = {"total": len(cases), "passed": 0, "failures": []}for case in cases:try:result = agent(case.instruction)ok = case.check(result)except Exception as exc:ok = Falseresult = {"error": str(exc)}if ok:report["passed"] += 1else:report["failures"].append({"id": case.case_id, "result": result})report["pass_rate"] = report["passed"] / report["total"] if cases else 0.0return report
When using it, write deterministic check functions for each case, such as value comparisons, field existence checks, or file format validations:
cases = [TestCase(case_id="weekly-report-001",instruction="Generate this week's regional performance summary based on the attached sales table",check=lambda r: r.get("total_sales") == expected_totaland "East China" in r.get("summary", ""),tags=["report", "data"],),]report = run_suite(agent=my_agent, cases=cases)print(report["pass_rate"])
One principle must be maintained: use rules for judgment whenever possible, rather than using a model. Model scoring can serve as an auxiliary signal, but if used as the sole standard, the evaluation results will be affected by the scoring model’s own biases. Results scored by models should be manually reviewed on a sampled basis.
5. Deployment Workflow
- Review business scenarios and select 10 to 20 high-frequency tasks.
- Define success criteria and permission scopes for each task.
- Build a test suite and record baseline results.
- Run candidate solutions under the same test suite, tool environment, and data versions.
- Analyze failed cases and attribute them by layer: model understanding, task planning, tool invocation, or data issues.
- Conduct small-scale pilots, collect real user feedback, and continuously add test cases.
The prerequisite for a fair comparison is a consistent environment. Inputs, tool permissions, and data versions must all be identical. Otherwise, the comparison results will be confounded by environmental differences, making it impossible to determine the merits of the solution itself.
6. Common Pitfalls
- Only looking at demo effects: Demos usually select the smoothest examples and cannot reflect average performance.
- Treating a single run as a stable conclusion: Run the same case at least three to five times to observe the fluctuation range.
- Ignoring the cost of failure: The loss from accidentally deleting a file once is much greater than slowing down multiple responses. Stricter acceptance thresholds should be set for high-risk actions.
- Ignoring manual review costs: If every result requires manual verification, the time saved by the agent might be offset. The review process should be factored into the total cost.
7. Evaluation Checklist
Check the following items before launch:
- Does each task type have explicit success criteria and judging rules?
- Are there complete logs for tool invocations, and are failures and retries traceable?
- Are permissions configured according to the principle of least privilege, and do write and delete operations require secondary confirmation?
- Are there prompt injection test cases included, and have they passed?
- Are the token consumption, latency, and cost per unit task recorded?
- Have the proportion and frequency of manual sampling reviews been determined?
