Skip to main content
Use compose_chat_pipeline(...) when you want one callback (pipeline.on_actions) that wires context storage and agent-context writing without callback clobbering.

Import

Signature

  • llm: async callable (prompt: str) -> str.
  • threshold: summarizer trigger (action count).
  • lookback_seconds, max_actions: AsyncContextStore bounds.
  • write_actions: optional push callback for raw action text.
  • overwrite_with_summary: optional callback invoked when summary is emitted.
  • debounce_ms: forwarded to AsyncAgentContextWriter.

Minimal setup

Ordering guarantee

pipeline.on_actions(payload) runs in canonical order:
  1. context_store.add(payload) updates retrieval state.
  2. agent_writer.add(payload) handles push and summary logic.
Summary callbacks are fanned out so both context-store and writer-side overwrite paths receive updates. This prevents accidental callback overwrite behavior in custom wiring.

When to use this helper

  • You want the default chat ingestion wiring without hand-rolling callback orchestration.
  • You need predictable summary propagation to both storage and UI push callbacks.