Trace a Bitcoin Agent Request End to End
Trace a Bitcoin Agent Request End to End
Create a correlation timeline across parser, Engine, and AI response. This is part two of the WAB ENGINE and AI Agents programming series, grounded in the V3.4 Testnet experiments.
What the experiment actually showed
A useful trace distinguishes command parsing, Engine call, returned txid, model attempt, fallback decision and HTTP response. In the recorded output request_id was empty, reducing correlation quality.
Engineering method
Use a generated opaque request identifier at ingress, preserve it through logs and any supported Engine idempotency contract, and attach durations to stages. Do not invent or assume Engine headers; verify the deployed contract.
A repeatable local exercise
See Repo/trace.go for a local-only timeline example.
Use a recorded JSON response or a mock HTTP server. Run local unit tests, compare actual values with expected values, and inspect error paths. An AI response must not be used as evidence of a wallet transaction or its confirmation.
What can go wrong
Never log BTC KEY, model API keys, bearer session tokens or raw secret-bearing requests.
Practical review questions
- Which facts came directly from WAB ENGINE, and which are generated prose?
- Can the experiment be repeated without broadcasting another transaction?
- What observation would falsify the diagnosis?
- Which error states are visible to the caller rather than hidden by a fallback?
Implementation boundary
WAB ENGINE remains the authoritative execution layer. The experimental agent is a separate client. Examples are intentionally scoped to Testnet and do not modify the Engine, Bitcoin Core, the signed fee law, or deployed wallet state.
Project references
- WAB ENGINE API: https://thamer.org/api
- WAB ENGINE overview: https://thamer.org/engine
- Educational code repository: https://thamer.org/repo/
Scope: experimental Testnet programming notes and preliminary SDK-style examples, not production-ready wallet software.
