Skip to main content

agentobs-debug

Developer tools for inspecting, replaying, and visualising AgentOBS traces.

Installation

pip install agentobs-debug

Requires Python ≥ 3.10 and agentobs >= 1.0.5.


Quickstart — Programmatic API

import agentobs_debug as aod

# Load events from a JSONL file
stream = aod.load_events("events.jsonl")
trace  = "4bf92f3577b34da6a3ce929d0e0e4736"

aod.replay(trace, stream=stream)          # step-by-step replay
aod.inspect_trace(trace, stream=stream)   # trace summary
aod.print_trace_tree(trace, stream=stream) # span hierarchy
aod.timeline(trace, stream=stream)        # execution timeline

aod.show_tools(trace, stream=stream)      # tool calls
aod.show_decisions(trace, stream=stream)  # decision points
aod.cost_summary(trace, stream=stream)    # token usage + cost
aod.cost_attribution(trace, stream=stream) # per-step cost/latency table

# Multi-trace
from agentobs_debug.report import batch_report
from agentobs_debug.diff import diff_traces

batch_report("events.jsonl")               # summarise all traces in a file
diff_traces(trace_a, trace_b, stream=stream)  # compare two traces

Quickstart — CLI

# Replay an agent run step-by-step
agentobs-debug replay events.jsonl --trace 4bf92f3577b34da6

# Print a trace summary
agentobs-debug inspect events.jsonl --trace 4bf92f3577b34da6

# Print the span hierarchy tree
agentobs-debug tree events.jsonl --trace 4bf92f3577b34da6

# Print the execution timeline
agentobs-debug timeline events.jsonl --trace 4bf92f3577b34da6

# List all tool calls
agentobs-debug tools events.jsonl --trace 4bf92f3577b34da6

# List all decision points
agentobs-debug decisions events.jsonl --trace 4bf92f3577b34da6

# Print cost summary
agentobs-debug cost events.jsonl --trace 4bf92f3577b34da6

# Per-step cost/latency breakdown with percentiles
agentobs-debug attribution events.jsonl --trace 4bf92f3577b34da6

# Batch summary across all traces in a file
agentobs-debug report events.jsonl

# Diff two traces
agentobs-debug diff events.jsonl --trace-a 4bf92f3577b34da6a3ce929d0e0e4736 --trace-b aaaa0000000000000000000000000001

Public API

load_events(path: str) -> EventStream

Load events from a JSONL file using the AgentOBS SDK.

  • Raises CorruptEventError if the file is missing or malformed.

replay(trace_id: str, stream: EventStream) -> None

Print a step-by-step replay of an agent run.

Example output:

Agent Run: research_agent
Trace: 4bf92f3577b34da6

Step 0 — search
Model: gpt-4o
Tokens: 530
Duration: 330 ms

inspect_trace(trace_id: str, stream: EventStream) -> None

Print an aggregated summary of a trace.

Example output:

Trace Summary
-------------
Trace ID: 4bf92f3577b34da6
Spans: 2
Tokens: 740
Cost: $0.0030
Duration: 1.1s
Status: ok

print_trace_tree(trace_id: str, stream: EventStream) -> None

Print the span hierarchy using box-drawing characters.

Example output:

agent_run research_agent
 ├── step search
 │    └── span chat:gpt-4o
 └── step summarize
      └── span chat:gpt-4o

timeline(trace_id: str, stream: EventStream) -> None

Print the execution timeline with millisecond offsets.

Example output:

0 ms      agent_run started
120 ms    step search started
450 ms    step search completed
700 ms    step summarize started
900 ms    step summarize completed
1100 ms   agent_run completed

show_tools(trace_id: str, stream: EventStream) -> None

Print all tool calls recorded in a trace.

Example output:

Tool Calls
----------
search_api(query="LLM observability")
web_fetch(url="example.com")

show_decisions(trace_id: str, stream: EventStream) -> None

Print all decision points recorded in a trace.

Example output:

Decision: tool_selection
Options: search_api, knowledge_base
Chosen: search_api

cost_summary(trace_id: str, stream: EventStream) -> None

Print aggregated token usage and cost for a trace.

Example output:

Cost Summary
------------
Input tokens: 570
Output tokens: 170
Total cost: $0.0030

cost_attribution(trace_id: str, stream: EventStream, output_format: str = "text") -> None

Print a per-step cost and latency breakdown table with p50/p90/p99 duration percentiles.

Import: from agentobs_debug.attribution import cost_attribution

batch_report(path: str, trace_ids: list[str] | None = None, output_format: str = "text") -> None

Run inspect_trace() for every trace (or a given subset) in a JSONL file and print a summary table. Does not require a pre-loaded stream.

Import: from agentobs_debug.report import batch_report

diff_traces(trace_id_a: str, trace_id_b: str, stream: EventStream, output_format: str = "text") -> None

Compare two traces side by side: spans, tokens, cost, duration, status, and per-step breakdown.

Import: from agentobs_debug.diff import diff_traces


Error Handling

All errors are typed exceptions that subclass AgentOBSDebugError:

Exception Raised when
CorruptEventError JSONL file missing or malformed
TraceNotFoundError trace_id not found in stream
InvalidSpanHierarchyError Reserved for future use

In the CLI, all exceptions are caught and printed as Error: <message> to stderr with exit code 1. Python tracebacks are never shown.


API Reference

See docs/api-reference.md for the full reference: all function signatures, parameters, output formats, exception hierarchy, and complete CLI flag documentation.


Dependencies

  • agentobs >= 1.0.5 — AgentOBS SDK (provides EventStream, event types)
  • Python ≥ 3.10

Metadata

Release files for agentobs-debug 1.0.1

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

Source distribution (sdist)

Source distribution for agentobs-debug 1.0.1
File Size Uploaded Provenance
agentobs_debug-1.0.1.tar.gz 2.5 MB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for agentobs-debug 1.0.1
File Interpreter ABI Platform
agentobs_debug-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 2.5 MB

Release files / agentobs_debug-1.0.1.tar.gz

Download URL agentobs_debug-1.0.1.tar.gz
Size 2.5 MB
Tags Source
SHA-256 checksum
How to use checksums
7d7abb3fa78e1136bd04e2205a2f7321c9f91ba7ba5414fba7dc072cbc30a4c2
BLAKE2b-256 checksum
How to use checksums
81c8fabc7707b3d642e4cf76a9d8a0f795d01c15652fc3b25cf4b24d21cc605a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.9

Release files / agentobs_debug-1.0.1-py3-none-any.whl

Download URL agentobs_debug-1.0.1-py3-none-any.whl
Size 28.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2ef29eb393b9ae473bc670bbc99d92e635f79476452f9a22ed34d6630886f548
BLAKE2b-256 checksum
How to use checksums
bb762eabc037beafff54a23b242fd44b970e908ac3cfb37535074107c4b7b967
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.9

Security for agentobs-debug 1.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files No provenance

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