Trail every OpenAI call
One wrapper on your OpenAI client, and every chat completion your system makes becomes a signed, append-only loop event. No proxy in your request path, no gateway to operate, no call sites to change.
pip install looptail # openai SDK stays yours, any versionimport openai
import looptail
from looptail import instrument
looptail.init(app="checkout-assistant")
client = instrument.openai(openai.OpenAI())
# chat.completions.create and responses.create are now recorded
response = client.chat.completions.create(
model="your-model",
messages=[{"role": "user", "content": "Where is my order?"}],
)What gets recorded
Each call appends one observe event to the app's trail file: provider and API, model id, truncated input and output previews, prompt_tokens /completion_tokens from the usage object, the finish reason, and duration. Exceptions are recorded and re-raised — your error handling is untouched. Records are hash-chained and Ed25519-signed at write time, so the file is tamper-evident: anyone can verify it without trusting you.
npx @looptail/cli verify --app checkout-assistant
✔ 8,341 loop events
✔ chain intact · signatures valid- 14:03:12observesupport-agent · ticket #4211 answered · outcome pendingsig 9f3a…c2 ✓
- 14:03:14evaluaterubric refund-policy-v3 scored 0.94 · passsig 41bc…88 ✓
- 14:07:02issuecluster #18 "partial refunds mis-quoted" +1 casesig 77e0…4d ✓
- 14:21:40improvepatch #91 proposed · prompt diff +12 −4 · replay 132/132 passsig b8d1…09 ✓
- 14:29:05approvepatch #91 approved → canary 5%sig e42f…7a ✓
From logs to evidence
Observability tools will happily show you these calls on a dashboard. What they don't give you is a record that stands up later — when a customer disputes what the assistant said, when a security review asks how changes are controlled, when theEU AI Act asks for automatic lifetime logging. The trail is that record: complete per decision, linked to theevaluations and changes that follow, and exportable as adated, self-verifying evidence pack. Local-first — no account needed until you want hosted sync and signed receipts.