This page walks you through installing AgentDbg, adding tracing to an agent function, running it, and opening the timeline viewer. You don’t need any API keys, cloud accounts, or configuration files to complete these steps.Documentation Index
Fetch the complete documentation index at: https://refinehq.ai/docs/llms.txt
Use this file to discover all available pages before exploring further.
Install AgentDbg
AgentDbg requires Python 3.10 or later. Install it from PyPI:That’s the only dependency you need to get started. No sign-up required.
Instrument your agent
Add The
@trace to your agent’s entry-point function, then call record_tool_call and record_llm_call inside it to record individual events. Here’s a minimal example:@trace decorator automatically records the run start and end, captures any unhandled exception as an error event, and writes everything to ~/.agentdbg/runs/ when the function returns.Run your agent
Run your script as you normally would:When the run completes, AgentDbg writes two files under
~/.agentdbg/runs/<run_id>/:run.json— run metadata (status, counts, timing)events.jsonl— the full structured event stream
Open the timeline
Open the browser-based timeline viewer:A browser tab opens at
http://127.0.0.1:8712 showing the latest run. You’ll see:- Run summary panel — status (ok / error / running), duration, LLM call count, tool call count, error count, and loop warnings
- Chronological event list — every recorded event in order
- Expandable events — click any event to inspect its prompt, response, args, result, token usage, or error details
- Filter chips — narrow the view to All, LLM, Tools, Errors, State, or Loops
What the UI shows after a run
After openingagentdbg view, the timeline for the example above would show:
- A RUN_START event with the run name and timestamp
- A TOOL_CALL event for
search_dbwith the args and result expanded - An LLM_CALL event for
gpt-4with the prompt, response, and token usage - A RUN_END event with status
okand total duration
@trace decorator catches it, records an ERROR event with the exception type, message, and stack trace, then records RUN_END with status=error before re-raising. You can jump directly to the first error using the button in the run summary panel.
Next steps
SDK: Tracing
Learn the full
@trace and traced_run API, including how to name runs and handle context.LangChain integration
Auto-record LLM and tool events from LangChain and LangGraph agents with a callback handler.
Guardrails
Stop runaway agents by setting limits on LLM calls, tool calls, events, and run duration.