Source-linked AI summary

AgentDecarbonizer: Carbon-Aware Execution for AI Agents

Leyi Yan, Shuangning Li, Sihang Liu

arXiv:2608.20566v1cs.LG

TL;DR

AI agents create substantial carbon-accounting challenges because repeated model calls, tool interactions, uncertain durations, and reusable context affect emissions. The paper characterizes OpenClaw workloads and presents AgentDecarbonizer, which selects deadline-feasible schedules while accounting for cache recomputation. It reduces emissions by up to 57.9% against a carbon-agnostic baseline and up to 37.5% against a current-optimal-grid baseline.

  • Problem

    Agent carbon emissions are shaped by token use, context caching, grid intensity, uncertain execution time, and cache recomputation during spatial shifting, which existing carbon-aware methods do not directly address.

  • Method

    AgentDecarbonizer conservatively estimates task duration and selects deadline-feasible temporal and spatial schedules while modeling cache recomputation overhead.

  • Results

    Up to 57.9% carbon savings are achieved versus a carbon-agnostic baseline and up to 37.5% versus a baseline selecting the carbon-optimal grid at task start time.

  • Takeaways & Limitations

    Deadline-aware temporal shifting and cache-aware grid shifting can reduce agent workload emissions while meeting user-specified deadlines.

  • Takeaways & Limitations

    Spatial shifting is evaluated in simulation because GPT-5.4 does not provide a user-accessible API for choosing among service locations.

Abstract

from arXiv · show

AI agents extend large language models from single prompt-response interactions to long-running, goaldirected workflows that issue many model calls, invoke tools, and interact with external environments. These workflows enable tasks such as software repair, data analysis, and experiment management, but their repeated model invocations can incur substantial carbon emissions. This paper characterizes the carbon emissions of OpenClaw agent workloads using WildClawBench, and shows that emissions depend on token consumption, context cache reuse, and the carbon intensity of the grid. Our characterization identifies deadline flexibility as an opportunity for carbon-aware execution: agent tasks can wait for lower-carbon-intensity periods or shift to lower-carbon grids. However, doing so requires handling uncertain execution time for temporal shifting and cached context recomputation during spatial shifting. We present AgentDecarbonizer, a carbon optimizer for AI agents that runs alongside OpenClaw. Given a task prompt and user-specified deadline, AgentDecarbonizer conservatively estimates task duration and selects deadline-feasible execution schedules, while accounting for cache recomputation overhead during spatial shifting. Evaluated on WildClawBench workloads with 60 agent tasks across four grids, AgentDecarbonizer reduces carbon emissions by up to 57.9 % compared with a carbon-agnostic baseline and by up to 37.5 % compared with a baseline that selects the carbon-optimal grid at task start time.

1 Introduction

AI agents turn LLM interactions into long-running, multi-step workflows whose emissions vary with execution behavior, caching, and grid conditions. AgentDecarbonizer addresses these factors by selecting deadline-feasible, cache-aware schedules and reduces emissions substantially in WildClawBench evaluations.

  • Workload characterization: 60 WildClawBench tasks show highly diverse agent execution, while input tokens comprise 99.1% of processed tokens and caching eliminates recomputation for 94.6% of input tokens.The benchmark spans six task categories and reveals why context caching is central to agent carbon accounting.
  • Carbon drivers: Agent emissions depend on token consumption, execution time, and the carbon intensity of the serving grid, which varies across locations and over time.The paper estimates energy from token-level consumption and converts it using grid carbon intensity.
  • Execution challenges: Context caching reduces carbon emissions by 80.7%, making cache preservation and recomputation overhead essential when shifting execution across grids.Spatial shifting can lose reusable context, requiring additional computation to rebuild cached state.
  • AgentDecarbonizer: AgentDecarbonizer conservatively estimates duration, forecasts carbon intensity, and selects schedules across time and grids that satisfy user deadlines.Its local duration estimator uses task phases and complexity, while optimization accounts for cache-related costs.
  • Evaluation: Up to 57.9% carbon savings are achieved versus a carbon-agnostic baseline under a flexible 24-hour deadline, while deadlines are always met.Evaluation covers 60 WildClawBench tasks across six categories and four grids.

2 Background and Motivation

