Package ai.acolite.agentsdk.core.tracing
Class Trace
java.lang.Object
ai.acolite.agentsdk.core.tracing.Trace
- Direct Known Subclasses:
NoopTrace
Represents a single end-to-end workflow trace.
A trace captures the execution of an entire workflow, containing multiple spans for individual operations (agents, generations, tools, etc.).
Lifecycle: 1. Create trace with builder 2. Call start() to begin 3. Execute workflow (creates spans) 4. Call end() to complete
Thread-safe: Yes
Ported from TypeScript OpenAI Agents SDK Source: tracing/traces.ts
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()Clone this trace with same properties.voidend()End the trace.voidstart()Start the trace.toJson()Convert to JSON (excludes API key by default for security)toJson(boolean includeTracingApiKey) Convert to JSON for export.withProcessor(TraceProcessor processor) Clone this trace with a different processor.
-
Constructor Details
-
Trace
public Trace()
-
-
Method Details
-
start
public void start()Start the trace. Calls processor.onTraceStart(). Idempotent - multiple calls are safe. -
end
public void end()End the trace. Calls processor.onTraceEnd(). Idempotent - multiple calls are safe. -
clone
Clone this trace with same properties. Useful for creating related traces with shared configuration. -
withProcessor
Clone this trace with a different processor.- Parameters:
processor- Processor for lifecycle events- Returns:
- New trace instance with updated processor
-
toJson
Convert to JSON for export.- Parameters:
includeTracingApiKey- Whether to include API key in output- Returns:
- JSON representation
-
toJson
Convert to JSON (excludes API key by default for security)
-