When an agent gives a wrong answer, the first question is always the same: what did it actually do? Which tools did it call, in what order, and where did the time go?
If the only record is the chat transcript, you're guessing. A small trace logger fixes that, and you don't need a vendor to start. The code below is plain Node.js with no dependencies. It runs against a fake agent loop, so you can try it without an API key. I ran it on Node 24 and the assertions pass.
What a trace needs
Three things make a trace useful. Every step of one request shares an ID, so you can pull the whole story with one search. Every step records how long it took and whether it worked. And errors keep their message, because "something failed" isn't a clue.
I'd also log one line per step as JSON. Structured lines are easy to filter now and easy to ship to a real log system later.
Keep the trace ID visible to the user, too.…