PtcRunner.SubAgent.Debug (PtcRunner v0.4.1)

View Source

Debug helpers for visualizing SubAgent execution.

Provides functions to pretty-print execution traces and agent chains, making it easier to understand what happened during agent execution.

Debug Option

Enable debug mode via the :debug option on SubAgent.run/2:

{:ok, step} = SubAgent.run(agent, llm: llm, debug: true)

When debug mode is enabled, trace entries store the exact message contents:

  • llm_response - The assistant message (LLM output, stored as-is)
  • llm_feedback - The user message (execution feedback, after truncation)

These are exactly what's in the messages array sent to the LLM. Use print_trace(step, messages: true) to view this data.

Trace Option

Control trace collection via the :trace option:

ValueBehavior
true (default)Always collect trace
falseNever collect trace
:on_errorOnly include trace on failure

Examples

# Default compact view
{:ok, step} = SubAgent.run(agent, llm: llm, debug: true)
SubAgent.Debug.print_trace(step)

# Show full LLM messages (requires debug: true)
SubAgent.Debug.print_trace(step, messages: true)

# Print agent chain
SubAgent.Debug.print_chain([step1, step2, step3])

Summary

Functions

Pretty-print a chain of SubAgent executions.

Pretty-print a SubAgent execution trace.

Functions