import { Agent } from '../agent'; import { Handoff } from '../handoff'; import { ModelTracing } from '../model'; import { Tool } from '../tool'; import { createAgentSpan } from '../tracing'; import { Span, type TaskSpanData, type TurnSpanData } from '../tracing/spans'; import { Trace } from '../tracing/traces'; import type { Usage } from '../usage'; export type TraceOverrideConfig = { traceId?: string; workflowName?: string; groupId?: string; traceMetadata?: Record; tracingApiKey?: string; }; type EnsureAgentSpanParams = { agent: Agent; handoffs: Handoff[]; tools: Tool[]; currentSpan?: ReturnType; parent?: Span | Trace; }; type UsageSnapshot = { requests: number; inputTokens: number; outputTokens: number; totalTokens: number; cachedInputTokens: number; cacheWriteInputTokens: number; }; export type RunnerSpanLifecycle = { span: Span; ownedUsage: UsageSnapshot; }; export declare function recordRunnerSpanUsage(lifecycle: RunnerSpanLifecycle | undefined, increment: Usage): void; export declare function startTaskSpan(name: string, parent?: Span | Trace): RunnerSpanLifecycle; export declare function ensureActiveAgentSpanForInterruptedResume(options: { agent: Agent; restoredAgentSpan?: ReturnType; parent?: Span | Trace; }): ReturnType; export declare function startRunnerInvocationSpans(options: { name: string; agent: Agent; restoredAgentSpan?: ReturnType; resumeInterruptedTurn: boolean; parent?: Span | Trace; }): { taskSpan: RunnerSpanLifecycle; agentSpan?: ReturnType; }; export declare function startTurnSpan(turn: number, agentName: string, parent?: Span | Trace): RunnerSpanLifecycle; export declare function ensureTurnSpan(current: RunnerSpanLifecycle | undefined, turn: number, agentName: string, parent?: Span | Trace): RunnerSpanLifecycle; export declare function finishRunnerSpan(lifecycle: RunnerSpanLifecycle | undefined): void; export declare function setRunnerSpanError(lifecycle: RunnerSpanLifecycle | undefined, error: unknown, traceIncludeSensitiveData: boolean): void; export declare function getRunnerSpanErrorDetails(error: unknown, traceIncludeSensitiveData: boolean): string; /** * Normalizes tracing configuration into the format expected by model providers. * Returns `false` to disable tracing, `true` to include full payload data, or * `'enabled_without_data'` to omit sensitive content while still emitting spans. */ export declare function getTracing(tracingDisabled: boolean, traceIncludeSensitiveData: boolean): ModelTracing; export declare function applyTraceOverrides(trace: Trace, currentSpan: Span | undefined, overrides: TraceOverrideConfig): { trace: Trace; currentSpan: Span | undefined; }; /** * Ensures an agent span exists and updates tool metadata if already present. * Returns the span so callers can pass it through run state. */ export declare function ensureAgentSpan(params: EnsureAgentSpanParams): Span; export {};