Sun, May 18, 2025
When AI agents start using tools, the context window fills up fast. Each run_command or read_file tool call dumps a lot of text that quickly loses relevance in subsequent steps.
I’ve been experimenting with the idea of “recursive agents” to mitigate this issue. The idea is simple: An agent can kick off new instances of itself to handle specific subtasks.
The key part is that, when a child agent finishes, it doesn’t send its entire operational log or full tool output back to the parent; instead, it returns only a brief summary of the results.
This does two important things:
- Keeps the parent agent’s context window usage down.
- Helps the parent agent stay focused on the overall objective.
I’ve implemented this idea here: https://github.com/icholy/sloppy. The agent is simply provided with a run_agent tool.
Note: The description fields included here are abbreviated.