UNPKG

@openai/agents-core

Version:

The OpenAI Agents SDK is a lightweight yet powerful framework for building multi-agent workflows.

77 lines (76 loc) • 3.66 kB
import { TracingProcessor } from './processor'; import type { TracingConfig } from './config'; import type { Span, SpanData } from './spans'; import type { Trace } from './traces'; import type { TracingIdGenerator } from './utils'; export { getCurrentTraceContext, getCurrentSpan, getCurrentTrace, getOrCreateTrace, resetCurrentSpan, setCurrentSpan, setTracingContextStorage, withTraceContext, withTrace, } from './context'; export type { TraceContextSnapshot, TracingContextStorage } from './context'; export * from './createSpans'; export { BatchTraceProcessor, TracingExporter, TracingProcessor, ConsoleSpanExporter, MultiTracingProcessor, } from './processor'; export { NoopSpan, Span } from './spans'; export type { SpanData, AgentSpanData, TaskSpanData, TurnSpanData, TaskUsageData, TurnUsageData, FunctionSpanData, GenerationUsageData, GenerationSpanData, ResponseSpanData, HandoffSpanData, CustomSpanData, GuardrailSpanData, TranscriptionSpanData, SpeechSpanData, SpeechGroupSpanData, MCPListToolsSpanData, SpanOptions, SpanError, } from './spans'; export { NoopTrace, Trace } from './traces'; export { defaultTracingIdGenerator, generateGroupId, generateSpanId, generateTraceId, } from './utils'; export type { TracingIdGenerator } from './utils'; export type { TraceProviderOptions } from './provider'; export type { TracingConfig }; /** * Add a processor to the list of processors. Each processor will receive all traces/spans. * * @param processor - The processor to add. */ export declare function addTraceProcessor(processor: TracingProcessor): void; /** * Set the list of processors. This will replace any existing processors. * * @param processors - The list of processors to set. */ export declare function setTraceProcessors(processors: TracingProcessor[]): void; /** * Set the disabled state of the tracing provider. * * @param disabled - Whether to disable tracing. */ export declare function setTracingDisabled(disabled: boolean): void; /** * Set the trace and span ID generator for the global tracing provider. * * @param idGenerator - Custom ID generator methods, or undefined to restore defaults. */ export declare function setTracingIdGenerator(idGenerator?: Partial<TracingIdGenerator>): void; /** * Dispatch a completed trace lifecycle to all processors registered on the * global tracing provider. * * This bypasses Trace.start() and Trace.end(), so callers can replay a * completed lifecycle without mutating the trace state. */ export declare function dispatchTrace(trace: Trace): Promise<void>; /** * Dispatch a completed span lifecycle to all processors registered on the * global tracing provider. * * This bypasses Span.start() and Span.end(), so callers can replay a completed * lifecycle without mutating existing timestamps. */ export declare function dispatchSpan<TSpanData extends SpanData>(span: Span<TSpanData>): Promise<void>; /** * Dispatch a span start event to all processors registered on the global * tracing provider. * * This bypasses Span.start(), so callers can emit a start event without * mutating the span state or existing timestamps. */ export declare function dispatchSpanStart<TSpanData extends SpanData>(span: Span<TSpanData>): Promise<void>; /** * Dispatch a span end event to all processors registered on the global tracing * provider. * * This bypasses Span.end(), so callers can emit an end event without mutating * the span state or existing timestamps. */ export declare function dispatchSpanEnd<TSpanData extends SpanData>(span: Span<TSpanData>): Promise<void>; /** * Start the trace export loop. */ export declare function startTraceExportLoop(): void;