Interface LLMCallPublisher

All Known Implementing Classes:
Slf4jLLMCallPublisher
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface LLMCallPublisher
SPI for publishing LLMCallLog events emitted by CapturingLLMClient (issue #79).

One publish call per LLM invocation, after the call has completed (success or failure). The publisher MUST NOT throw — observability failures cannot block the agent's hot path. Implementations that need to surface their own errors should log them and swallow.

Why this exists alongside LLMObserver

LLMObserver predates the typed LLMCallLog schema and works in raw String prompts/responses. It is kept for the existing ObservableLLMClient wiring (PromptLogger, LLMMetrics). New consumers — LangFuse / Helicone bridges, Prometheus derivation, cost dashboards — should target this publisher because the typed record carries token usage, cost, error info, stream timing, and full EventContext that the raw-string observer cannot.
Since:
0.9.0 (issue #79)
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final LLMCallPublisher
    Publisher that drops every event — the framework default.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns NOOP.
    void
    Publish one captured LLM call.
  • Field Details

    • NOOP

      static final LLMCallPublisher NOOP
      Publisher that drops every event — the framework default.
  • Method Details

    • publish

      void publish(LLMCallLog call)
      Publish one captured LLM call. Must not throw.
    • noOp

      static LLMCallPublisher noOp()
      Returns NOOP. Convenience for nullable-publisher call sites.