TL;DR
Deploying LLM agents in enterprise environments is notoriously difficult due to noisy data, complex multi-turn reasoning, and the inability to safely run online exploration. This paper introduces DT-MDP-CE, a framework that abstracts an agent's behavior into a finite "Digital-Twin" Markov Decision Process, learns an optimal policy offline from mixed-quality logs using contrastive inverse reinforcement learning, and guides the live agent via prompt-based context engineering—all without altering a single model weight.
What Problem Does This Paper Address?
While LLM-based agents excel in sandbox environments like games or mathematical reasoning, translating them to enterprise domains like IT Operations (ITOps) and Site Reliability Engineering (SRE) introduces severe bottlenecks:
- Data Scarcity and Noise: Enterprise logs are often proprietary, limited, and messy.
- High Operational Risk: You cannot let an agent learn via online "self-play" or trial-and-error on live corporate infrastructure.
- Sparse Feedback: Verifiable reward signals (like whether a complex system issue was correctly diagnosed) are delayed and hard to pinpoint to a specific step in a multi-turn conversation.
Standard fine-tuning approaches (Supervised Fine-Tuning or RLHF) fail here because they require massive amounts of clean data or active online interaction. The authors tackle this gap by asking: How can we safely and efficiently optimize an LLM agent's sequential decision-making using only a modest batch of historical, mixed-quality offline logs?
Methods
The authors propose Context Engineering via Digital-Twin MDP (DT-MDP-CE), which consists of three core components:
- Digital-Twin MDP (DT-MDP): Instead of trying to optimize over the infinite space of raw text inputs and outputs, the framework uses domain knowledge to map the agent's observations and thoughts into a simplified, finite state and action space. For example, in an IT network, states and actions are mapped to distances on a system topology graph.
- Robust Contrastive Inverse RL (Robust-IRL): To avoid manually engineering step-by-step rewards, the framework uses T-REX (Trajectory-ranked Reward EXtrapolation). By looking at pairwise comparisons of historical trajectories (ranking successful runs over failed ones), it automatically learns a dense reward function. It then applies Conservative Q-Learning (CQL) to derive an optimal policy completely offline.
- RL-Guided Context Engineering: Instead of updating the LLM's weights, the learned offline policy is used to dynamically alter the agent's prompt context during live execution.
The authors implement three context engineering strategies:
- Strategy I (Suggesting): Injecting high-probability actions as recommendations into the prompt.
- Strategy II (Pruning): Filtering out low-probability actions before the agent wastes time exploring them.
- Strategy III (Prioritizing): Reordering the agent's exploration queue based on policy scores.
Datasets
The framework was trained and evaluated using ITBench, a benchmark designed for evaluating AI agents on real-world IT automation tasks:
- Training Set: 819 trajectories (12,079 turns) collected across 12 SRE diagnosis scenarios (including feature-flag failures via Flagd and fault injections via Chaos Mesh) using a variety of open and closed LLMs (GPT-4o, Mistral, Granite).
- Evaluation Set: 6 unseen ITBench test scenarios, repeated 15 times each to ensure statistical stability.
Key Insights and Ideas
- Learning from Failure: Traditional imitation learning (Behavior Cloning) requires pristine expert demonstrations. By using contrastive inverse RL, this framework successfully leverages bad or suboptimal trajectories to learn what not to do, which is highly practical since failures are abundant in enterprise logs.
- Topology Over Names: Abstracting states based on structural relationships (e.g., topology graph distances) generalizes far better to unseen systems than using explicit entity names or types.
- Pruning Saves Tokens: Modifying agent behavior via context engineering typically adds token overhead. However, using the policy to prune unnecessary actions (Strategy II) actually reduces overall token consumption and execution time by preventing the agent from chasing dead ends.
Key Results
The framework was validated on two distinct agent architectures: a domain-specific Explanations over Graphs (EoG) agent and a general-purpose ReAct agent.
- Significant Performance Gains: Across both architectures, DT-MDP-CE consistently outperformed baseline agents. For instance, the topology-based RL-IRL configuration achieved the highest average ranks in diagnostic accuracy.
- Superiority Over Baselines: Critical Difference (CD) analysis showed that policies guided by contrastive inverse RL (RL-IRL) significantly outperformed both standard Behavior Cloning (BC) and sparse reward baselines.
Limitations and Future Work
- Heuristic Abstraction: Constructing the initial Digital-Twin MDP mapping still requires human domain expertise to decide how text observations should be vectorized into states and actions.
- Domain Narrowness: The framework was primarily tested on IT automation (SRE and software engineering). Its efficacy in other high-stakes enterprise domains, like healthcare or finance, remains to be proven.
- Future Direction: The authors plan to bridge the gap between context engineering and fine-tuning by using the long-term cumulative rewards generated by the DT-MDP to directly guide supervised fine-tuning pipelines.
Summary updated