import { DeepPartial } from '../types'; import { CreateSpanOptions } from './provider'; import { Span, ResponseSpanData, SpanData, AgentSpanData, FunctionSpanData, HandoffSpanData, GenerationSpanData, CustomSpanData, GuardrailSpanData, TranscriptionSpanData, SpeechSpanData, SpeechGroupSpanData, MCPListToolsSpanData } from './spans'; import { Trace } from './traces'; type CreateArgs = DeepPartial>; /** * Create a new response span. The span will not be started automatically, you should either * use `withResponseSpan()` or call `span.start()` and `span.end()` manually. * * This span captures the details of a model response, primarily the response identifier. * If you need to capture detailed generation information such as input/output messages, * model configuration, or usage data, use `createGenerationSpan()` instead. * * @param options - Optional span creation options, including span data and identifiers. * @param parent - The parent span or trace. If not provided, the current trace/span will be used * automatically. * * @returns The newly created response span. */ export declare function createResponseSpan(options?: CreateArgs, parent?: Span | Trace): Span; /** * Create a new response span and automatically start and end it. * * This span captures the details of a model response, primarily the response identifier. * If you need to capture detailed generation information such as input/output messages, * model configuration, or usage data, use `generationSpan()` instead. */ export declare const withResponseSpan: (fn: (span: Span) => Promise, options?: DeepPartial> | undefined, parent?: Span | Trace | undefined) => Promise; /** * Create a new agent span. The span will not be started automatically, you should either * use `withAgentSpan()` or call `span.start()` and `span.end()` manually. * * @param options - Optional span creation options, including span data and identifiers. * @param parent - The parent span or trace. If not provided, the current trace/span will be used * automatically. * * @returns The newly created agent span. */ export declare function createAgentSpan(options?: CreateArgs, parent?: Span | Trace): Span; /** * Create a new agent span and automatically start and end it. */ export declare const withAgentSpan: (fn: (span: Span) => Promise, options?: DeepPartial> | undefined, parent?: Span | Trace | undefined) => Promise; /** * Create a new function span. The span will not be started automatically, you should either * use `withFunctionSpan()` or call `span.start()` and `span.end()` manually. * * @param options - Optional span creation options, including span data and identifiers. * @param parent - The parent span or trace. If not provided, the current trace/span will be used * automatically. * * @returns The newly created function span. */ export declare function createFunctionSpan(options: CreateArgs & { data: { name: string; }; }, parent?: Span | Trace): Span; /** * Create a new function span and automatically start and end it. */ export declare const withFunctionSpan: (fn: (span: Span) => Promise, options: DeepPartial> & { data: { name: string; }; }, parent?: Span | Trace | undefined) => Promise; /** * Create a new handoff span. The span will not be started automatically, you should either * use `withHandoffSpan()` or call `span.start()` and `span.end()` manually. * * @param options - Optional span creation options, including span data and identifiers. * @param parent - The parent span or trace. If not provided, the current trace/span will be used * automatically. * * @returns The newly created handoff span. */ export declare function createHandoffSpan(options?: CreateArgs, parent?: Span | Trace): Span; /** * Create a new handoff span and automatically start and end it. */ export declare const withHandoffSpan: (fn: (span: Span) => Promise, options?: DeepPartial> | undefined, parent?: Span | Trace | undefined) => Promise; /** * Create a new generation span. The span will not be started automatically, you should either * use `withGenerationSpan()` or call `span.start()` and `span.end()` manually. * * This span captures the details of a model generation, including input/output message * sequences, model information, and usage data. If you only need to capture a model response * identifier, consider using `createResponseSpan()` instead. * * agents-core keeps generation usage payloads as provided. Backend-specific schema constraints * are enforced by each exporter. For example, the OpenAI tracing exporter in * `@openai/agents-openai` keeps top-level usage to `input_tokens` and * `output_tokens` for OpenAI traces ingest, and maps additional usage fields * under `usage.details`. Third-party exporters can apply their own mapping. */ export declare function createGenerationSpan(options?: CreateArgs, parent?: Span | Trace): Span; /** Automatically create a generation span, run fn and close the span */ export declare const withGenerationSpan: (fn: (span: Span) => Promise, options?: DeepPartial> | undefined, parent?: Span | Trace | undefined) => Promise; /** * Create a new custom span. The span will not be started automatically, you should either use * `withCustomSpan()` or call `span.start()` and `span.end()` manually. */ export declare function createCustomSpan(options: CreateArgs & { data: { name: string; }; }, parent?: Span | Trace): Span; export declare const withCustomSpan: (fn: (span: Span) => Promise, options: DeepPartial> & { data: { name: string; }; }, parent?: Span | Trace | undefined) => Promise; /** * Create a new guardrail span. The span will not be started automatically, you should either use * `withGuardrailSpan()` or call `span.start()` and `span.end()` manually. */ export declare function createGuardrailSpan(options: CreateArgs & { data: { name: string; }; }, parent?: Span | Trace): Span; export declare const withGuardrailSpan: (fn: (span: Span) => Promise, options: DeepPartial> & { data: { name: string; }; }, parent?: Span | Trace | undefined) => Promise; /** * Create a new transcription span. The span will not be started automatically. */ export declare function createTranscriptionSpan(options: CreateArgs & { data: { input: { data: string; format: 'pcm' | (string & {}); }; }; }, parent?: Span | Trace): Span; export declare const withTranscriptionSpan: (fn: (span: Span) => Promise, options: DeepPartial> & { data: { input: { data: string; format: "pcm" | (string & {}); }; }; }, parent?: Span | Trace | undefined) => Promise; /** * Create a new speech span. The span will not be started automatically. */ export declare function createSpeechSpan(options: CreateArgs & { data: { output: { data: string; format: 'pcm' | (string & {}); }; }; }, parent?: Span | Trace): Span; export declare const withSpeechSpan: (fn: (span: Span) => Promise, options: DeepPartial> & { data: { output: { data: string; format: "pcm" | (string & {}); }; }; }, parent?: Span | Trace | undefined) => Promise; /** * Create a new speech group span. The span will not be started automatically. */ export declare function createSpeechGroupSpan(options?: CreateArgs, parent?: Span | Trace): Span; export declare const withSpeechGroupSpan: (fn: (span: Span) => Promise, options?: DeepPartial> | undefined, parent?: Span | Trace | undefined) => Promise; /** * Create a new MCP list tools span. The span will not be started automatically. */ export declare function createMCPListToolsSpan(options?: CreateArgs, parent?: Span | Trace): Span; export declare const withMCPListToolsSpan: (fn: (span: Span) => Promise, options?: DeepPartial> | undefined, parent?: Span | Trace | undefined) => Promise; export {};