Skip to content
Star5

Find your agent's reverted transactions

Your agent ran for a day. Which of its transactions reverted, and why? Each confirm span hashspan records carries the outcome as blockchain.tx.status, so a reverted transaction is one attribute search away.

In the Jaeger UI, pick the agent’s service and type this into Attributes:

blockchain.tx.status=reverted

Every trace in the results has at least one reverted transaction. Open one: the confirm span with the error mark is the reverted one, under the tool call that sent it.

Several agents in one service? Add the agent’s name, separated by a space:

blockchain.tx.status=reverted gen_ai.agent.name=treasury-agent

hashspan puts gen_ai.agent.name on its spans from the tracker’s agent option or from Baggage (agent identity).

The reverted confirm span records, in this example from the local lab:

  • blockchain.tx.status: reverted
  • error.type: reverted
  • blockchain.tx.revert.reason: WithdrawalLimitExceeded(100000000000000000, 1000000000000000000)

The revert reason is decoded by replaying the transaction, so custom errors show their name and arguments when the ABI is known (how).

Jaeger’s API takes the attributes as a JSON object. This returns the traces from the last hour:

Terminal window
curl -sG http://localhost:16686/api/v3/traces \
--data-urlencode 'query.service_name=treasury-agent' \
--data-urlencode "query.start_time_min=$(date -u -v-1H +%Y-%m-%dT%H:%M:%SZ)" \
--data-urlencode "query.start_time_max=$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
--data-urlencode 'query.attributes={"blockchain.tx.status":"reverted"}'

The date -v flag is macOS’s; on Linux use date -u -d '1 hour ago' +%Y-%m-%dT%H:%M:%SZ.

  • blockchain.tx.status=replaced: the agent’s transaction was replaced by another with the same nonce; blockchain.tx.replacement.hash names the one that was mined.
  • error.type=timeout: the wait gave up before a receipt came. No blockchain.tx.status is recorded then, since the outcome on chain is not known.

Every attribute is listed in the attribute reference.