콘텐츠로 이동

createGenerationSpan

이 콘텐츠는 아직 번역되지 않았습니다.

function createGenerationSpan(options?, parent?): Span<GenerationSpanData>;

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.

Parameter Type

options?

DeepPartial<CreateSpanOptions<GenerationSpanData>>

parent?

| Span<any> | Trace

Span<GenerationSpanData>