setup

AdalFlow tracing setup and providers module with OpenAI Agents SDK compatibility.

This module provides the core tracing infrastructure for AdalFlow, including trace providers and multi-processor management following OpenAI Agents SDK patterns.

References: - OpenAI Agents SDK: https://github.com/openai/openai-agents-python/blob/main/src/agents/tracing/setup.py

class SynchronousMultiTracingProcessor[source]

Bases: TracingProcessor

Forwards all calls to a list of TracingProcessors, in order of registration.

add_tracing_processor(tracing_processor: TracingProcessor)[source]

Add a processor to the list of processors. Each processor will receive all traces/spans.

set_processors(processors: list[TracingProcessor])[source]

Set the list of processors. This will replace the current list of processors.

on_trace_start(trace: Trace) None[source]

Called when a trace is started.

on_trace_end(trace: Trace) None[source]

Called when a trace is finished.

on_span_start(span: Span[Any]) None[source]

Called when a span is started.

on_span_end(span: Span[Any]) None[source]

Called when a span is finished.

shutdown() None[source]

Called when the application stops.

force_flush()[source]

Force the processors to flush their buffers.

class TraceProvider[source]

Bases: object

register_processor(processor: TracingProcessor)[source]

Add a processor to the list of processors. Each processor will receive all traces/spans.

set_processors(processors: list[TracingProcessor])[source]

Set the list of processors. This will replace the current list of processors.

get_current_trace() Trace | None[source]

Returns the currently active trace, if any.

get_current_span() Span[Any] | None[source]

Returns the currently active span, if any.

set_disabled(disabled: bool) None[source]

Set whether tracing is disabled.

create_trace(name: str, trace_id: str | None = None, group_id: str | None = None, metadata: Dict[str, Any] | None = None, disabled: bool = False) Trace[source]

Create a new trace.

create_span(span_data: TSpanData, span_id: str | None = None, parent: Trace | Span[Any] | None = None, disabled: bool = False) Span[TSpanData][source]

Create a new span.

shutdown() None[source]
get_global_trace_provider()[source]

Get the global trace provider, creating it if necessary.