Agent Harness for Long-Running Tasks
Implement a two-agent system (initializer and coding) to enable LLMs to manage long-running, multi-session tasks by preserving context and progress across discrete context windows.
When to use
Use when an AI agent needs to perform a complex task that cannot be completed within a single context window, requiring multiple sessions over an extended period.
How to apply
First, design an initializer agent whose role is to set up the environment for the task.
This agent should perform initial configurations, gather necessary resources, and prepare the workspace.
Second, create a coding agent responsible for incremental progress within each session.
This agent must be designed to leave clear artifacts and summaries of its work for the next session, ensuring continuity.
Finally, integrate a context management mechanism like compaction to efficiently manage the information passed between sessions, preventing the context window from being exhausted.
Glossary
- AI agent
- An artificial intelligence system designed to perceive its environment, make decisions, and take actions to achieve specific goals, often interacting with tools or other systems.
- Complex task
- A task that requires multiple steps, decision points, and potentially external interactions, making it difficult to complete in a single, uninterrupted operation.
- Context window
- The limited amount of text (tokens) that an LLM can process or 'remember' at any given time during an interaction. Information outside this window is typically forgotten.
- Multiple sessions
- A task execution broken down into several distinct, sequential interactions with an LLM, where each interaction might occur at a different time or with a fresh context.
- Initializer agent
- A specialized AI agent responsible for the initial setup and preparation of an environment or task, ensuring all prerequisites are met before the main work begins.
- Coding agent
- An AI agent specifically tasked with performing the core work of a project, making incremental progress, and documenting its actions for subsequent sessions.
- Incremental progress
- The process of completing a task in small, manageable steps, where each step builds upon the previous one, rather than attempting to finish the entire task at once.
- Clear artifacts
- Tangible outputs or records generated by an agent during a session (e.g., code, logs, summaries) that clearly document its work and state, allowing subsequent agents to pick up seamlessly.
- Context management mechanism
- Strategies or tools used to efficiently handle and condense information within an LLM's context window, preventing it from overflowing while retaining essential details.
