The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
refactor(observability): delegate trace export internals to tinyagents
Steven Enamakel8a9211c0bf88
diff --git a/crates/openhuman-core/src/core/observability/progress_tracing.rs b/crates/openhuman-core/src/core/observability/progress_tracing.rsindex ececdadcda..b03cf986b6 100644--- a/crates/openhuman-core/src/core/observability/progress_tracing.rs+++ b/crates/openhuman-core/src/core/observability/progress_tracing.rs@@ -1,84 +1,14 @@-//! Structured tracing export off the agent [`progress`](super::progress)-//! channel (issue #3886).+//! Native trace export for completed TinyAgents runs.//!-//! OpenHuman already emits rich real-time [`AgentProgress`] events for the UI,-//! but there was no first-class trace export for offline inspection,-//! regression analysis, or debugging long multi-agent runs. This module turns-//! that same event stream into OpenTelemetry/Langfuse-style **spans** —-//!-//! ```text-//! agent.turn (root, trace_id = session id)-//! ├─ agent.iteration #1-//! │ ├─ tool.web_search-//! │ └─ subagent.code_executor-//! │ ├─ subagent.iteration #1-//! │ │ └─ tool.read_file-//! │ └─ (closed on SubagentCompleted)-//! └─ agent.iteration #2-//! ```-//!-//! correlated by **session id** (the trace id) with **user attribution**-//! (a span attribute), so a run that fans out across many subagents over-//! minutes-to-hours is inspectable end to end.-//!-//! ## Privacy-//!-//! Spans always carry *metadata* — span names, counts, timings, and-//! token/cost figures (model labels are `{provider_id}.{model}`, e.g.-//! `managed.hint:chat`). While `observability.agent_tracing.capture_content` is-//! on (the default), content is additionally recorded as span `input`/`output` — the turn's-//! prompt/reply, each generation's bounded structured request messages (system-//! prompt included) + completion, **truncated** tool arguments/results, and-//! each subagent's delegated prompt + final output. With the flag off,-//! none of that content ever reaches the in-memory span, so-//! no exporter (NDJSON file, app log, or Langfuse) can leak it.-//! Streamed text/thinking deltas (`TextDelta`, `ThinkingDelta`,-//! `ToolCallArgsDelta`), raw error strings, and filesystem paths are **never**-//! recorded regardless of the flag, honoring the project's "never log secrets-//! or full PII" rule for logs.-//!-//! The one exception is the turn's prompt/reply, delivered via-//! `AgentProgress::TurnContent`. It is attached to the turn span **only** when-//! `observability.agent_tracing.capture_content` is enabled. That gate is-//! enforced at storage time in [`SpanCollector`] — the single choke point — so when off, no-//! exporter (NDJSON file, app log, or Langfuse push) can ever serialize it.-//!-//! ## Wiring-//!-//! [`SpanCollector`] is a pure state machine: feed it the progress events plus-//! a millisecond timestamp and it accumulates finished spans. The consumer-//! side (the web progress bridge) owns the clock and the export — see-//! [`export_spans`]. The collector has no I/O and no async, so the span shape-//! is exhaustively unit-testable.--/// Journal-backed projection from durable tinyagents observations.-#[path = "../../agent/progress_tracing/journal_projection.rs"]-pub(crate) mod journal_projection;-/// Langfuse ingestion exporter (remote push through the configured backend).-pub(crate) use crate::backend::telemetry::langfuse;-#[path = "../../agent/progress_tracing/otlp.rs"]-mod otlp;+//! OpenHuman owns product attribution, privacy gates, local export settings,+//! and the authenticated backend transport. TinyAgents owns the span+//! collector, journal projection, and OTLP payload format.-/// The [`SpanCollector`] state machine that folds progress events into spans.-#[path = "../../agent/progress_tracing/collector/mod.rs"]-mod collector;-/// Handing finished spans to the local exporter and the Langfuse push.mod export;-// The data model (`RunType`, `TraceContext`, `SpanKind`, `SpanStatus`,-// `TraceSpan`), content truncation, NDJSON serialization, OTLP conversion and-// Langfuse batch chunking live upstream in-// `tinyagents_harness::observability::trace_export`.use tinyagents_harness::observability::trace_export::ExportBrand;-#[cfg(test)]-use tinyagents_harness::observability::trace_export::{RunType, TraceContext, TraceSpan};-#[cfg(test)]-use tinyagents_harness::observability::trace_export::{SpanKind, SpanStatus};--pub use collector::{SpanCollector, TurnOutcome};-/// Product identity stamped onto exported telemetry (OTLP service name, scope,-/// Langfuse release/version and run-total labels).+/// Product identity stamped onto exported telemetry.pub(crate) fn export_brand() -> ExportBrand<'static> {ExportBrand {product: "openhuman",@@ -86,17 +16,4 @@ pub(crate) fn export_brand() -> ExportBrand<'static> {}}-pub(crate) use export::export_subagent_journal_trace;-pub(crate) use export::{export_run_trace, export_run_trace_from_journal};--#[cfg(test)]-#[path = "../../agent/progress_tracing/journal_projection_tests.rs"]-mod journal_projection_tests;--#[cfg(test)]-#[path = "trace_export_adoption_tests.rs"]-mod trace_export_adoption_tests;--#[cfg(test)]-#[path = "../../agent/progress_tracing/progress_tracing_tests.rs"]-mod tests;+pub(crate) use export::export_run_trace_from_journal;