opsen
opsen

Events and logs

What happened, in a form something else can read.

Events

opsen.events(since=1788800000.0)

Session started, terminated, budget refused, reaper reclaimed. Poll from a timestamp; the stream is ordered.

Structured logs

One JSON object per line, with the session and task id on every record that has one — so a log line can be joined to a cost without correlating by hand.

{"ts": 1788817366.4, "level": "info", "event": "session.started",
 "session_id": "sess_...", "task_id": "invoice-extract"}

Redaction

Keys and tokens are redacted before a record is written, not after. A log that has to be scrubbed later is a log that was already written somewhere.

Sessions that went wrong

opsen.stuck_sessions()

Running a long time with little to show — the shape of an agent that hung rather than finished. Worth checking before an invoice tells you.