Skip to content
Star3

Introduction

hashspan is an open-source TypeScript library that turns each transaction an AI agent sends into OpenTelemetry spans, keyed by the transaction hash, inside the agent’s own trace.

Jaeger showing a reverted confirm 31337 span inside an agent trace, with blockchain.tx.status, the fee, gas used and the decoded revert reason WithdrawalLimitExceeded
An agent’s reverted transaction, as a confirm span in its own trace (Jaeger, from the local lab).
  • A send {chainId} span when the hash comes back, and a linked confirm {chainId} span when the receipt arrives.
  • Status (success, reverted, replaced; a wait that gives up ends with error.type timeout), block, gas used and the fee, including the L1 data fee on OP-stack chains.
  • The decoded revert reason for mined reverts.
  • For x402, a payment {chainId} span per paid request: what was paid, to whom and whether it settled. With a reader, a linked confirm span adds block, gas and fees of the settling transaction.
  • The agent’s identity (gen_ai.agent.id, gen_ai.agent.name) on every transaction span.

The spans nest under whatever span is active when the transaction is sent, usually your agent framework’s execute_tool span. They go to the tracing backend you already use: Jaeger, Grafana Tempo, Langfuse, Honeycomb or any OTLP endpoint.

Package Use it for
@hashspan/viem Agents that send with viem wallet clients
@hashspan/cdp Agents that send with Coinbase CDP server accounts
@hashspan/x402 Agents that pay for API calls with x402
@hashspan/core Any other send path; the tracker every adapter uses

hashspan never signs or broadcasts transactions, and it doesn’t alert. It records what happened so you can read it next to the agent’s decisions.