MessageTiming#

Distinguish UI streams, extension notifications, and external replies. See the guide.

class zett_agent.extensions.events.MessageTiming(started_at, completed_at, duration_ns, reasoning_started_at=None, reasoning_completed_at=None, reasoning_duration_ns=None, content_started_at=None, content_completed_at=None, content_duration_ns=None)[源代码]#

Persistable timing measurements for one immutable Raw Log message.

UTC timestamps describe when work happened and can be displayed or compared across processes. Durations are measured with a monotonic clock so wall-clock corrections cannot produce negative or inaccurate elapsed times. Monotonic clock readings themselves are intentionally not persisted.

参数:
  • started_at (datetime)

  • completed_at (datetime)

  • duration_ns (int)

  • reasoning_started_at (datetime | None)

  • reasoning_completed_at (datetime | None)

  • reasoning_duration_ns (int | None)

  • content_started_at (datetime | None)

  • content_completed_at (datetime | None)

  • content_duration_ns (int | None)

started_at: datetime#

UTC time when processing began. For assistant and tool messages this is the transition into GENERATING and RUNNING_TOOL, respectively. A directly appended or user-authored message uses its append time.

completed_at: datetime#

UTC time when processing ended. For assistant and tool messages this is the transition back to READY after the operation finished.

duration_ns: int#

Total elapsed processing time in nanoseconds, calculated from monotonic clock readings rather than by subtracting the UTC timestamps.

reasoning_started_at: datetime | None#

UTC arrival time of the first non-empty reasoning delta. None when the model did not stream reasoning for this message.

reasoning_completed_at: datetime | None#

UTC time when reasoning gave way to content, a tool call, or the final response. None when no reasoning segment was observed.

reasoning_duration_ns: int | None#

Elapsed reasoning time in nanoseconds measured with a monotonic clock. None when no complete reasoning segment was observed.

content_started_at: datetime | None#

UTC arrival time of the first non-empty answer-content delta. None for messages without streamed answer content, including tool messages.

content_completed_at: datetime | None#

UTC time of the final model response after streamed content. None when no content segment was observed.

content_duration_ns: int | None#

Elapsed answer-content streaming time in nanoseconds measured with a monotonic clock. None when no complete content segment was observed.

classmethod instant()[源代码]#

Represent a message that required no measured processing interval.

返回类型:

MessageTiming