Paris MongoDB User Group
MongoDB as your LLM agent's
audit trail
and why it makes debugging agents actually smoother
OVHcloud Offices, Paris Tuesday, April 21
Ibrahim Guoual · MUG Paris
the problem
This is how most apps store chat history
messages = []
When your agent fails at 2am, what do you look at?
reality check
A conversation is not a list of strings
What you think it is
messages = [
{"role": "user", "content": "what's the weather?"},
{"role": "bot", "content": "it's 18°C in Paris"}
]
What it actually is
{
role: "assistant",
content: null,
tool_calls: [{
name: "get_weather",
args: { city: "Paris" }
}],
usage: { tokens: 312 },
ts: "2025-04-21T19:02Z"
}
Tool payloads differ per tool. MongoDB stores all shapes, no schema, no migration.
demo
Insert it. Then find the bug.
db.sessions.insertOne({
session_id: "abc123",
messages: [
{ role: "user", content: "Book a flight to Lyon" },
{ role: "assistant",
tool_calls: [{ name: "search_flights",
args: { from:"CDG", to:"LYS" } }] },
{ role: "tool", name: "search_flights",
result: { error: "API timeout", flights: null } }
]
})
// find every session where a tool failed
db.sessions.find({
"messages.result.error": { $exists: true }
})
honest verdict
When MongoDB wins, and when it doesn't
Use MongoDB when
- You need persistence across restarts
- Multiple users and sessions
- Agents that use tools
- You want to debug failures
- Analytics on agent behaviour
Redis is fine when
- Last N messages only
- Single session, no persistence
- No need to query history
- Raw speed is everything
"Storing history in memory is a choice.
Most people make it by accident."