latent.agents.canned_response¶
Trivial-input canned-response short-circuit.
A CannedResponder is a deterministic, LLM-free reply rule. Its single reply
field is a callable that inspects the conversation and returns the reply text,
or None to decline (the agent tries the next responder, then the LLM).
patterns() builds such a callable for the common regex case.
The event contract is owned by latent.agents.events.emit_text_turn.
Classes¶
CannedResponder¶
Deterministic, LLM-free reply rule. reply(messages) returns the reply
text, or None to decline. First-match-wins, in declaration order.
Functions¶
lifecycle_hooks¶
Adapt configured canned responders into lifecycle-compatible hooks.
patterns¶
Build a Reply that fullmatches the normalized last user message.
Case-insensitive, surrounding whitespace stripped, inputs longer than
max_len rejected (backstop against an over-broad pattern). Validates
reply is non-empty at build time.