The paper motivates carbon-aware agent execution by connecting autonomous, tool-using workflows with the operational carbon of energy-intensive LLM inference. Carbon accounting depends on workload energy and grid carbon intensity, while runtime decisions target operational rather than embodied carbon.

  • Autonomous agents: Autonomous agents plan steps, invoke tools, interact with environments, and validate or retry results within goal-directed workflows.OpenClaw is presented as an open-source platform supporting such workflows and connecting requests, actions, tools, and model APIs.
  • Motivation: Repeated model invocations and tool calls increase token consumption and execution time, motivating carbon-aware analysis of agent workloads.These workloads extend conventional single prompt-response interactions into longer computations.
  • Carbon accounting: Operational carbon is runtime electricity-related emissions, whereas embodied carbon comes from manufacturing computing hardware and is not changed by runtime scheduling decisions.This paper therefore focuses on optimizing operational carbon.
  • Carbon accounting: The accounting model multiplies workload energy by grid carbon intensity, measured in gCO2e/kWh, to express emissions in gCO2e.Carbon intensity varies with regional energy mixes and over time.
  • Evaluation context: Four-grid carbon-intensity traces and task workloads provide the basis for comparing emissions across locations and execution times.The supplied passages identify grid comparisons and time-varying carbon-intensity traces as evaluation inputs.

3 Carbon Emissions of AI Agents

The paper accounts for remote model-service carbon using time- and grid-dependent energy and carbon-intensity estimates. Its agent-specific model separates token categories and treats remote inference as the primary optimization target.

  • Energy estimation: The accounting method provides per-token energy estimates for the remote inference workload and supports carbon optimization across time-varying grids.Energy estimation is identified as the main challenge after carbon-intensity data is obtained.
  • Accounting scope: Agent carbon accounting focuses on operational carbon from remote model services, while local device execution is treated as a lightweight common background component.OpenClaw splits execution between a local client and remote model APIs.
  • Accounting method: For each interval and grid, emissions are computed from remote API energy multiplied by the corresponding average grid carbon intensity.The formulation supports API calls served by different grids over an agent task’s execution period.
  • Token model: The energy model distinguishes output tokens, input tokens, and cached input tokens using API-reported token metadata.Cached input tokens receive separate treatment because context caching avoids recomputing shared context.
  • Token model: Output-token energy is modeled as six times input-token energy, while cached input tokens use 10% of the regular input-token price as a proxy for energy.These assumptions are motivated by GPT-5-class API pricing relationships.

4 Characterization of AI Agent Workloads

WildClawBench agent workloads are highly diverse in execution demands and carbon emissions. Their emissions are shaped by token consumption, caching, and the grid and time of execution.

  • 60 WildClawBench tasks span six categories and exhibit substantial variation in execution time, API calls, and token consumption.
  • Up to 103 API calls occur for task 2.1 in code intelligence, while safety-alignment tasks 6.4–6.9 require no more than 8 calls.Execution time is largely consistent with API-call count.
  • 99.1 % of processed tokens are inputs, and 94.6 % of input tokens are cached, indicating frequent context reuse.Token consumption ranges from 52k tokens for task 6.5 to 8.4M for task 2.1.
  • Carbon emissions depend strongly on the grid and task start time, creating shifting opportunities constrained by user-specified deadlines.The four grids have interleaved carbon-intensity traces across the day.
  • 80.7 % of total carbon emissions are saved by context caching on average, consistent with the 94.6 % cached-input-token hit rate.Caching is especially relevant for input-heavy agent tasks.

5 High-Level Ideas

AgentDecarbonizer addresses deadline uncertainty and cache effects in carbon-aware execution for autonomous agents. It combines progress-aware duration estimation with cache-aware spatial shifting.

  • 5 High-Level Ideas: AgentDecarbonizer targets deadline-constrained temporal shifting and cache-overhead-aware spatial shifting for OpenClaw agent workloads.
  • 5.1 Deadline and Progress Awareness: Agent execution time is difficult to predict because iterative model calls and tool interactions depend on earlier results, planning, observations, and retries.
  • 5.1 Deadline and Progress Awareness: The system generates a conservative initial duration estimate from the prompt, expected steps, step complexity, and model generation speed, then refines it after each step.
  • 5.2 Cache-Aware Grid Shifting: Spatial shifting can cause cache misses and extra computation because serving systems typically keep cached states local to a server or cluster.

6 AgentDecarbonizer

