Skip to main content

How do you make agent runs reproducible enough to debug, when the model is not deterministic and the tools return live data that changes?

Agents and tools · Pro 2

Short answer

Record everything the run depended on: the exact prompts, the model and prompt versions, the settings, and every tool call with its full result. To debug, replay the run with the recorded tool results in place of live calls, stop at the suspect step, and rerun that step many times to see how often it goes wrong.

Deeper answer

You cannot rerun the past, because the order has shipped and the stock level is different now. What you can do is rebuild the exact context the model saw at each step. That requires the trace to store full tool inputs and outputs, not only names and timings, and the versions of the system prompt, tool definitions and model. With that, a replay harness feeds recorded results back, and the run follows the same path up to the step you care about.

The model still varies, so one replay proves little. Rerun the failing step 20 times from the same context. If it fails 18 times, the context is the problem: missing or misleading information. If it fails twice, it is a rare error, and you need a check after that step more than a prompt change. The trade-off is storage and privacy: full payloads may contain personal data, so they need redaction, access control and a retention limit. Interviewers listen for recorded tool results and repeated trials.

What a strong answer covers

Answer it out loud in the mock interview about 2 min

Follow-ups to expect

Common mistakes

Learn it

Logs and traces for agents

Practice Agents and tools questions

More on this topic

Today's AI turns are used

Lessons, roadmaps, videos, practice cards and the code playground stay free with your account, with no limit.