WorkflowGen:an adaptive workflow generation mechanism driven by trajectory experience
Ruocan Wei, Shufeng Wang, Ziwei Shi · 2026
Read WorkflowGen:an adaptive workflow generation mechanism driven by trajectory experience by Ruocan Wei, Shufeng Wang, Ziwei Shi (2026) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2604-19756.txt.
Introduction
Wei, Wang, and Shi present WorkflowGen, an adaptive tool that builds workflows for language model agents from records of past runs instead of starting fresh each time. Older methods rebuild a workflow from scratch for every query. That drives up cost, slows responses, and weakens robustness. WorkflowGen captures full run records early and extracts reusable knowledge at both step and workflow level, including error fingerprints, best tool matches, parameter schemas, run paths, and ways to avoid exceptions.
Catalog record
| CREATOR | Ruocan Wei, Shufeng Wang, Ziwei Shi |
|---|---|
| YEAR | 2026 |
| COLLECTION | PAPERS |
| FORMAT | TXT |
| FILE SIZE | 25323 |
| LICENSE | http://creativecommons.org/licenses/by/4.0/ |
| RIGHTS | CC BY |
| SOURCE | arXiv |
Source: https://arxiv.org/abs/2604.19756
Browse the full library · About the Tower of Babel
Full text
The opening of the work, from the library's hosted text:
WorkflowGen:an adaptive workflow generation mechanism driven by trajectory experience Ruocan Wei, Shufeng Wang, Ziwei Shi Abstract Large language model (llm) agents often suffer from high repeated reasoning overhead, excessive token consumption, unstable execution chains, and inability to reuse historical experiences when handling complex tasks such as business queries, tool invocation, and workflow execution. traditional llm-based workflow generation methods rely on real-time planning from scratch for every query, resulting in high computational cost, slow response, and poor robustness. To address these issues, we propose WorkflowGen, an adaptive trajectory experience-driven framework for automatic workflow generation, with the primary goals of reducing token consumption and improving execution efficiency and success rate. At the early stage of workflow execution, our framework structurally captures the full trajectory and extracts reusable experiences at both node-level and workflow-level granularities, including error fingerprints, optimal tool mappings, parameter schemas, execution paths, and exception-avoidance strategies. Building upon this, we design a closed-loop generation mechanism that integrates trajectory rewriting, experience updating, and template induction, performing lightweight generation only on variable nodes. Additionally, we introduce a three-tier adaptive routing strategy that dynamically degrades among three modes—direct trajectory reuse, rewriting-based generation, and full initialization—based on the semantic similarity between the current query and historical trajectories.In the absence of large-scale annotated datasets, we conduct a qualitative comparison of WorkflowGen against three baselines: real-time planning, static single trajectory, and basic in-context learning.Our method significantly reduces token consumption (over 40% vs. real-time planning) by avoiding redundant full re-generation, improves execution robustness through proactive error avoidance and adaptive fallback (success rate gain of 20% on medium-similarity queries), and enhances deployability via modular, traceable experiences and cross-scenario adaptability.Overall, WorkflowGen achieves a practical balance of efficiency, robustness, and interpretability, addressing key limitations of existing approaches. Keywords: Agent; Automatic Workflow Generation; Trajectory Extraction; Experience Reuse; Token Efficiency. 1 Introduction In recent years, agents powered by large language models (LLMs) have been widely applied in domains such as office automation, data analysis, enterprise business querying, and robotic process automation (RPA) ( 4 ) . These agents typically accomplish complex tasks through multiple rounds of tool invocation, logical reasoning, exception handling, and result aggregation. Their execution process is essentially one of dynamic workflow generation and enactment ( 7 ) . However, existing approaches to agent workflow generation suffer from significant limitations: 1. Redundant reasoning leads to excessive token consumption. Similar or identical queries repeatedly trigger full planning processes, resulting in unnecessary computational overhead and increased costs due to redundant reasoning and tool invocations; 2. Poor execution stability and controllability. Relying on real-time LLM inference to generate execution chains often causes issues such as missing steps, incorrect parameters, mismatched tools, and unhandled exceptions; 3. Ineffective utilization of historical execution trajectories. Vast amounts of successful and failed experiences remain stored only as logs, failing to be transformed into structured, retrievable, reusable, and directly executable knowledge; 4. Lack of adaptive generation strategies. Systems cannot dynamically select optimal generation paths based on query similarity, making it difficult to balance generation quality against token cost. Current research primarily focuses on whether workflows can be generated, while systematic solutions for low-token-cost automatic workflow generation remain largely unaddressed.Inspired by Lei Liu et al.’s Think-in-Memory ( 2 ) framework—which stores LLMs’ prior reasoning traces to mitigate inconsistency from redundant inference—we embed the workflow’s historical execution trajectories into the agent’s memory. This reduces unnecessary token consumption from repeated calls and leverages lessons from past successes and failures to enhance stability and success rates. This paper proposes the WorkflowGen framework, with the core objective of minimizing token consumption while ensuring high execution success rate, thereby enabling efficient, stable, and autonomous workflow generation. The main contributions of this work are as follows: 1. We propose a dual-granularity trajectory experience extraction mechanism at both node-level and workflow-level, transforming raw execution logs into structured, directly reusable experiences to eliminate redundant reasoning at the source; 2. We design a lightweight workflow generation mechanism driven by trajectory rewriting, which preserves the overall structure and only rewrites variable nodes, significantly reducing the number of LLM invocations and token consumption; 3. We develop a three-tier adaptive routing strategy that automatically selects between reuse, rewriting, or initialization based on semantic similarity, achieving an optimal trade-off between performance and cost; 4. We conduct experiments in real-world business scenarios, demonstrating that WorkflowGen significantly outperforms conventional methods across three key metrics: execution success rate, response latency, and token consumption. Our WorkflowGen lies in performing hierarchical, structured extraction of experience directly from execution trajectories, enabling subsequent retrieval and rewrite-based reuse significantly reducing token consumption while improving success rates through continuous accumulation of experience. 2 Related Work Methods such as ReAct ( 7 ) and Reflexion ( 6 ) enable end-to-end workflow generation by having large language models dynamically output reasoning traces and execution steps. These approaches exhibit strong generality but require full reasoning for every query, resulting in high token costs. Moreover, they demand substantial agent expertise and struggle to be rapidly deployed in high-frequency, repetitive business scenarios. Applying memory-based paradigms to workflow planning is highly significant for the automatic generation of workflows. Existing work has already performed structured experience extraction from memory, incorporating lessons from both successful and failed cases ( 3 ; 1 ) . However, current methods largely operate at the textual or instance level and have not explored memory specifically over workflow execution trajectories. Consequently, they have not produced structured, retrievable, and directly executable workflow trajectory templates, thereby hindering large-scale, low-cost reuse of historical trajectories. Traditional BPM and RPA rely on manually defined process templates, which struggle to accommodate natural language queries and dynamic business requirements. Recent process induction approaches have primarily focused on structural mining ( 5 ) , without treating token consumption as a core optimization objective or establishing adaptive generation and degradation mechanisms. In contrast to the aforementioned approaches,WorkflowGen takes token consumption reduction as one of its core design objectives, integrating trajectory experience extraction, rewrite-based reuse, and adaptive routing into a unified framework to enable truly deployable and low-cost automatic workflow generation. 3 Methodology 3.1 Proposed Framework Our WorkflowGen comprises three tightly coupled core mechanisms that jointly enable efficient workflow generation under low token consumption: 1. trajectory experience extraction; 2. trajectory rewriting-driven workflow generation; 3. three-tier adaptive routing. The overall objective is to maximize reuse of historical experiences and minimize real-time reasoning by large language models, thereby reducing token consumption. The trajectory experience extraction mechanism hierarchically distills structured experience from historical execution logs, constructing a retrievable template library at both the node level and the workflow level to provide a knowledge foundation for reuse. The trajectory rewriting-driven workflow generation mechanism, upon identifying a similar historical trajectory, performs lightweight rewriting only on variable nodes (e.g., parameters or entities), thereby avoiding full re-planning and significantly reducing the overhead of large language model invocations. The three-tier adaptive routing mechanism dynamically selects among “direct reuse,” “rewrite-based reuse,” or “from-scratch generation” based on the semantic similarity between the current query and historical trajectories, achieving optimal trade-offs between token cost and task success rate. Together, these components form a closed-loop system: experience extraction supplies reusable assets, rewriting enables low-cost adaptation, and adaptive routing intelligently orchestrates the generation path. This synergistic design allows the system to continuously improve its efficiency through accumulated operational experience,