cs.AINov 26, 2026

Compiling Agent Traces into Typed Workflows for Cheaper and Faster Execution of Recurring Tasks

Authors: Jorge Garcia-Carrasco, Javier Sanchis, Sandra Garcia-Ponsoda, Alejandro Mate, Juan Trujillo

Organizations: Department of Software and Computing Systems, University of Alicante, Alicante, 03690, Spain

Abstract

LLM agents solve a wide range of digital tasks, and benchmarks now report high success on requests that span several applications and many steps. However, much of that work is repetitive: a user asks for the same kind of change again and again, such as moving an alarm or rescheduling a meeting, with different data but a familiar procedure. Running the full agent for every instance is therefore expensive. To this aim, we propose an intermediate representation for such workflows: a directed graph whose nodes fall into three categories by output space, EXECUTE for computation and tool calls, DECIDE for one bounded choice over candidates the graph declares, and GENERATE for the open-ended rest. The idea is that a compiler agent takes the successful traces and compiles them into such a representation. An engine then runs the graph, calling a model only where a node declares one, so a deployment keeps neither the agent loop nor its context. We evaluate on AppWorld, compiling from one agent's traces and running the result on held-out instances. We show that the compiled workflows solved all instances at 98 times lower cost and 76 times faster per run. Compiling a workflow took three to five minutes and paid for itself after 31 to 50 executions.

Figures & tables

Explore similar work

Aug 3, 2026

TraceCompiler: Skill-Guided Mining and Compilation of LLM Agent Traces into Mostly Deterministic Workflows

Tool-using language-model agents repeatedly rediscover procedures they have already executed, producing traces that mix reusable structure with retries, exploration, accidental ordering, and repeated lookups. We present TraceCompiler, a skill-guided system that mines clusters of noisy agent traces and compiles them into executable, mostly deterministic workflows. It admits an inter-tool dependency only when a consumer argument contains a value attributable uniquely to an earlier producer; every hard edge carries an auditable evidence tuple, and ambiguous relations are marked suspected and impose no ordering constraint. Bindings are classified as constants, user inputs, copied outputs, transforms, or residual LLM decisions. On T1, a mechanized form of the rule recovers producer-consumer dependencies at 0.928 precision and 0.943 recall over 15,775 def-use edges of its training split, against 0.711 F1 for adjacency and 0.712 for a frequency-thresholded directly-follows measure on identical data; the compiler skill run blind reaches 0.992 on 250 of those edges. On AppWorld we replay released trajectories in the deterministic simulator to recover masked return values and measure the rule against 563 token edges at 0.993 precision - a self-consistency check, since replay injects tokens by a related heuristic. We compile two recurring intents: a Venmo money-request intent reduces 34 observed API calls to 11 runtime calls and, under leave-one-out execution against the benchmark's own state tests, passes 15 of 21, the failing fold escalating rather than acting because its required branch was never observed; and a Spotify/Todoist intent the compiler correctly refuses to compile, because an irreversible side effect is under-determined. We measure call reduction but not offline compilation cost, so we claim no net efficiency result.
Nov 10, 2026

ReTrace: Distilling Tool-Using Agents into Planner-Free Workflows

Business process automation runs the same Standard Operating Procedure (SOP) again and again on new inputs. Large Language Model (LLM) agents can follow an SOP written in natural language, but they call an LLM to choose every step of every run, which adds latency and cost at scale. We present ReTrace, which turns an SOP and a few logged agent runs into a reusable workflow in which code, not an LLM, selects the next step. The agent's reasoning, the explanation it writes with each tool call, often states why it took an action; the tool calls alone do not. ReTrace extracts the condition behind each step, merges these conditions across runs into a compact rule document, and generates an executable workflow from it. Only this last stage depends on the platform, so rule documents can be compiled for different orchestration platforms. On 7979 procedures from our production platform, ReTrace workflows reach 93.8%93.8\% completion, against 96.8%96.8\% for the agent, at 24%24\% lower cost per task. On τ2τ^2-Bench, they reach 75.8%75.8\% task success (agent: 80.6%80.6\%) and run in 1.31.3s instead of 170170s; three rounds of repair on training failures lift k=2k{=}2 workflows from 66.7%66.7\% to 81.2%81.2\%. On eight SOP-Bench procedures, ReTrace without repair trails few-shot generation (80.6%80.6\% vs. 83.6%83.6\%), but repair from labeled training failures lifts it to 87.8%87.8\% at 0.400.40s per task, compared to 85.5%85.5\% in 46.646.6s for the agent.
Mar 23, 2026

From Static Templates to Dynamic Runtime Graphs: A Survey of Workflow Optimization for LLM Agents

Large language model (LLM)-based systems are becoming increasingly popular for solving tasks by constructing executable workflows that interleave LLM calls, information retrieval, tool use, code execution, memory updates, and verification. This survey reviews recent methods for designing and optimizing such workflows, which we treat as agentic computation graphs (ACGs). We organize the literature based on when workflow structure is determined, where structure refers to which components or agents are present, how they depend on each other, and how information flows between them. This lens distinguishes static methods, which fix a reusable workflow scaffold before deployment, from dynamic methods, which select, generate, or revise the workflow for a particular run before or during execution. We further organize prior work along three dimensions: when structure is determined, what part of the workflow is optimized, and which evaluation signals guide optimization (e.g., task metrics, verifier signals, preferences, or trace-derived feedback). We also distinguish reusable workflow templates, run-specific realized graphs, and execution traces, separating reusable design choices from the structures actually deployed in a given run and from realized runtime behavior. Finally, we outline a structure-aware evaluation perspective that complements downstream task metrics with graph-level properties, execution cost, robustness, and structural variation across inputs. Our goal is to provide a clear vocabulary, a unified framework for positioning new methods, a more comparable view of existing body of literature, and a more reproducible evaluation standard for future work in workflow optimizations for LLM agents.