ModelOutputTracker#
Distinguish UI streams, extension notifications, and external replies. See the guide.
- class zett_agent.events.ModelOutputTracker(reasoning_started=None, reasoning_completed=None, content_started=None, content_completed=None, _finished=False, _tools_started=False, _server_tools=<factory>)[source]#
Validate and publish output boundaries for one model call.
Nonempty deltas open a segment once. Content or local tool arguments close reasoning; reasoning cannot resume afterwards. Provider-hosted tools remain inside one model generation and may be followed by more reasoning, so their lifecycle does not close that segment. The final response closes content and seals the tracker. Completion requires a matching open segment. Failure and cancellation do not synthesize successful completion events.
- Parameters:
reasoning_started (ReasoningStartedEvent | None)
reasoning_completed (ReasoningCompletedEvent | None)
content_started (ContentStartedEvent | None)
content_completed (ContentCompletedEvent | None)
_finished (bool)
_tools_started (bool)
_server_tools (dict[str, ServerToolCall])
- async observe(context, event)[source]#
Publish extension boundaries and return their ordered UI event types.
- Parameters:
context (PhaseContext)
event (ModelEvent)
- Return type:
tuple[AgentEventType, …]
- message_timing(started, completed)[source]#
Build persistable durations from monotonic lifecycle boundaries.
- Parameters:
started (PhaseTransitionEvent)
completed (PhaseTransitionEvent)
- Return type: