Skip to main content

Module observer

Module observer 

Source
Expand description

LangfuseObserver reports each session’s AgentEvent stream to Langfuse.

The shape follows defect-storage::StorageObserver (crates/storage/src/lib.rs): in SessionObserver::on_session_created, session.subscribe() obtains an independent mpsc stream, tokio::spawn a consumer task that feeds each event to TraceProjector for translation and then to LangfuseIngest for reporting; after the stream ends (session drop), flush any remaining data.

Key difference from storage: degradable dropping. Storage’s slow consumption backpressures the main loop (“no-drop” semantics); Langfuse cannot do that — so the consumer loop only does enqueue (non-blocking) + lightweight translation. All real network I/O lives in LangfuseIngest’s background task, which drops when full. Any Langfuse failure must NOT affect the agent.

Structs§

LangfuseObserver
Langfuse reporting observer. Clone is cheap (internally Arc).