Problem
You need to process multiple related tasks where later jobs should have access to the results of earlier ones. Each job should build on accumulated knowledge.Solution
Store job results in a persistent context file that grows over time. Each new job receives the entire accumulated memory as context.Example
Build knowledge across research tasks:Agent Loop with Memory
Continuous iteration with accumulated context:How It Works
- Results are appended to a file (
memory.txt) - The entire file is read and included in subsequent prompts
- The model sees the full history and can reference previous work
- The loop continues until a termination condition is met
Memory Management
Structured memory:Use Cases
- Multi-step research: Each query builds on previous findings
- Iterative writing: Continue long-form content across multiple jobs
- Session context: Maintain conversation state across interactions
- Progressive refinement: Gradually improve output based on accumulated feedback