Response Structure
Chronologue uses a standardized response envelope for all API interactions. This design ensures consistency across endpoints, simplifies client handling, and enables integration with language model agents. Each response includes clearly defined fields for success, error, traceability, and metadata.
Additionally, Chronologue supports LLM-aware responses for token-efficient summaries and function-call interoperability, including OpenAI-compatible formats.
1. Why It Matters
A consistent response schema allows:
- Developers to reliably parse success and failure outcomes
- LLMs to consume context-aware memory or planning responses
- API clients to trace, audit, and retry requests with a known
trace_id
- Calendar integrations to generate
.ics
files with structuredsummary
anddescription
content
2. Core Response Envelope
All Chronologue responses use the following format:
Field | Type | Description |
---|---|---|
status | string | "success" or "error" |
data | object/array | Main payload if the request succeeded |
error | string | Error name/code (if status = error) |
detail | string | Human-readable explanation of error |
trace_id | string | Unique request ID for auditing/debugging |
meta | object | Optional: timing, token usage, version, model info |
3. Success Response Format
Returned when a request completes successfully.
Example:
4. Error Response Format
Returned when validation, authentication, or internal logic fails.
Example:
5. LLM-Aware Responses
To support LLM function calls and prompt injection, Chronologue formats summary
and description
fields using OpenAI-compatible language:
Field | Description |
---|---|
summary | Short, token-efficient title derived from content or task label |
description | Rich context block including content , chat_url , agent/source note |
These fields are generated using either:
- Rule-based logic
- OpenAI function call (e.g.,
summarize_trace
,describe_event
) - User-editable overrides via interface or patch request
Example for .ics
generation:
SUMMARY:Deep Work Block
DESCRIPTION:Wrote CUDA kernels from 9–11am.
Chat log: https://chat.openai.com/share/example-id
6. Example Endpoint Responses
Memory Pull
GET /memory/pull
Function Call (via LLM or client)
POST /functions/call
Response:
7. Traceability and Logging
All responses include a trace_id
field which can be logged by:
- Frontend clients (for debugging or support)
- Backend logs (FastAPI logger)
- Audit trails in MemPort
Use trace_id
to correlate between agent outputs, feedback loops, and execution latency.
8. Future Enhancements
warnings[]
: for soft schema mismatches, unsafe tempo tokensstream: true
: for SSE or WebSocket responses from agentsactions[]
: suggested next functions or trace-level promptscached: true|false
: mark responses from Redis or MemPort cache
9. Best Practices
- Always parse
status
before accessingdata
- Log
trace_id
on both success and error - Use
summary
for.ics
calendar event titles - Use
description
for rich trace exports or downstream LLM use - Keep all time fields in UTC ISO format