Skip to main content

TraceCraft

CI Coverage PyPI version Python 3.11+ License: Apache-2.0

Vendor-neutral LLM observability — instrument once, observe anywhere.

TraceCraft is a Python observability SDK with a built-in Terminal UI (TUI) that lets you visually explore, debug, and analyze agent traces right in your terminal — no browser, no cloud dashboard, no waiting.


The fastest path: zero code changes

If your app already uses OpenAI, Anthropic, LangChain, LlamaIndex, or any OpenTelemetry-compatible framework, TraceCraft can observe it without touching a single line of application code.

Step 1 — Install and set one environment variable:

pip install "tracecraft[receiver,tui]"

export OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318

Step 2 — Start the receiver and TUI together:

tracecraft serve --tui

Step 3 — Run your existing app unchanged:

python your_app.py

Traces from any OTLP-compatible framework (OpenLLMetry, LangChain, LlamaIndex, DSPy, or any standard OpenTelemetry SDK) stream live into the TUI the moment they arrive. No init() call. No decorators. No code changes.


TraceCraft TUI - Main View

All your agent runs at a glance — name, duration, token usage, and status.

TraceCraft TUI - Waterfall and Detail View

Hierarchical waterfall view with timing bars. See exactly where your agent spends its time. Navigate to any LLM step and press i for the prompt, o for the response, or a for attributes.


Path 2 — Config file + one line

When you want a persistent local setup — custom service name, JSONL export, PII redaction — drop a config file into your project and add one line to your app:

.tracecraft/config.yaml:

# .tracecraft/config.yaml
default:
  exporters:
    receiver: true         # stream to tracecraft serve --tui
  instrumentation:
    auto_instrument: true  # patches OpenAI, Anthropic, LangChain, LlamaIndex

Your app:

import tracecraft

tracecraft.init()  # reads .tracecraft/config.yaml automatically

Then start the TUI:

tracecraft serve --tui

Or, if you prefer to write traces to a file and open the TUI separately:

tracecraft tui

Note: Call tracecraft.init() before importing any LLM SDK. TraceCraft patches SDKs at import time — importing first means the patch won't apply.


SDK decorators

For fine-grained control — custom span names, explicit inputs/outputs, structured step hierarchies — TraceCraft provides @trace_agent, @trace_tool, @trace_llm, and @trace_retrieval decorators, plus a step() context manager for inline instrumentation. See the SDK Guide for details.


TUI Keyboard Shortcuts

Key Action
↑ / ↓ Navigate traces
Enter Expand trace — shows waterfall
i View input/prompt
o View output/response
a View attributes and metadata
/ Filter traces
Tab Cycle view modes
m + C Mark and compare two traces
p Open playground
q Quit

Why TraceCraft?

Feature TraceCraft LangSmith Langfuse Phoenix
Terminal UI Yes — built-in No No No
Zero-Code Instrumentation Yes No No No
Vendor Lock-in None LangChain Langfuse Arize
Local Development Full offline Cloud required Self-host Self-host
OpenTelemetry Native Built on OTel Proprietary Proprietary OTel compatible
PII Redaction SDK-level Backend only Backend only Backend only
Cost Free & Open Source Paid tiers Paid tiers Paid tiers

Features

  • Built-in Terminal UI: Explore, filter, compare, and debug traces without leaving your terminal
  • Local-First: All traces stay on your machine — the TUI is fully offline
  • Zero-Code OTLP Receiver: Set one env var, run tracecraft serve --tui, observe any OTLP app
  • Auto-Instrumentation: Two lines capture all OpenAI, Anthropic, LangChain, and LlamaIndex calls automatically
  • Decorators: @trace_agent, @trace_tool, @trace_llm, @trace_retrieval for custom tracing
  • Dual-Dialect Schema: OTel GenAI and OpenInference conventions
  • PII Redaction: Client-side redaction before data ever leaves your app
  • Export Anywhere: Console, JSONL, SQLite, OTLP, MLflow, HTML reports

Installation

# OTLP receiver + TUI (zero code changes path)
pip install "tracecraft[receiver,tui]"

# TUI + auto-instrumentation
pip install "tracecraft[auto,tui]"

# With specific frameworks
pip install "tracecraft[langchain,tui]"
pip install "tracecraft[llamaindex,tui]"

# All features
pip install "tracecraft[all]"

Or with uv:

uv add "tracecraft[auto,tui]"

Framework Support

Framework Status Installation
OpenAI Stable (auto) tracecraft[auto]
Anthropic Stable (auto) tracecraft[auto]
LangChain Beta tracecraft[langchain]
LlamaIndex Beta tracecraft[llamaindex]
PydanticAI Beta tracecraft[pydantic-ai]
Claude SDK Beta tracecraft[claude-sdk]
Custom Code Stable Base package

Configuration

import tracecraft

tracecraft.init(
    service_name="my-agent-service",
    jsonl=True,              # Enable JSONL output for the TUI
    console=True,            # Pretty-print to console
    auto_instrument=True,    # Auto-capture OpenAI/Anthropic calls
    enable_pii_redaction=True,
    sampling_rate=1.0,
)

Environment variables:

export TRACECRAFT_SERVICE_NAME=my-service
export TRACECRAFT_ENVIRONMENT=production
export TRACECRAFT_SAMPLING_RATE=0.1
export TRACECRAFT_OTLP_ENDPOINT=http://localhost:4317

Export to Any Backend

from tracecraft.exporters import OTLPExporter

tracecraft.init(
    jsonl=True,  # Keep local TUI access
    exporters=[
        OTLPExporter(endpoint="http://localhost:4317"),  # Jaeger, Grafana, etc.
    ],
)

Supported backends: Langfuse, Datadog, Phoenix (Arize), Jaeger, Grafana Tempo, Honeycomb, any OTLP system.


Documentation


Contributing

We welcome contributions! See CONTRIBUTING.md for guidelines.

Development Setup

git clone https://github.com/LocalAI/tracecraft.git
cd tracecraft
uv sync --all-extras
uv run pre-commit install
uv run pytest

Security

See SECURITY.md for security concerns.

License

Apache-2.0 — See LICENSE for details.


Made with care by the TraceCraft Contributors

Metadata

Release files for tracecraft 0.2.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 tracecraft 0.2.1
File Size Uploaded
tracecraft-0.2.1.tar.gz 577.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tracecraft 0.2.1
File Interpreter ABI Platform
tracecraft-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 879.1 kB

Release files / tracecraft-0.2.1.tar.gz

Download URL tracecraft-0.2.1.tar.gz
Size 577.6 kB
Tags Source
SHA-256 checksum
How to use checksums
ff0fe36fab702b9d66eb5a583bb747be941e733623a0d470c9e14b982241f631
BLAKE2b-256 checksum
How to use checksums
d2fe1764f854c501e888955cb6b8ac477042a32b33ac38d2995b86d2458514cb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 2, 2026.

Transparency log

Release files / tracecraft-0.2.1-py3-none-any.whl

Download URL tracecraft-0.2.1-py3-none-any.whl
Size 301.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
06298e2b6b4297520821d22c177f10b26b0ce6facf1798c61159702e5dfdcf5d
BLAKE2b-256 checksum
How to use checksums
19827b4b69d0eea865b16ee23076649012cb0abc788dae010bcfd495ed9dc75d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 2, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2.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