Manage context and memory
Reliability degrades as the context window fills with noise. Curate what the agent sees so the signal it needs is not buried.
More context is not better context
Stuffing everything into the prompt feels safe but hurts reliability. Models lose track of details in long, cluttered contexts, and irrelevant material actively distracts them. The goal is the smallest context that contains what the step actually needs.
Retrieve on demand, summarize the rest
Pull in information when a step needs it rather than front-loading all of it. For long-running tasks, summarize prior steps into a compact running state instead of carrying the full transcript. This keeps the working context focused as the task grows.
Guard what enters the context
Content the agent reads can carry instructions of its own, which is both a reliability and a security problem. Be deliberate about what external text you let into the context, and treat it as data, not commands.
Key takeaways
- Aim for the smallest context that contains what the step needs.
- Retrieve information on demand and summarize long histories.
- Treat external content as data, and be careful what enters the context.
Further reading
- OWASP Top 10 for LLM Applications OWASPThe standard catalog of security risks for LLM apps, including prompt injection and data leakage.