about

Agents are starting to move money. Their traces should show where it went.

hashspan is an open-source TypeScript library that records every on-chain transaction an AI agent sends as OpenTelemetry spans, inside the agent's own trace. This page explains why it exists and how it is built.

The gap

Agent tracing tools show the model call and the tool call. When that tool sends a transaction, the trace usually ends there. Whether it was mined, reverted or replaced, and what it cost, lives in a block explorer or a separate monitoring product, away from the decision that caused it.

With protocols like x402 and wallet APIs built for agents, more tool calls now move real value. Debugging them shouldn't mean copying a hash between tabs.

The approach

hashspan keys everything to the transaction hash and emits standard OpenTelemetry spans, a send span and a confirm span (a payment span for an x402 payment), nested under the tool that made it. Your existing tracing backend becomes the UI.

Principles

01

No new dashboard

Standard OpenTelemetry spans. Jaeger, Grafana Tempo, Langfuse, Honeycomb or any OTLP backend is the UI.

02

Keyed by the hash

The transaction hash is the join key between the agent trace and the chain.

03

You choose what is recorded

Calldata arguments and error messages are opt-in. Addresses are recorded by default and can be hashed or dropped.

04

Never in the way

It never signs or broadcasts, and telemetry stays off the call path.

05

Small footprint

The core has one peer dependency, @opentelemetry/api. Adapters add the library they instrument, plus viem to read the chain.

06

Standards-minded

Span and attribute names are a public draft, aiming at a proposal to OpenTelemetry.

Built in the open

Every design decision is written down as an architecture decision record. The span and attribute names are a public draft, with a proposal to OpenTelemetry on the roadmap. Packages are published with npm provenance.

Maintainer

Selim Aytaç on GitHub
Selim AytaçMaintains hashspan. Writes about OpenTelemetry, agentic payments and on-chain transaction internals.GitHubX

hashspan is open to contributors. If you trace agents that send transactions, feedback on the span schema is the most valuable contribution right now.

Type to search the docs, Learn topics and the blog.