Trajectories
Trajectories record the decisions the enterprise memory service makes while answering a recall: which retrieval hops ran, when it fell back to another strategy, and how an agentic recall loop proceeded. Use them to debug unexpected recall results.
When Trajectories Are Recorded
A trajectory is recorded when a recall runs with tracing enabled (the trace flag on the recall input). The enterprise memory service then:
- Starts a trajectory (ID prefixed
traj_) for the query. - Appends events as the recall proceeds.
- Returns the trajectory in the recall result’s
trajectoryfield and hands it to the storage backend to save.
Event Types
Each event has a type, a timestamp, and a data object.
| Event Type | Recorded when | Typical data |
|---|---|---|
fallback | Hybrid recall’s RAG pass was insufficient and the service switched to LLM mode | reason: "RAG insufficient", rag_threshold |
fallback | The hot tier returned fewer results than requested and cold-tier search ran (see Storage Tiering) | reason: "hot tier insufficient", hot_count, limit |
search | Agentic recall’s seed RAG hop | hop: "seed", query, added |
expand | Agentic recall expanded from the newest results (graph hop or cue expansion) | added, reason or source |
re_query | Agentic recall searched again with a rewritten query | query, added, reason |
stop | Agentic recall’s controller decided the working set was sufficient | reason |
The event type enum also defines filter, rank, threshold, association, and rerank, but the current recall pipeline does not emit them.
Retrieve a Trajectory
The trajectory endpoints are served at /trajectories (no /v1 prefix) and require the workspace_id query parameter.
curl "$MEMORYLAYER_URL/trajectories/$TRAJECTORY_ID?workspace_id=$WORKSPACE_ID" \ -H "Authorization: Bearer $API_KEY"Response:
{ "id": "traj_0f3c9a...", "workspace_id": "my-workspace", "query": "who owns the billing service migration?", "events": [ { "type": "search", "timestamp": "2026-04-01T12:00:00.100Z", "data": {"hop": "seed", "query": "who owns the billing service migration?", "added": 8} }, { "type": "expand", "timestamp": "2026-04-01T12:00:00.420Z", "data": {"added": 3, "reason": "follow the owning team"} }, { "type": "stop", "timestamp": "2026-04-01T12:00:00.810Z", "data": {"reason": "owner identified"} } ], "created_at": "2026-04-01T12:00:00.095Z", "ttl_seconds": 86400}Returns 404 if the trajectory does not exist, has expired, or the storage backend does not persist trajectories.
List Trajectories
curl "$MEMORYLAYER_URL/trajectories?workspace_id=$WORKSPACE_ID&limit=20&offset=0" \ -H "Authorization: Bearer $API_KEY"limit defaults to 20 (max 100).
{ "trajectories": [...], "total_count": 128, "limit": 20, "offset": 0}Both endpoints require trajectories:read in the target workspace.
Trajectory Expiration
Trajectories are ephemeral. Each has a ttl_seconds field (default 86400 = 24 hours); expired trajectories return 404.
Debugging Recall Behavior
- Why did recall take the slow path? Look for a
fallbackevent withreason: "RAG insufficient"— the top RAG score was belowrag_threshold, so the service rewrote the query with the LLM. - Why did cold memories appear? A
fallbackevent withreason: "hot tier insufficient"means cold-tier search ran and its results were merged. - What did agentic recall do? Walk the
search/expand/re_query/stopsequence.addedshows how many new memories each step contributed; a loop that ends withoutstophit its step limit or ran out of new results. - Where did the time go? Compare event timestamps to find the slowest step.
The admin dashboard includes a Trajectories view that reads from the /trajectories endpoints.