TL;DR
This paper introduces an offline agentic pipeline that compiles repeated Standard Operating Procedure (SOP) steps into validated, deterministic tools instead of generating fresh code at inference time. Deployed in an Amazon Fulfillment Center alarm-triage system, this approach slashes p50 latency by up to 42% (and an additional 62% via architectural optimization) while cutting end-to-end error rates by up to 53%.
What Problem Does This Paper Address?
LLM coding agents are highly flexible because they can read natural-language instructions, write code, and interact with live environments at runtime. However, in production systems that execute repetitive workflows—such as following standard operating procedures (SOPs) against stable databases—this "CodeAct-style" paradigm becomes an efficiency bottleneck.
Regenerating code for the same procedural steps on every single request wastes inference tokens, increases costs, and introduces high run-to-run variance. In latency-sensitive industrial settings like robotic fulfillment centers, waiting for an LLM to repeatedly rediscover database schemas and rewrite query boilerplate can cause localized faults to cascade into major operational delays.
Methods
The authors propose a shift toward self-evolving agents that build and maintain their own tool libraries offline. The system operates in two distinct phases:
- Offline Tool-Making Pipeline: Instead of relying solely on raw SOP text, a Data-collector sub-agent runs sample cases against the live environment via the Model Context Protocol (MCP) to gather execution traces and schema metadata. A Tool-maker LLM uses these traces to synthesize candidate Python tools. A Reflector LLM then tests and iteratively repairs these candidates against a labeled dataset over multiple rounds.
- Online Agent Runtime: In production, the main agent invokes these pre-compiled, versioned tools directly. It only falls back to expensive inference-time code generation if a tool is missing or encounters an exception.
To ensure the production agent remains robust during tool failures, the authors distilled a large teacher model into a smaller student model using a training mixture of trajectories with and without tool availability.
Datasets
The approach was evaluated on an industrial outbound dock alarm triage task at an Amazon Fulfillment Center. The underlying SOP consists of a decision tree with 44 decision nodes and 19 action nodes.
The authors programmatically generated a dataset based on expert logic containing:
- 8,011 training cases and 8,022 evaluation cases distributed across the decision nodes.
- 1,500 historical alarm scenarios used for end-to-end evaluation.
Key Insights and Ideas
- Environmental Grounding is Mandatory: Relying on SOP text alone yields poor tool accuracy because human-written documentation frequently omits critical execution details like exact field names, null-handling conventions, and datatypes. Providing live execution traces and a test-repair loop is essential to bridging this gap.
- Deterministic Tools Expose Upstream Drift: Because the generated tools return consistent outputs for identical inputs, they act as a diagnostic lens for the broader software ecosystem. In production, log monitoring quickly flagged pre-existing upstream issues—such as silent database schema changes or format shifts (e.g., percentages changing to decimals)—that flexible, inference-time code generation had previously masked by silently adapting to them.
- SOP Ambiguity is the Ultimate Bottleneck: Once the tool-making pipeline successfully grounds the agent in the live environment, remaining errors concentrate heavily on underspecified or ambiguous text within the human-authored SOPs themselves.
Key Results
The full tool-making configuration (SOP+D+R) achieved a per-node success rate (pass@1) of 94.5% using GLM-4.7, outperforming text-only generation by nearly 19 percentage points.
When integrated into the production pipeline:
- Latency Reduction: Replacing the sub-agent's code-generation loop with tool calls cut p50 latency by 42%. Furthermore, because the tools return compact, structured verdicts, they enabled a streamlined "direct-call" architecture that reduced p50 latency by an additional 62% in controlled ablations.
- Accuracy Improvement: Tools suppressed run-to-run variance, reducing the end-to-end error rate by 36% on Qwen3 32B and 53% on GLM-4.5-Air (bringing the error rate down to just 0.8%).
- Token Efficiency: Total per-alarm output tokens fell by 58%, driven primarily by an 80% reduction in sub-agent code generation.
Limitations and Future Work
While highly effective, the authors note several limitations:
- Domain Specificity: The loop has only been deployed on a single application (outbound dock alarm triage). Its generalization to free-form, less structured runbooks remains unproven.
- Human Oversight: The system is not yet fully autonomous; human operators are still required to review tool promotions for production safety and to clarify ambiguous SOP text.
- Data Dependency: Although highly data-efficient (achieving 91.8% pass@1 with just 5 samples), the pipeline still benefits from labeled cases. Developing a completely label-free pipeline remains an open area of research.
Summary updated