openai-agents-python/src/agents/tracing/util.py
2025-03-11 09:42:28 -07:00

17 lines
392 B
Python

import uuid
from datetime import datetime, timezone
def time_iso() -> str:
"""Returns the current time in ISO 8601 format."""
return datetime.now(timezone.utc).isoformat()
def gen_trace_id() -> str:
"""Generates a new trace ID."""
return f"trace_{uuid.uuid4().hex}"
def gen_span_id() -> str:
"""Generates a new span ID."""
return f"span_{uuid.uuid4().hex[:24]}"