Search by

switon / langfuse

switon

Langfuse OTLP export of LLM chat lifecycle events for Switon Framework

v1.0.0 2026-08-22 14:34 UTC

This package is auto-updated.

Last update: 2026-11-23 14:46:21 UTC


README

Langfuse CI PHP 8.3+

Langfuse OTLP export for Switon LLM traffic: conversation traces, per-call token usage, and tool spans, driven by the events the framework already dispatches.

Highlights

  • No instrumentation calls: listeners map CompletionResponded, CompletionFailed, ToolFinished, and TurnSuspended.
  • Trace identity from the domain: a turn id becomes the OTLP trace id; sub-agent threads share their host session.
  • Usage that prices correctly: input, cache, output, and reasoning tokens go out as exclusive buckets.
  • Off by default: nothing is exported until a Langfuse host is configured.

Installation

composer require switon/langfuse

Quick Start

Set the host and keys; the listener registers itself during boot.

# switon.yml
Switon\Langfuse\ClientInterface:
  baseUrl: https://cloud.langfuse.com
  publicKey: pk-lf-...
  secretKey: sk-lf-...

Docs: https://github.com/switon-php/langfuse/blob/main/docs/README.md

License

MIT.