Giving an AI Agent Episodic Memory

TL;DR
Clara, Procol's AI Source-to-Pay agent, uses a Long-Term Memory Store to remember facts, decisions, and context across sessions. That turns it from a stateless chatbot into something that feels like a colleague.
Why memory matters
A procurement agent without memory treats every conversation as the first. It re-asks for data the user already provided, forgets approvals they already gave, and can't reference work done yesterday. Users notice immediately, and trust drops.
Our approach
We built a dedicated Long-Term Memory Store separate from the model provider. It stores:
- Facts: master-data lookups by the user.
- Decisions: approvals, rejections, preferences.
- Events: actions the agent or user took inside a session.
- Summaries: compressed context so the next prompt stays small.
The AI service writes to the store after meaningful turns and reads from it before generating a response.
Integration with the broader system
The memory store sits alongside the event-driven mediator. When a domain event is published, the AI service can both act on it and update memory. This keeps the agent coherent even when the user switches channels or returns hours later.
What changed
Users stopped repeating themselves. The agent could say "You approved this vendor last week — should I use the same terms?" That single sentence made the tool feel like part of the team rather than a search box.
What I learned
- Memory is a product feature, not just an implementation detail.
- Writing good memory is harder than reading it — you need clear rules about what to store and when.
- Keep memory outside the model so you can audit, version, and swap providers without losing continuity.