Abstract
Large Language Model (LLM) agents often struggle in complex environments because they are forced to simultaneously explore their surroundings and execute tasks, leading to inefficient trial-and-error. This paper introduces AutoContext, a framework that performs a systematic, one-off exploration phase to build a reusable knowledge graph of an environment's specific details. By decoupling exploration from execution, AutoContext allows off-the-shelf agents to access necessary facts directly, drastically improving both success rates and interaction efficiency across various benchmarks.
The Gap in Agent Context
Imagine trying to cook a meal in a friend's kitchen. Before you start chopping onions, you usually open a few cabinets to figure out where the pans, knives, and spices are. You build a mental model of the specific instance of that kitchen.
Current LLM agents rarely get this familiarization phase. While they might have "domain-level context" (knowing that stoves require fuel) or "task-level context" (knowing the recipe), they lack instance-level context (knowing that this specific stove is in the yard and requires coal).
To compensate, existing agent frameworks use an "explore-and-solve" paradigm. They fumble around the environment while trying to complete the task. This is highly inefficient: agents repeatedly rediscover the same information, get stuck in loops, and if you give them a new task in the exact same environment, they have to start their exploration all over again. The authors tackle this by asking: Can we decouple exploration from task execution to create a reusable, plug-and-play memory of the environment?
AutoContext: Decoupling Exploration from Execution
The authors propose Instance-Level Context Learning (ILCL) via a method called AutoContext. Instead of exploring on the fly, AutoContext runs a dedicated, task-agnostic exploration phase before any specific task is assigned.
It relies on two main components:
- The TODO Forest: A data structure that tracks the agent's exploration history. It records states, successful actions, and crucially, failed attempts (negative feedback like syntax errors or missing prerequisites). It can operate in "Action Mode" (tracking atomic steps) or "Agent Mode" (tracking high-level subtasks).
- The Plan-Act-Extract Loop: An iterative process driven by three LLM roles:
- Planner: Proposes new paths to explore based on the TODO Forest, specifically trying to correct past errors and resolve dependencies.
- Actor: Executes the Planner's proposed steps in the environment.
- Extractor: Analyzes the Actor's trajectory and updates a free-form Knowledge Graph (KG) with new facts (stored as subject-relation-object triplets).
Once exploration is complete, the resulting Knowledge Graph is serialized into a simple text document. This document can then be prepended to the prompt of any standard downstream agent (like ReAct or Reflexion), giving it an instant mental map of the environment.
Experimental Evaluation
The authors evaluated AutoContext across four diverse, interactive benchmarks:
- TextWorld: A text-based game focusing on a complex cooking challenge requiring navigation of up to 12 rooms.
- ALFWorld: Text-based interactions aligned with embodied household tasks.
- Crafter: An open-ended 2D survival world where agents must gather resources and unlock a technology tree.
- InterCode-Bash: An OS-level control testbed where agents operate within a Docker container to manage file systems.
Key Results and Performance Gains
Adding AutoContext to existing state-of-the-art agents yielded massive performance leaps across all tested domains.
- Success Rates: In TextWorld, the success rate of a standard ReAct agent jumped from 37% to 95%. In ALFWorld, under a tight 10-step budget, success skyrocketed from 48.3% to 97.3%.
- Execution Efficiency: Agents equipped with AutoContext solved tasks much faster. In TextWorld, the average steps required for a successful ReAct run dropped from 60.7 to 42.7.
- Exploration Speed: AutoContext is incredibly fast at mapping environments, covering >95% of environmental entities in just 200 steps in TextWorld and 80 steps in ALFWorld.
Discussion
Separation of Concerns
Forcing an agent to learn the environment while solving a complex task overwhelms its context window and reasoning capabilities. A dedicated familiarization phase yields a much cleaner, more useful mental model. Furthermore, because AutoContext outputs a standard text-based Knowledge Graph, it is completely agent-agnostic.
Limitations
AutoContext currently assumes the environment is relatively stable. If the environment changes dynamically (e.g., items move frequently), the upfront Knowledge Graph may become outdated. Additionally, the initial exploration phase requires a compute budget, making it most valuable for environments where multiple tasks will be performed rather than "disposable" single-use scenarios.
Summary updated