Class ConversationTracer

java.lang.Object
com.tnsai.utils.ConversationTracer

public final class ConversationTracer extends Object
Human-readable conversation tracer for agent communication. Prints formatted, colored output showing agent interactions and LLM calls.

Opt-in: Enable with environment variable: TNSAI_TRACE=true

Disabled by default to avoid accidental PII exposure in logs. Content is emitted under com.tnsai.diagnostics.content.ConversationTracer; applications must isolate that namespace from operational appenders. This diagnostic output is not a durable conversation transcript.

Example output:

 ┌─────────────────────────────────────────────────────────────────┐
 │ 14:32:15 │ buyer-ahmet → ALL (BROADCAST)                        │
 │ Type: CNP.CFP                                                   │
 ├─────────────────────────────────────────────────────────────────┤
 │ İstanbul'da 4+ yıldızlı otel arıyorum, max 900 TL/gece          │
 └─────────────────────────────────────────────────────────────────┘
 
  • Method Details

    • getInstance

      public static ConversationTracer getInstance()
    • isEnabled

      public boolean isEnabled()
    • traceAgentMessage

      public void traceAgentMessage(String from, String to, String messageType, Map<String,Object> content)
      Traces a message sent between agents.
    • traceLLMRequest

      public void traceLLMRequest(String agentName, String userMessage, List<Map<String,Object>> history, List<Map<String,Object>> tools)
      Traces the context window being sent to LLM.
    • traceLLMResponse

      public void traceLLMResponse(String agentName, String response)
      Traces the LLM response.
    • traceToolCall

      public void traceToolCall(String agentName, String toolName, Map<String,Object> args, Object result)
      Traces a tool call made by LLM.
    • traceSearchTool

      public void traceSearchTool(String toolName, String query)
      Traces a search tool execution (brave_search, duckduckgo, arxiv, etc.).
    • traceError

      public void traceError(String agentName, String error)
      Traces an error.