Skip to main content

Pass the Gate Before Launch: Designing an Offline Evaluation System for Logistics Agents

· 5 min read
Jack Ning
Maintainer of Bytedesk

Before a release, the team ran through "track my package, change the address, file a claim"—everything went smoothly, so it shipped. Three days later, production blew up: a user casually asked "is my package stuck somewhere" and the intent went unrecognized; the address-change API timed out and the agent, without retrying, replied "modified successfully"; one test order triggered a duplicate claim. Demos only ever test the happy path, while the real long tail of logistics support is full of colloquial phrasing, stacked intents, API timeouts, and state conflicts—without an offline evaluation system, an agent's "ready to launch" only means "never tested".

This post is part of the "AI Customer Service Product and Engineering Practices" experience-sharing series, drawn from a practice review of an AI customer service product at a leading logistics company. In this post I want to share how to build an offline evaluation system for a logistics AI agent — test sets covering intent recognition, task planning, tool invocation, execution correctness, and exception recovery, plus verification of the model's generalization in complex logistics scenarios. This is the watershed between an agent that "can demo" and one that "can launch".

Build anonymized test sets → Assert each capability → Sandbox replay with fault injection → Hold out and regress

Five Key Design Points in Offline Evaluation​

  • Test set construction: how real data, bad cases, constructed data, and simulated data combine, instead of a few dozen demo cases.
  • Layered evaluation: intent, planning, tools, end-to-end, and exception recovery are measured separately, not lumped into one pass rate.
  • Judgment methods: how golden answers, rule assertions, model review, and human sampling fit together.
  • Environment design: sandbox, mocked business systems, and conversation replay must stay isolated from production.
  • Generalization verification: scenario stratification, difficulty stratification, new-scenario holdouts, and continuous regression forming a system.

The Overall Design​

In building this evaluation system, I would set one bottom line first: the endpoint of evaluation is correct business outcomes, not replies that resemble a reference answer. The overall approach in one sentence: assemble test sets from four data sources, measure each capability layer separately, replay in a sandbox with fault injection, and verify generalization with holdouts.

Step 1: Assemble test sets from four data sources​

  • Sampled real conversations: anonymized samples from production, covering consultation, exception, and after-sales scenarios.
  • Online bad cases: all historical failure cases stored to prevent recurrence.
  • Manually constructed boundary cases: high-risk, rare, and combined scenarios that real data never captures.
  • Simulated order and shipment data: synthetic data supporting end-to-end execution verification.

Step 2: Layer the capabilities, test each on its own​

Never look only at end-to-end. The intent layer checks multi-intent, colloquial, and ambiguous phrasing; the planning layer checks steps and dependencies; the tool layer checks parameter accuracy and failure handling; the execution layer checks end-to-end task completion; the exception layer specifically tests recovery under timeouts, interruption, and state conflicts; plus a safety and compliance layer for unauthorized access and privacy—untrusted input must never expand permission boundaries.

Step 3: Judge with golden answers and rule assertions​

Every case carries a golden result or rule assertion, automatically computing pass rate, recall, and erroneous-execution rate; hard metrics like amounts, write-operation counts, and final business state must use deterministic assertions, not model self-assessment. Subjective items (whether phrasing is appropriate) use model review plus human sampling, with pass-rate thresholds—core scenarios that miss the bar do not ship.

Step 4: Replay in a sandbox and inject faults​

The evaluation environment uses a sandbox + mocked business systems + conversation replay, never touching production data. Beyond the normal chain, actively inject faults: acknowledgments lost after success, duplicate callbacks, rate limiting, compensation failures—then assert write-operation counts and final state, not merely "no exceptions thrown". The agent saying "modified successfully" doesn't count; only the state in the business system counts.

Step 5: Verify generalization with holdouts, run regression on every release​

Report metrics stratified by scenario and difficulty, and reserve a portion of unseen new scenarios as a holdout to observe transfer—whether the model truly generalizes or just memorized answers. Regression runs before every release, bad cases flow into the library automatically, and metrics go on a trend dashboard to prevent getting worse with each change.

Practice in Bytedesk​

In the open-source Bytedesk customer service system (GitHub, website https://www.weiyuai.cn ), tool definitions can connect simulated business APIs in a test environment, letting the agent call mocked order and tracking systems in a sandbox; invocation logs verify the actual parameters and results of each action; multi-turn conversation memory supports a configurable context window, enabling conversation replay for multi-turn scenarios. Organizing the four test-set data sources, layered assertions, fault injection, and holdout splits needs to be built in the testing layer per this post—and the replay environment must restrict external connectivity so test tools never reach production write APIs.

Key Takeaways​

  • The endpoint of evaluation is correct business outcomes with controlled failure, not resemblance to a reference answer.
  • Four test-set sources: sampled real conversations, online bad cases, manually constructed boundary cases, simulated order and shipment data.
  • Layered evaluation: intent, planning, tools, end-to-end, exception recovery, and safety compliance each measured separately—never averaged into one pass rate.
  • Hard metrics use deterministic assertions: amounts, write-operation counts, final business state; the agent's self-reported success is not evidence.
  • Sandbox environment + fault injection + holdout generalization checks; regression on every release, with metrics on a trend dashboard.