AgentDecarbonizer coordinates temporal and spatial execution shifting for OpenClaw agents under deadlines, using duration estimates, carbon forecasts, and cache-aware planning. Its controller executes and periodically replans these schedules, while spatial shifting is evaluated through a simulator because GPT-5.4 lacks user-selectable serving locations.

  • System Overview: AgentDecarbonizer jointly selects execution intervals and service grids while preserving the original OpenClaw agent execution.It combines temporal waiting, spatial shifting, deadline information, carbon forecasts, duration estimates, and cache miss costs.
  • Execution Time Estimator: The execution-time estimator uses a local 4B Gemma 4 model to generate an initial estimate and refine remaining duration from runtime traces.It extracts task features, decomposes work into phases, and updates estimates using completed phases, tool calls, tokens, and API or message history.
  • Cache-Aware Carbon Model: AgentDecarbonizer models spatial shifting as a cache penalty by estimating context recomputation from token consumption and cached-token metadata.Switching grids can require prefill-like reprocessing of previously cached input tokens, whereas staying in one grid preserves reusable context.
  • Carbon-Aware Planner: The planner selects the lowest-carbon feasible intervals, then reoptimizes unfinished execution using updated forecasts, duration estimates, and runtime cache signals.It uses 15-minute forecast granularity, refreshes forecasts hourly, and falls back to default OpenClaw execution when the remaining deadline cannot accommodate the estimate.
  • Execution Controller: The execution controller waits, resumes, or shifts locations according to the plan while collecting progress and cache statistics for later replanning.Spatial shifting is implemented in a simulator because GPT-5.4 does not provide a user-accessible API for choosing service locations.

7 Theoretical Analysis

The theoretical analysis formalizes deadline-feasible placement with carbon and cache-recomputation costs. Under local cache recomputation, dynamic programming solves the objective exactly, and conservative duration estimates provide a deadline guarantee when actual runtime stays within the estimate.

  • Carbon-Aware Execution Placement: AgentDecarbonizer allocates ordered execution intervals to chronological candidate intervals and selected regions, minimizing predicted emissions plus cache-recomputation overhead.The placement remains in task order but may defer and resume execution before the deadline.
  • Dynamic Programming Under Cache Recomputation: Under local cache recomputation, overhead depends only on whether the service region changes between consecutive execution intervals.Remaining in the same region preserves context cache, while switching regions causes a cache miss and context regeneration.
  • Dynamic Programming Under Cache Recomputation: The dynamic-programming algorithm returns an exact minimizer of the placement objective in O(K|R|H) time and O(|R|H) working memory.Backpointers reconstruct the placement plan, and the local cache structure reduces the naive O(K|R|^2H^2) evaluation.
  • Deadline Guarantee: If actual accumulated runtime T_run is at most the conservative estimate eT, any returned feasible schedule completes by the deadline.A sufficient condition is that actual execution time does not exceed the estimate for every task phase.

8 Evaluation

AgentDecarbonizer is evaluated on six WildClawBench workloads, four grids, multiple deadlines, and two model APIs. It achieves substantial carbon savings through deadline-aware temporal and spatial shifting while maintaining conservative execution estimates and low local overhead.

  • Evaluation Setup: The evaluation replays six category-level workloads formed from 60 WildClawBench tasks across four grids and deadlines of 3, 6, 12, and 24 hours.The setup uses recorded OpenClaw traces and carbon-intensity scenarios to evaluate runtime scheduling decisions.
  • Overall Carbon Savings: 34.9–57.9 % average carbon savings are achieved against the average baseline, while savings against the current-optimal baseline range from 3.3–37.5 %.Savings increase as deadlines become more flexible, enabling more waiting and cross-grid shifting.
  • Execution Behavior: Short workloads can wait for lower-carbon periods on one grid, whereas long-running workloads more often migrate across grids before completion.Mid-task migration can occur when predicted grid carbon intensity changes substantially.
  • Model Comparison: 4–35.8 % and 35.2–57.3 % carbon reductions are obtained with Gemini 3.1 Pro against the current-optimal and average baselines, respectively.The savings ratios remain similar across GPT-5.4 and Gemini 3.1 Pro despite Gemini’s shorter execution times and lower token usage.
  • Ablation Studies: 34.1–45.7 % average carbon reduction comes from shifting workloads across grids rather than waiting on a single grid.The benefit varies with deadline and grid carbon-intensity variation.
  • Ablation Studies: Hourly carbon-intensity updates remain close to ideal prediction, while one-time prediction degrades over longer horizons as MAPE reaches 16.3 % at 24 hours.Next-hour predictions have a low MAPE of 3.3 %, supporting near-term replanning.
  • Ablation Studies: The execution-time estimator is conservative for all workloads, and all evaluated workloads complete before their user-specified deadlines.The estimator’s predicted durations exceed actual durations, providing slack for deadline compliance.
  • Local Overhead: 0.7–5.2 min of local execution overhead is incurred with average power consumption of 14.9 W.The local Gemma model used for execution-time estimation is the main source of overhead.

9 Related Work and Discussion

