类 JsonlTraceExporter

java.lang.Object
io.agentscope.core.hook.recorder.JsonlTraceExporter
所有已实现的接口:
Hook, AutoCloseable

public final class JsonlTraceExporter extends Object implements Hook, AutoCloseable
A built-in, out-of-the-box JSONL trace exporter based on the Hook event system.

Each HookEvent is written as a single JSON object per line. This is designed for local debugging, offline troubleshooting, and attaching logs to issues.

Notes:

  • This exporter is best-effort by default: serialization / IO errors do not break agent execution unless JsonlTraceExporter.Builder.failFast(boolean) is enabled.
  • This exporter performs blocking file IO on an internal single-threaded queue to keep file order, step IDs, and run IDs consistent.
  • 方法详细资料

    • builder

      public static JsonlTraceExporter.Builder builder(Path outputFile)
    • priority

      public int priority()
      从接口复制的说明: Hook
      The priority of this hook (lower value = higher priority).

      Hooks are executed in ascending priority order. Hooks with the same priority execute in their registration order.

      Common Priority Ranges:

      • 0-50: Critical system hooks (auth, security)
      • 51-100: High priority hooks (validation, preprocessing)
      • 101-500: Normal priority hooks (business logic)
      • 501-1000: Low priority hooks (logging, metrics)
      指定者:
      priority 在接口中 Hook
      返回:
      The priority value (default: 100)
    • onEvent

      public <T extends HookEvent> reactor.core.publisher.Mono<T> onEvent(T event)
      从接口复制的说明: Hook
      Handle a hook event.

      This method is called for all agent execution events. Use pattern matching to handle specific event types.

      Modifiable Events: For events with setters, you can modify the context and the changes will affect agent execution:

      Notification Events: Events without setters are read-only:

      指定者:
      onEvent 在接口中 Hook
      类型参数:
      T - The concrete event type
      参数:
      event - The hook event
      返回:
      Mono containing the potentially modified event
    • close

      public void close() throws IOException
      指定者:
      close 在接口中 AutoCloseable
      抛出:
      IOException