There is no Ovelin package to install: the client is one function around requests. Copy it next to your agent and call it wherever the agent acts. The Claude, OpenAI Agents, LangChain and CrewAI guides all build on this file.
Prerequisites
- Python 3.10 or later.
1. Get an API key
- In Ovelin, open Settings → API keys.
- Under Ingest key, create a key and copy it. It is shown once; Ovelin keeps only a hash.
- Copy the Organization ID from the same page.
Put all three values in your environment, not in code:
export OVELIN_URL="https://your-ovelin-host" # http://localhost:3000 for a local instance
export OVELIN_ORG_ID="your-organization-id"
export OVELIN_API_KEY="agl_live_…"An organization key can report for any agent. For production, give each agent its own key under Settings → API keys → Agent keys: a leaked agent key can then only write as that one agent, and you can revoke it alone.
2. Install
pip install requestsThen copy examples/python/ovelin.py into your project:
"""Minimal Ovelin client: one function, plain HTTP, no SDK.
Reads OVELIN_URL, OVELIN_ORG_ID and OVELIN_API_KEY from the environment.
Every guide in docs/integrations imports this file.
"""
from __future__ import annotations
import os
import uuid
from typing import Any
import requests
OVELIN_URL = os.environ.get("OVELIN_URL", "http://localhost:3000").rstrip("/")
OVELIN_ORG_ID = os.environ["OVELIN_ORG_ID"]
OVELIN_API_KEY = os.environ["OVELIN_API_KEY"]
# One id per agent run. Ovelin groups every event with the same
# metadata.run_id into one execution under Sessions.
RUN_ID = os.environ.get("OVELIN_RUN_ID") or f"run-{uuid.uuid4()}"
class OvelinError(RuntimeError):
pass
def log_event(
agent: str,
action: str,
*,
outcome: str = "success",
actor: str | None = None,
data_accessed: list[str] | None = None,
metadata: dict[str, Any] | None = None,
source: str = "custom",
) -> dict[str, Any]:
"""Record one agent action. Returns Ovelin's response: id, seq and hash (the seal)."""
body: dict[str, Any] = {
"source": source,
"agent_name": agent,
"action": action,
"outcome": outcome, # success | failure | unknown
"metadata": {"run_id": RUN_ID, **(metadata or {})},
}
if actor:
body["actor"] = actor
if data_accessed:
body["data_accessed"] = data_accessed
res = requests.post(
f"{OVELIN_URL}/api/ingest/{OVELIN_ORG_ID}",
headers={"Authorization": f"Bearer {OVELIN_API_KEY}"},
json=body,
timeout=10,
)
if res.status_code >= 300:
raise OvelinError(f"Ovelin refused the event: {res.status_code} {res.text}")
return res.json()3. Minimal working example
"""Send one event to Ovelin from Python and print the seal."""
from ovelin import log_event
record = log_event(
"invoice-agent",
"sent_invoice_reminder",
actor="ops@example.com",
data_accessed=["customer_pii", "financial_data"],
metadata={"invoice": "INV-1042"},
)
print(f"sealed as seq {record['seq']}: {record['hash'][:16]}…")4. Run it
cd examples/python
python send_event.py
# sealed as seq 3: 3d9f3ff8f04165be…5. Check it in Ovelin
- Open Activity. The newest rows are the events you just sent, each with a sequence number and a seal.
- Click one. The detail panel shows the payload as received; Recompute seal checks its seal again.
- Open Agents: an agent name Ovelin had not seen before is registered automatically, without an owner. Give it one so someone is accountable for it.
To confirm nothing was altered later, open Integrity. It recomputes every seal and every link between records, and reports Trail intact.
Common errors
| Response | Cause | Fix |
|---|---|---|
401 Invalid API key | The key is wrong, revoked, or belongs to another organization. | Create a key in Settings → API keys and check OVELIN_ORG_ID is the same organization's. |
401 Missing API key (use Authorization: Bearer <key>) | The Authorization header was not sent. | Send Authorization: Bearer $OVELIN_API_KEY. The key never goes in the body. |
422 Payload must include a 'source' field | The JSON has no source. | Add "source": "custom" (or n8n, make_com, openai_api, zapier). |
422 Invalid option: expected one of "success"|"failure"|"unknown" | outcome has another value, such as warning. | Use success, failure or unknown. |
400 Invalid organization id | OVELIN_ORG_ID is not the organization's UUID. | Copy the Organization ID from Settings → API keys. |
429 Rate limit exceeded | More than 600 events a minute for one organization. | Retry after the Retry-After header. To send many events, use the batch endpoint (up to 100 per request). |
KeyError: 'OVELIN_ORG_ID' | The environment is not set in this shell. | export the three variables before running. |
requests.exceptions.ConnectionError | OVELIN_URL is wrong or the host is unreachable. | Check the URL; curl $OVELIN_URL/api/health should answer 200. |
How this guide is tested
Every code block above is copied from examples/python/ by node scripts/sync-guide-snippets.mjs, and pnpm examples:test runs send_event.py against a local Ovelin and checks the events were sealed.