AgentDecarbonizer extends carbon-aware load shifting to AI-agent workloads by addressing deadline constraints and context-cache recomputation. It preserves the original model API and agent behaviors while using modular, adaptable estimation components.

  • Carbon-aware Optimization: AgentDecarbonizer adapts temporal and spatial carbon-aware shifting to agent workloads with uncertain execution times and user deadlines.The related challenge is meeting deadlines while exploiting variation in grid carbon intensity.
  • Context Caching: Spatial shifting can lose local context-cache reuse and require cache recomputation, creating an agent-specific cost absent from generic load-shifting approaches.The implementation assumes caches are local to a serving backend such as a server or cluster.
  • Relationship to AI-System Optimization: AgentDecarbonizer optimizes agent execution without changing the serving system, model API, or agent behaviors.Its energy estimate is developed from prior research and vendor pricing and is not tied to a specific energy model.
  • Execution-Time Prediction: Its execution-time estimator uses conservative, in-flight updates for deadline-aware load-shifting decisions and is implemented as a modular component.The modular design allows future prediction models to be incorporated.

10 Conclusions

The paper characterizes carbon emissions from autonomous AI-agent workloads and presents AgentDecarbonizer for deadline-aware shifting across cleaner times and grids. The system accounts for cache recomputation and reduces emissions while meeting user deadlines.

  • Conclusion: AgentDecarbonizer shifts agent execution to lower-carbon periods and grids while accounting for context-cache savings and recomputation costs.It avoids spatial shifts when cache recomputation would outweigh the carbon benefit.
  • Conclusion: Up to 57.9 % carbon reduction is achieved for agent workloads while meeting user-specified deadlines.The conclusion reports this result across the paper’s evaluated workloads.

A.1 Execution-Time Estimator Calibration Categories

The execution-time estimator calibrates common agent execution phases using typical step counts, predicted task complexity, and a token-based wall-clock conversion. Its categories and per-step assumptions remain generic and customizable.

  • Estimator Calibration: The estimator adjusts typical phase step counts according to predicted task complexity before converting them into approximate wall-clock time.The conversion uses 267.6 tokens per step from Open-SWE-Traces.
  • Estimator Calibration: Table 4 lists phase categories and their number of steps per phase as the estimator’s calibration basis.The categories describe common execution phases rather than benchmark-task-specific profiles.
  • Estimator Calibration: The calibration values are generic because benchmark tasks were not profiled, but categories, step counts, per-step token counts, and generation times can be customized.Customization can target specific workloads and backend models.

A.2 Feature-Extraction Prompt

The appendix specifies structured prompts for extracting task features and decomposing work into phases, then proves that the scheduling dynamic program is optimal, efficient, and deadline-feasible.

  • A.2 Feature-Extraction Prompt: The feature-extraction prompt restricts the local model to compact execution-time facts derived from task input and model-trace features.It distinguishes the target model’s trace from the estimator LLM’s trace and requires minified JSON with fixed top-level fields.
  • A.2 Feature-Extraction Prompt: Repeated work over files, items, records, pages, or messages is represented by batch_item_count and repeated_work.The repeated item count is recorded when similar work must be performed across many inputs.
  • A.3 Phase-Decomposition Prompt: The phase-decomposition prompt converts extracted task features into timing phases, each described by its phase, work, and driver, plus dominant risks.It accepts TASK_FEATURES from Step 1 and returns a constrained JSON structure.
  • A.4 Proof of Theorem 7.1: The dynamic program attains the global optimum because every feasible placement corresponds to a finite final state, and backpointers recover an optimal plan.Prefix summaries and two smallest region-value pairs make transitions constant-time after preprocessing.
  • A.4 Proof of Theorem 7.1: The dynamic-programming state D(k)_{r,t} stores the minimum objective for the first k ordered execution intervals ending in region r at candidate start time t.States with no feasible partial placement receive +∞, with the empty-set minimum also defined as +∞.
  • A.4 Proof of Theorem 7.1: Each transition adds predicted carbon cost and a cache-recomputation penalty only when consecutive intervals use different regions.The recurrence follows by induction from the predecessor placement and the region-dependent transition cost.
  • A.4 Proof of Theorem 7.1: The algorithm runs in O(K|R|H) time and uses O(|R|H) working memory when retaining only adjacent layers and prefix summaries.Storing all backpointers additionally supports plan recovery.
  • A.5 Proof of Theorem 7.2: With K = ⌈eT/Δt⌉ ordered intervals on the grid H, the recovered schedule is non-overlapping, deadline-feasible, and supports completion when actual runtime T_run ≤ eT.The selected intervals provide sufficient active runtime while allowing pauses at interval boundaries.
Loading 2608.20566v1…