arXiv:2611.00628cs.SEOct 2026

Manuscript Offprint

arXiv:2611.00628

AgentPRO: Coordinating Compiler Optimizations for LLM Agent Workflows

Jie Ren, Zheng Wang

ABSTRACT

LLM agents repeatedly return to a model to generate actions and interpret tool results, incurring repeated context processing and generation overhead. Yet a value needed to execute an action need not be observed by the model to generate that action. This distinction creates an optimization opportunity: reconsider where model decisions are necessary, together with the work performed between them.

We present AgentPRO, a compiler framework for optimizing agent workflows as execution information becomes available. AgentPRO organizes planned duties, generation regions, and concrete operations in a hierarchical representation, distinguishing execution dependencies from observations required for generation. Region transformations combine compatible duties into fewer model requests, while operation transformations reduce redundant context and tool work. These scopes interact: eliminating a redundant read can remove an observation requirement that otherwise separates generation regions. AgentPRO coordinates transformations using initial plans, current observations, and historical execution profiles through just-in-time, adaptive, and profile-guided optimization. Runtime guards check state-dependent assumptions and retain fallback paths.

We implement guarded workflow transformations for AppWorld agents. On 115 tasks selected by successful historical baseline executions, automatic AgentPRO reduces all-attempt mean token consumption by 41.85% and mean component time by 6.61% relative to those baselines, successfully completing 110 of 115 tasks.

1 INTRODUCTION

LLM agents translate natural-language requests into model decisions and tool actions, supporting tasks from information retrieval to content recommendation. This convenience can come with substantial execution cost, even for a short request. On a movie-recommendation benchmark—selecting one of four candidate films based on four reference films—LLMCompiler reports approximately 20,000 input tokens and 230 output tokens for its ReAct baseline [7]. Processing inputs across repeated model calls can therefore dominate the token cost of a seemingly modest task.

The source of this cost lies partly in how agent execution is organized. Each model call can receive the same instructions and API descriptions, together with an expanding history of tool observations (Figure 1(a)). AgentDiet identifies irrelevant, redundant, and expired information in these trajectories and reduces it during execution [16]. Generated actions can repeat completed reads, and execution errors can trigger further generation and repair (Figure 1(b)). Reducing these costs requires deciding what each call must generate, which context it needs, and which tool operations remain necessary. These decisions span both the boundaries between model calls and the work performed within them.

Compiler techniques make such execution choices explicit and optimizable. LLMCompiler extracts parallelism among function calls [7]. SkVM adapts skills to model capabilities and combines compilation with runtime code solidification and adaptive recompilation [2]. ACON refines context-compression guidelines through agent failure analysis [6], while TraceCompiler converts execution traces into mostly deterministic workflows with residual model decisions [4]. These efforts use program structure, runtime state, or execution history to guide optimization. Building on this direction, we study how to coordinate transformations of generation structure and concrete operations as an agent workflow unfolds. Two properties of agent execution make this coordination challenging.

First, optimizations at different scopes are coupled. A later stage may request a record that an earlier tool call has already returned. Reusing that record can eliminate a read; if the read was the only intervening observation requirement, it can also enable neighboring duties to be generated together. Conversely, regrouping duties changes the context and work assigned to the model. Region and operation transformations therefore need a shared account of dependencies, observations, and effects to establish when they can be applied together.

Second, the information needed for these decisions arrives at different times. An initial workflow exposes intended duties, but the model determines concrete actions during execution. Tool results reveal available values and completed work, while traces from earlier runs reveal recurring patterns. A

MobiSys '27,

Jie Ren and Zheng Wang

References (13)