debug.go

Overview

The debug.go file defines the DebugAPIRouter type, which is responsible for setting up HTTP routes related to the Debug API within the system. This router provides RESTful endpoints primarily used for retrieving debug and tracing information about runtime events, sessions, and application user interactions. The file encapsulates the route definitions and associates them with handler functions implemented in the DebugAPIController.

This routing component fits into the broader routing infrastructure that organizes REST API endpoints by domain, as detailed in the Router Setup topic, and serves as part of the REST API server described in REST API and Web Launchers. It allows external clients and tools to query detailed debug data, supporting observability and troubleshooting workflows.


Types and Functions

DebugAPIRouter

type DebugAPIRouter struct {
	runtimeController *controllers.DebugAPIController
}

NewDebugAPIRouter

func NewDebugAPIRouter(controller *controllers.DebugAPIController) *DebugAPIRouter

(DebugAPIRouter) Routes

func (r *DebugAPIRouter) Routes() Routes

Implementation Details


Interaction With Other System Components


Visual Diagram: DebugAPIRouter Structure

classDiagram
class DebugAPIRouter {
-runtimeController: DebugAPIController
+Routes()
}
class DebugAPIController {
+TraceDictHandler()
+EventGraphHandler()
+OtherDebugHandlers()
}
DebugAPIRouter --> DebugAPIController

This class diagram illustrates that DebugAPIRouter maintains a reference to a DebugAPIController instance and exposes routes that invoke the controller's handlers.


Summary of Routes and Their Purpose

Route Name

Purpose

GetTraceDict

Fetches a detailed trace dictionary for a given event ID to aid in debugging.

GetEventGraph

Provides a graphical representation of event relationships in a user session.

GetSessionTrace

Intended to retrieve the trace information for an entire session (currently unimplemented).


Relation to Relevant Topics


This file is a core part of the system's debugging interface, enabling programmatic access to runtime traces and event data to support developers and operators in monitoring and troubleshooting the AI agent platform.