Skip to main content

Reverie adapter for the OpenAI Agents SDK — captures tracing spans as CognitiveEvents

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

reverie_adapter_openai-0.1.0-py3-none-any.whl (19.3 kB view details)

Uploaded Python 3

File details

Details for the file reverie_adapter_openai-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for reverie_adapter_openai-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1beeefd8513f2149998143a79137b6fa1ff7d0944b4b0bacf33b498cf176fb0c
MD5 019bfc5336aa7932e5820247d640f159
BLAKE2b-256 44f8582a3a396f892e8ae34f03f04906fcde08c2a494a6605ec84d331e5bc020

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page