reverie-adapter-openai
Zero-config Reverie instrumentation for the OpenAI Agents SDK.
Use
import reverie_openai
reverie_openai.auto()
# ... your normal Agents SDK code below ...
from agents import Agent, Runner
agent = Agent(name="my-agent", instructions="...")
result = await Runner.run(agent, "Do the thing.")
That's it. Every span produced by the SDK is translated into a Reverie
CognitiveEvent and posted to the backend (default http://127.0.0.1:8000).
What you get
| SDK span type | CognitiveEvent on start | CognitiveEvent on end |
|---|---|---|
agent |
goal.created |
goal.completed / goal.failed |
function |
tool.called |
tool.returned / tool.failed |
handoff |
subagent.spawned |
subagent.completed |
generation |
— | reasoning.extracted |
response |
— | reasoning.extracted |
guardrail |
— | validation.passed / validation.failed |
| Other types | (wrapped in GenericPayload for forward-compat) |
The full event tree (parentId + depth) is preserved.
Resilience
- Events are posted in batches of up to 50 every ~100ms.
- The emitter runs in a daemon thread with its own asyncio loop — the agent is never blocked.
- If the backend is unreachable, events are dropped silently. The agent always runs to completion.
- A bounded queue (10k events default) protects against memory blow-up.
Configuration
All optional, set as env vars before reverie_openai.auto():
| Var | Default | Description |
|---|---|---|
REVERIE_BACKEND_URL |
http://127.0.0.1:8000 |
Backend base URL |
REVERIE_AGENT_ID |
openai-agent |
Default agent id label |
REVERIE_QUEUE_SIZE |
10000 |
Max queued events |
REVERIE_BATCH_SIZE |
50 |
Max events per POST |
REVERIE_FLUSH_MS |
100 |
Max wait between flushes |
REVERIE_DISABLED |
(unset) | If set to 1, the adapter does nothing |
Install
uv pip install -e ".[dev]"
pytest
Release files for reverie-adapter-openai 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| reverie_adapter_openai-0.1.0.tar.gz | 25.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| reverie_adapter_openai-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 44.7 kB
Release files / reverie_adapter_openai-0.1.0.tar.gz
| Download URL | reverie_adapter_openai-0.1.0.tar.gz |
|---|---|
| Size | 25.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e24b971ee7f720329229add2a5040d83b16e4691151f8243c4d4ae0a2980e375
|
|
BLAKE2b-256 checksum How to use checksums |
425b06043f546f1acd679a2519dcaa8772f373db338c478675e45b3003a8a1cf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Release files / reverie_adapter_openai-0.1.0-py3-none-any.whl
| Download URL | reverie_adapter_openai-0.1.0-py3-none-any.whl |
|---|---|
| Size | 19.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1beeefd8513f2149998143a79137b6fa1ff7d0944b4b0bacf33b498cf176fb0c
|
|
BLAKE2b-256 checksum How to use checksums |
44f8582a3a396f892e8ae34f03f04906fcde08c2a494a6605ec84d331e5bc020
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|