Skip to content

latent.agents.events

Agent event types — re-exported from latent.events.

All event types are defined in latent.events and re-exported here for backward compatibility. from latent.agents.events import X continues to work without deprecation warnings.

Also defines emit_text_turn — the single helper that frames an LLM-free terminal turn (StepBoundary -> TextDelta), shared by the canned-response short-circuit and the guardrail block path.

Functions

emit_text_turn

emit_text_turn(text: str, step: int = 1) -> AsyncIterator[AgentEvent]

Emit a correctly-framed single-step terminal turn with no LLM call.

The StepBoundary MUST precede the TextDelta: invoke() drops events before the first boundary (see base.py), so this ordering is what lands the text in result.text. Centralizing it here makes the empty-message bug unrepresentable for callers (canned responders, guardrail block path).