haive.agents.utils.trace¶

Agent trace pretty-printer using Rich.

Provides clean, readable output for any haive agent run, filtering out the noisy LangGraph checkpoint dumps and showing only meaningful content: messages, tool calls, tool results, and KG extractions.

Usage:

from haive.agents.utils.trace import run_traced, TracePrinter

# Run any agent with pretty trace result = run_traced(agent, “What is 15 * 23?”)

# Save trace to file result = run_traced(agent, “Hello”, save_to=”traces/”)

Classes¶

TracePrinter

Pretty-prints agent execution traces.

Functions¶

run_traced(agent, input_data[, title, save_to])

Run any haive agent with pretty-printed trace output.

Module Contents¶

class haive.agents.utils.trace.TracePrinter(show_tokens=True, max_content_len=500, show_tool_args=True)¶

Pretty-prints agent execution traces.

Parameters:
  • show_tokens (bool)

  • max_content_len (int)

  • show_tool_args (bool)

print_kg_triples(store, user_id='default')¶

Print KG triples from store.

Parameters:
  • store (Any)

  • user_id (str)

Return type:

None

print_result(result, title='Agent Trace')¶

Print a formatted trace from an agent result.

Parameters:
  • result (Any)

  • title (str)

Return type:

None

print_store_summary(store, user_id='default')¶

Print store contents summary.

Parameters:
  • store (Any)

  • user_id (str)

Return type:

None

haive.agents.utils.trace.run_traced(agent, input_data, title=None, save_to=None, **kwargs)¶

Run any haive agent with pretty-printed trace output.

Works with SimpleAgent, ReactAgent, MemoryAgent, MultiAgent, etc.

Parameters:
  • agent (Any) – Any haive agent

  • input_data (str | dict) – Input string or dict

  • title (str | None) – Optional title

  • save_to (str | None) – Optional directory to save trace JSON

  • **kwargs – Passed to agent.run()

Return type:

Any