Skip to main content

tracerazor-openai-agents

OpenAI Agents SDK hooks adapter for TraceRazor.

Automatically captures every LLM call, tool execution, and agent handoff from a Runner.run() invocation — zero manual instrumentation required.

v0.2.0 — New Metrics:

  • ✨ Semantic Continuity (CSD) — Detects when your agent's reasoning drifts topic mid-execution
  • ✨ Adherence Scoring (IAR) — After optimizing, validates that fixes actually improved metrics

Install

pip install tracerazor-openai-agents
pip install tracerazor-openai-agents[agents]  # includes openai-agents

Requires the tracerazor binary:

cargo build --release
export TRACERAZOR_BIN=/path/to/TraceRazor/target/release/tracerazor

Usage

from tracerazor_openai_agents import TraceRazorHooks
from agents import Agent, Runner

hooks = TraceRazorHooks(
    agent_name="support-agent",
    threshold=70,
)

result = await Runner.run(
    agent,
    "I need a refund for order ORD-9182",
    hooks=hooks,
)

# After the run:
report = hooks.analyse()
print(report.markdown())

# CI/CD gate — raises AssertionError if TAS < threshold:
hooks.assert_passes()

API

TraceRazorHooks(agent_name, framework, threshold, task_value_score, tracerazor_bin)

param default description
agent_name "openai-agent" shown in all reports
framework "openai-agents" framework label
threshold 70.0 minimum TAS for assert_passes()
task_value_score 1.0 answer quality (0–1)
tracerazor_bin auto path to binary; falls back to TRACERAZOR_BIN env var

hooks.analyse() → TraceRazorReport

Finalise and submit the trace. Returns the report.

hooks.assert_passes()

Raise AssertionError if TAS < threshold.

hooks.set_task_value_score(score: float)

Update quality score before calling analyse().

Captured events

SDK hook TraceRazor step type
on_agent_end reasoning (agent output)
on_tool_start / on_tool_end tool_call (success)
on_handoff reasoning (handoff marker)

Multi-agent traces

When your workflow uses multiple agents via handoffs, TraceRazor automatically produces a per-agent breakdown alongside the composite score:

MULTI-AGENT BREAKDOWN
Agent                    Steps   Tokens   Share      TAS  Grade
TriageAgent                  4    1,200   28.6%     82.5  GOOD
SupportAgent                 7    2,600   61.9%     61.2  FAIR
EscalationAgent              2      400    9.5%      N/A  N/A

The composite TAS is weighted by each agent's token consumption.

See Multi-Agent Guide for detailed workflow examples with cost analysis and optimization validation.

Metadata

Release files for tracerazor-openai-agents 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tracerazor-openai-agents 1.0.0
File Size Uploaded
tracerazor_openai_agents-1.0.0.tar.gz 8.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tracerazor-openai-agents 1.0.0
File Interpreter ABI Platform
tracerazor_openai_agents-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 17.4 kB

Release files / tracerazor_openai_agents-1.0.0.tar.gz

Download URL tracerazor_openai_agents-1.0.0.tar.gz
Size 8.9 kB
Tags Source
SHA-256 checksum
How to use checksums
baec210434d13c7e63a0febd8ed12508420d672b54012fd365d2f88fb9e229d8
BLAKE2b-256 checksum
How to use checksums
16f1c7c52845d86715c36676eeae997b3ead573ace27555d8951a544149877af
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.6

Release files / tracerazor_openai_agents-1.0.0-py3-none-any.whl

Download URL tracerazor_openai_agents-1.0.0-py3-none-any.whl
Size 8.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9268efd258d91716026554f546c2354a350a8c12a3f07678a4ee9c2c606ea3e7
BLAKE2b-256 checksum
How to use checksums
aef7cc58bfd394890bbe0974c5b303964519374e29d3470f6a7a0e35a02633dd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.6

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page