Skip to Content
Timeline Replay

Timeline Replay

Keel provides a public route to reconstruct the full lifecycle of a governed request:

GET /v1/requests/{request_id}/timeline

Authentication: project API key.

The timeline is rebuilt from persisted decision records. It does not invent or interpolate data that was not persisted.

When to use it

  • Compliance investigation — review the exact permit decision, policy match, and budget state at the time of a specific request
  • Cost audit — inspect estimated and actual token/cost figures alongside the permit record
  • Routing debug — confirm which provider and model were selected, whether fallback occurred, and what reason code drove the decision
  • Incident triage — reconstruct an unexpected denial or throttle and identify its cause

Response shape

{ "project_id": "<uuid>", "request_id": "req_demo_001", "permit_ids": ["<permit_uuid>"], "job_ids": [], "session_ids": [], "events": [ { "timestamp": "2026-03-09T01:00:00Z", "event_type": "permit.allowed", "source": "permits", "phase": "permit", "provider": "openai", "model": "gpt-4o-mini", "permit_id": "<permit_uuid>", "request_id": "req_demo_001", "job_id": null, "session_id": null, "metadata": { "decision": "allow", "reason": "allowed" } }, { "timestamp": "2026-03-09T01:00:02Z", "event_type": "routing.selected_model", "source": "execution_events", "phase": "routing", "provider": "openai", "model": "gpt-4o-mini", "permit_id": "<permit_uuid>", "request_id": "req_demo_001", "metadata": { "reason_code": "routing_fitness" } } ] }

Event types

Depending on the request path and execution surface, the timeline may include the following events:

Permit phase

EventWhen it appears
permit.allowedPermit evaluation returned allow
permit.deniedPermit evaluation returned deny
permit.challengedPermit evaluation returned challenge / review required

Firewall phase

EventWhen it appears
firewall.blockedThe prompt firewall blocked the request

Routing phase

EventWhen it appears
routing.selected_modelA provider/model was selected for dispatch
fallback.triggeredThe primary provider/model was unavailable and fallback started
fallback.selected_modelA fallback provider/model was selected

Execution phase

EventWhen it appears
execution.startedKeel began dispatching the provider request
provider.request_sentThe request was sent to the provider
provider.response_receivedThe provider returned a response

Usage and completion phase

EventWhen it appears
usage.recordedFinal usage figures were persisted
request.completedThe request completed successfully
request.deniedThe request was denied (execution surface)
request.erroredThe request encountered a provider or execution error

Async job events (when the request was submitted as an async job)

EventWhen it appears
job.submittedJob was submitted
job.queuedJob entered the queue
job.processingJob began processing
job.completedJob completed successfully
job.failedJob failed
webhook.delivery_attemptedWebhook delivery was attempted
webhook.delivery_succeededWebhook delivered successfully
webhook.delivery_failedWebhook delivery failed

Realtime session events (when scaffolding was written for a realtime session)

EventWhen it appears
session.startedSession opened
session.endedSession closed normally
session.failedSession closed with an error

Limits

  • Timelines are reconstructed from persisted data only. No synthetic latency or duration values are added.
  • Successful prompt-firewall inspections do not appear as explicit timeline events — only firewall.blocked events are emitted.
  • Not every request path produces the full event set. Permit-first flows produce fewer events than Keel-managed execution routes, because Keel does not observe the provider call.
  • When a provider does not return final usage for a stream, the timeline may show estimated or lower-bound usage rather than exact final figures.

Relationship to the permit record

The permit is the anchor record. Timeline events add chronological context but do not replace or modify the permit’s decision, reason code, constraints, or budget snapshot.

To fetch the raw permit record without the full timeline:

GET /v1/permits/{permit_id}

To export a project audit bundle over a time window:

GET /v1/permits/export
Last updated on Edit this page on GitHub