Skip to content

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

docs(progress-tracing): add README for progress tracing module

Steven Enamakel888db320a192
diff --git a/crates/openhuman-core/src/agent/progress_tracing/README.md b/crates/openhuman-core/src/agent/progress_tracing/README.md
index c42ac7357a..7bbdd50f7d 100644
--- a/crates/openhuman-core/src/agent/progress_tracing/README.md
+++ b/crates/openhuman-core/src/agent/progress_tracing/README.md
@@ -2,45 +2,57 @@
Turns the agent's real-time [`AgentProgress`](../progress.rs) event stream into
OpenTelemetry/Langfuse-style trace spans (`agent.turn` -> `agent.iteration` ->
-`tool.*`/`subagent.*`), correlated by session id, for offline inspection,
-regression analysis, and debugging long multi-agent runs (issue #3886). See
-the module doc on `agent/progress_tracing.rs` for the full span-tree shape and
-the content-capture privacy gate
-(`observability.agent_tracing.capture_content`, default off).
+`tool.*`/`subagent.*`), correlated by session id, for offline inspection and
+debugging long multi-agent runs (issue #3886). The module doc on
+`agent/progress_tracing.rs` has the full span-tree shape and the
+content-capture privacy gate (`observability.agent_tracing.capture_content`,
+default off; enforced once, in `SpanCollector`, so no exporter can leak
+content).
## Key files
-- `agent/progress_tracing.rs` (parent file, `include!`s
+- `agent/progress_tracing.rs` (parent file; `include!`s
`progress_tracing_impl_01_part_0{1,2}.rs`) — `SpanCollector` (pure state
- machine: feed it progress events + a timestamp, it accumulates finished
- `TraceSpan`s), `TraceContext`, `SpanKind`/`SpanStatus`, NDJSON serialization
- (`spans_to_ndjson`), local file/log export (`export_spans`), and the two
+ machine: feed it progress events plus a timestamp, it accumulates finished
+ `TraceSpan`s), `TraceContext`, `RunType`, `SpanKind`/`SpanStatus`,
+ `spans_to_ndjson`, the local file/log exporter `export_spans`, and the two
run-completion entry points `export_run_trace` /
- `export_run_trace_from_journal`.
+ `export_run_trace_from_journal`. Each entry point runs two independent,
+ best-effort paths: a Langfuse push when `observability.share_usage_data` is
+ on (the default), and local NDJSON export to `export_path` or the app log
+ when `observability.agent_tracing.enabled` is on (opt-in).
- `langfuse.rs` (+ `langfuse_part_01.rs`, `langfuse_part_02.rs`) — Langfuse
- ingestion exporter. POSTs to the backend's `/telemetry/langfuse/ingestion`
- proxy (derived from `effective_backend_api_url`), authenticated with the
- session bearer; the backend injects the real Langfuse project keys and
- forwards to `/api/public/ingestion`. Carries `x-sdk-name` via
- `crate::api::product::product_identity_header` per AGENTS.md. Best-effort:
- failures are logged and swallowed so tracing never breaks a turn.
-- `journal_projection.rs` — reconstructs spans from the durable
- `AgentObservation` journal instead of the live `AgentProgress` stream, by
- folding journalled events through the same `SpanCollector`, so a
- UI/supervisor can attach after a run completes. Exhaustive over
- `tinyagents_harness::events::AgentEvent`; documents known parity gaps
- (estimated vs. charged cost, missing subagent prompt/output content).
-
-Test files (`*_tests.rs`, split into `_part_0N_tests.rs` files) are colocated
-per source file and carry no additional public surface.
+ ingestion exporter: `push_spans` (live spans) and `push_observations`
+ (journal observations plus the run-ledger `RunTelemetry` aggregate). Both
+ POST to the backend's `/telemetry/langfuse/ingestion` proxy, derived from
+ `effective_backend_api_url`, authenticated with the session bearer; the
+ backend injects the Langfuse project keys and forwards to
+ `/api/public/ingestion`. Carries `x-sdk-name` via
+ `crate::api::product::product_identity_header` per AGENTS.md. Pushes are
+ allowlisted to `staging`/`development` hosts (`environment_for_base`,
+ `LANGFUSE_PUSH_ENVIRONMENTS`) and skipped elsewhere with one `info` log per
+ process; batches are split at 500 events. Failures are logged and swallowed
+ so tracing never breaks a turn.
+- `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
+ attach after a run. Its match is exhaustive over
+ `tinyagents_harness::events::AgentEvent`; the module doc lists the known
+ parity gaps (estimated vs. charged cost, no subagent prompt/output content).
+
+Tests for all three source files live in this directory as
+`*_tests.rs` / `*_part_0N_tests.rs`.
## Called by
-- `web_chat/progress_bridge.rs` — the live in-run side-observer; feeds
- `AgentProgress` into `SpanCollector` and calls `export_run_trace[_from_journal]`
- at run completion.
-- `flows/tinyflows/langfuse_export.rs` — the flows-runner counterpart, reusing
- `langfuse::push_spans`'s endpoint/auth derivation for flow runs.
+- `web_chat/progress_bridge.rs` — the only caller. Builds a `SpanCollector`
+ per run, feeds it `AgentProgress`, shadow-compares the live spans against
+ `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` is the flow-run counterpart: it mirrors
+the proxy route, bearer auth, and timeout of `push_spans` but has its own
+copy and does not call this module.
## Related docs