Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

docs(agent-observability): document OTLP trace export and legacy batch deprecation

Steven Enamakel3aa7b82bb85d
diff --git a/crates/openhuman-core/src/agent/progress_tracing/README.md b/crates/openhuman-core/src/agent/progress_tracing/README.md
index 64243bd2bd..655bfc3c6a 100644
--- a/crates/openhuman-core/src/agent/progress_tracing/README.md
+++ b/crates/openhuman-core/src/agent/progress_tracing/README.md
@@ -33,8 +33,10 @@ content).
`/telemetry/langfuse/otel/v1/traces` proxy; the backend supplies project
keys and authoritative user attribution. Export is on by default through
`observability.share_usage_data`; local NDJSON export remains optional.
-- [`langfuse.rs`](./langfuse.rs) + `langfuse/` retain the legacy batch projection for
- compatibility tests and the flow-run exporter. Agent turns use `otlp.rs`.
+- [`langfuse.rs`](./langfuse.rs) + `langfuse/` hold the proxy URL and environment
+ resolution `otlp.rs` and the flow exporter share, plus the legacy batch
+ projection kept for compatibility tests. No trace is sent on the legacy
+ batch path; Langfuse v4 ingests traces only over OTLP.
- [`journal_projection.rs`](./journal_projection.rs): `spans_from_observations` rebuilds spans from the
durable `AgentObservation` journal instead of the live stream, by folding
journalled events through the same `SpanCollector`, so a UI/supervisor can
@@ -55,8 +57,10 @@ Tests live in this directory as `*_tests.rs` files, e.g.
`spans_from_observations` over the run journal, then calls
`export_run_trace_from_journal` (journal available) or `export_run_trace`.
-[`flows/tinyflows/langfuse_export.rs`](../../flows/tinyflows/langfuse_export.rs) is the separate flow-run exporter and
-currently still uses the legacy batch proxy.
+[`flows/tinyflows/langfuse_export.rs`](../../flows/tinyflows/langfuse_export.rs) is the separate flow-run exporter. It
+builds the graph trace with `tinyagents_graph::GraphLangfuseExporter` and sends
+it to the same OTLP proxy route as Langfuse v4 spans
+(`build_otlp_requests`), so no trace goes to the legacy batch path.
## Related docs
diff --git a/crates/openhuman-core/src/agent/progress_tracing/langfuse.rs b/crates/openhuman-core/src/agent/progress_tracing/langfuse.rs
index 3b32107e88..8338c423e5 100644
--- a/crates/openhuman-core/src/agent/progress_tracing/langfuse.rs
+++ b/crates/openhuman-core/src/agent/progress_tracing/langfuse.rs
@@ -1,20 +1,24 @@
-//! Langfuse ingestion exporter for agent trace spans (issue #4249 follow-up).
+//! Langfuse proxy URL and environment resolution for agent trace export
+//! (issue #4249 follow-up).
//!
-//! When `observability.share_usage_data` is enabled, a completed run's spans are POSTed to the OpenHuman
-//! backend's Langfuse **proxy** route, `/telemetry/langfuse/ingestion`, derived
-//! from the **current backend hostname** (`effective_backend_api_url`). The
-//! request reuses the OpenHuman **session bearer** — the same auth every other
-//! backend call carries; the backend authenticates that JWT, injects the
-//! Langfuse project keys server-side, and forwards the batch to Langfuse's real
-//! `/api/public/ingestion` (backend `src/services/langfuseProxy.ts`). Clients
-//! never hold Langfuse keys and never hit `/api/public/ingestion` directly.
+//! When `observability.share_usage_data` is enabled, a completed run's spans
+//! are POSTed as OTLP/HTTP JSON (see [`super::otlp`]) to the OpenHuman
+//! backend's Langfuse **proxy**, `/telemetry/langfuse/otel/v1/traces`, which
+//! sits beside the legacy `/telemetry/langfuse/ingestion` route
+//! [`ingestion_url`] resolves from the **current backend hostname**
+//! (`effective_backend_api_url`). The request reuses the OpenHuman **session
+//! bearer**; the backend authenticates that JWT, stamps the user on every span,
+//! injects the Langfuse project keys server-side, and forwards to Langfuse
+//! v4's `/api/public/otel/v1/traces` (backend `src/services/langfuseProxy.ts`).
+//! Clients never hold Langfuse keys. The legacy batch route is no longer used
+//! for traces: Langfuse Cloud removes it on 2026-11-16.
//!
//! Best-effort: any failure is logged and swallowed by the caller so tracing
//! never breaks a turn. Spans always carry metadata (names, kinds, timings,
-//! and non-PII token/cost figures — the latter promoted into Langfuse's native
-//! `usageDetails`/`costDetails`). Prompt/reply text and truncated tool I/O
-//! ride along only while `observability.agent_tracing.capture_content` is on;
-//! disabling that flag withholds content and leaves metadata-only export.
+//! and non-PII token/cost figures, promoted into Langfuse's native
+//! usage/cost details). Prompt/reply text and truncated tool I/O ride along
+//! only while `observability.agent_tracing.capture_content` is on; disabling
+//! that flag withholds content and leaves metadata-only export.
mod environment;
mod journal_export;
diff --git a/docs/gitbooks/en/developing/agent-observability.md b/docs/gitbooks/en/developing/agent-observability.md
index 5cc7e850c6..53ec9450bd 100644
--- a/docs/gitbooks/en/developing/agent-observability.md
+++ b/docs/gitbooks/en/developing/agent-observability.md
@@ -115,13 +115,24 @@ unless you override that, because it forwards the bearer token verbatim.
Everything above is about local artifacts. For a real agent run, the
core can export trace spans to Langfuse instead: when
`observability.share_usage_data` is on (the default), a completed run's spans
-go to the OpenHuman backend's Langfuse ingestion proxy over the same session
-bearer every other backend call uses, and the backend forwards them to
-Langfuse with the project keys injected server-side. Clients never hold
-Langfuse credentials directly. Prompt and reply text ride along only while
+go as OTLP/HTTP JSON to the OpenHuman backend's Langfuse proxy,
+`/telemetry/langfuse/otel/v1/traces`, over the same session bearer every other
+backend call uses. The backend stamps the signed-in user on every span, injects
+the project keys server-side and forwards to Langfuse v4's
+`/api/public/otel/v1/traces` with `x-langfuse-ingestion-version: 4`. Clients
+never hold Langfuse credentials directly. Flow runs export the same way
+(`crates/openhuman-core/src/flows/tinyflows/langfuse_export.rs`).
+
+Langfuse v4 has no trace record of its own and filters observations directly,
+so the exporters copy the trace name, session, tags, release, environment and
+trace metadata onto every span, and put the run's overall input and output on
+the root observation. Each finished span is exported once; v4 duplicates a
+span id it receives twice. Langfuse Cloud removes the legacy
+`/api/public/ingestion` trace path on 2026-11-16, and nothing in the core sends
+traces there. Prompt and reply text ride along only while
`observability.agent_tracing.capture_content` is also on; turning it off keeps
metadata (names, timings, token and cost figures) but drops content. See
-`crates/openhuman-core/src/agent/progress_tracing/langfuse.rs` and
+`crates/openhuman-core/src/agent/progress_tracing/otlp.rs` and
`crates/openhuman-core/src/config/schema/observability.rs`.
## Out of scope for the E2E layer