LLMs, GenAI, RAG, agents, evaluation · insight-0637
Persist agent state as explicit records, not only as a growing transcript
- Evidence type
- practitioner heuristic
- Difficulty
- medium
- Roles
- ML engineer, Applied AI
- Industries
- logistics, aviation
Summary: situation, action, reason, boundary
Situation
A long-running agent (hours, many tool calls) keeps all of its progress inside the conversation history.
Action
Store task, plan, completed steps with tool-call ids and results, and pending approvals in a database checkpoint after each step; rebuild a compact prompt from that state on resume.
Reason
Explicit state makes runs resumable, auditable and testable, and keeps the prompt to what the next decision needs.
Boundary
Multi-step agents, human-approval flows that wait for days, and batch agents.
Symptom or risk
A crash or deploy loses the run; restarting repeats completed side effects; and the transcript outgrows the context window.
Exceptions
Short single-session chats with read-only tools.
Trade-offs
More engineering than an in-memory loop; the state schema must be versioned as the agent evolves.
Pitfalls
Resuming from state without checking whether the world changed meanwhile, for example seats already sold.