TraceRazor hooks adapter for the OpenAI Agents SDK
Project description
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.
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tracerazor_openai_agents-0.1.0.tar.gz.
File metadata
- Download URL: tracerazor_openai_agents-0.1.0.tar.gz
- Upload date:
- Size: 8.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
250c556b86af29c0551a9432ebaab60725f4468c2a3da633fd204f7ab5b61d87
|
|
| MD5 |
238fd4ddaaaee8f9f9e78f1011705807
|
|
| BLAKE2b-256 |
0b91562a5b7a2e4af9fae989f0f31d8e5bf3e4fbd752a5734798cdf92d10091e
|
File details
Details for the file tracerazor_openai_agents-0.1.0-py3-none-any.whl.
File metadata
- Download URL: tracerazor_openai_agents-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
996c2c2899d1a8be88bafcff30337f6d79fb5d4539bcc81d7304f7f5b08087db
|
|
| MD5 |
da8b0a858c708c60cd2074ab29137692
|
|
| BLAKE2b-256 |
0a6373ab36b2dea935abed1aa8c43758f41127ebcefa1704e176ce01a8b63af8
|