Use Cases
- Hydrate agent runtime with relevant trace context before task execution
- Share trace summaries with external planning or evaluation tools
- Reconstruct causal chains from memory (
linked_trace_ids) - Export historical trace logs for auditing, reflection, or simulation
- Recover lost agent state by time-bound export and rehydration
Context Export Schema
Core fields used in context export queries:
Optional query fields:
group_by:day,task,trace_typeinclude_feedback: booleanmax_token_count: integer (for summaries)
Export Modes
summary
- Token-optimized export for use in LLM prompts
- Includes trace
type,task_id,timestamp, and compressedcontent
full
- Raw memory trace export (JSON schema)
- Used for persistence, archival, or external analysis
linked
- Recursively collects traces connected via
linked_trace_ids - Useful for reconstructing causal chains
diff
- Computes trace differences between two timepoints or exports
- Used for incremental syncing, audit deltas, or simulation replay
Endpoint Specification
GET /memport/export
Query Parameters:
All responses are returned in JSON format.
Content-Type: application/json
Example Requests & Responses
Example: Export Daily Summary
GET /memport/export?user_id=u001&start_time=2025-05-11T00:00:00Z&end_time=2025-05-11T23:59:00Z&export_format=summary Response:7. FastAPI Implementation Notes
- Use
@router.get("/memport/export")with dependency injection for auth - Validate input with
ExportQueryParamsPydantic model - Internally call
query_traces()and apply formatting logic - For
summary, include token-count-aware compression if needed - Support pagination or
limit/offsetfor long exports - Use
linked_trace_idsto supportlinkedexport mode with trace recursion
Redis Acceleration Layer (Optional)
Chronologue supports Redis-backed export acceleration:
When enabled:
- Exports check Redis cache before querying database
- Summaries are cached for 15–30 minutes by default
- Reduces response time for repeated or overlapping queries
- Use TTLs to prevent memory bloat
- Store Redis as cache, not source of truth
- Clear cache on user-triggered edits or trace updates
Security and Data Handling
- All export endpoints require valid API key (
Authorizationheader) - User-level access: users can only export their own context
- Agents acting on behalf of users must be scoped with correct permissions
- Apply content filtering for sensitive fields (e.g.,
authored_by,chat_url) - Versioned exports can be tagged and checkpointed for reproducibility