Skip to content

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

refactor(tinyagents): move turn observer and compaction logging into the harness

Steven Enamakelb924774adefb
diff --git a/crates/openhuman-core/src/agent/tinyagents/mod.rs b/crates/openhuman-core/src/agent/tinyagents/mod.rs
index 4ca1ffe45a..51a684df59 100644
--- a/crates/openhuman-core/src/agent/tinyagents/mod.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/mod.rs
@@ -64,7 +64,6 @@ pub mod todos;
pub(crate) mod tools;
mod topology;
mod turn_models;
-pub mod turn_observer;
mod turn_outcome;
mod turn_policy;
mod turn_run_error;
diff --git a/crates/openhuman-core/src/agent/tinyagents/observability.rs b/crates/openhuman-core/src/agent/tinyagents/observability.rs
index 2314baa5bc..0b02f0c62f 100644
--- a/crates/openhuman-core/src/agent/tinyagents/observability.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/observability.rs
@@ -9,7 +9,6 @@
//! tinyagents path — and feeds per-call usage into the global cost tracker.
mod cap_pauser;
-mod compaction_log;
mod event_bridge;
mod event_projection;
mod graph_tracing;
diff --git a/crates/openhuman-core/src/agent/tinyagents/observability/cap_pauser_tests.rs b/crates/openhuman-core/src/agent/tinyagents/observability/cap_pauser_tests.rs
deleted file mode 100644
index 2572d5e6bf..0000000000
--- a/crates/openhuman-core/src/agent/tinyagents/observability/cap_pauser_tests.rs
+++ /dev/null
@@ -1,208 +0,0 @@
-use super::*;
-
-use std::time::Duration;
-
-use async_trait::async_trait;
-use tinyagents_harness::context::{RunConfig, RunContext};
-use tinyagents_harness::error::Result as TaResult;
-use tinyagents_harness::events::EventSink;
-use tinyagents_harness::middleware::{AgentRun, Middleware, ToolInvocationIdentity};
-use tinyagents_harness::runtime::{AgentHarness, RunPolicy};
-use tinyagents_harness::steering::SteeringPolicy;
-use tinyagents_harness::testkit::{FakeTool, ScriptedModel, SlowModel};
-use tinyagents_orchestration::subagent::SubAgent;
-use tinyinference_llm::message::{AssistantMessage, Message};
-use tinyinference_llm::model::{ChatModel, ModelResponse};
-use tinyinference_llm::tool::ToolCall;
-use tinytools::ToolResult;
-
-const CAP: usize = 3;
-
-fn tool_call_response(id: &str) -> ModelResponse {
- ModelResponse {
- message: AssistantMessage {
- id: Some(format!("msg-{id}")),
- content: Vec::new(),
- tool_calls: vec![ToolCall::new(id, "lookup", serde_json::json!({}))],
- usage: None,
- origin: None,
- },
- usage: None,
- finish_reason: Some("tool_calls".to_string()),
- raw: None,
- resolved_model: None,
- continue_turn: None,
- served_from_cache: false,
- correlation: None,
- resolved_route: None,
- }
-}
-
-fn child_harness(model: Arc<dyn ChatModel<()>>) -> Arc<AgentHarness<()>> {
- let mut child: AgentHarness<()> = AgentHarness::new();
- child
- .register_model("child", model)
- .set_default_model("child");
- Arc::new(child)
-}
-
-/// Drive a parent run capped at [`CAP`] model calls whose every tool result
-/// passes through `middleware`, with a [`CapPauser`] on the shared sink.
-async fn run_capped_parent(middleware: Arc<dyn Middleware<()>>) -> AgentRun {
- let mut harness: AgentHarness<()> = AgentHarness::new();
- let mut policy = RunPolicy::default();
- // Hard ceiling well above the cap, so only the pauser can stop the run.
- policy.limits.max_model_calls = 10 * CAP;
- policy.limits.max_tool_calls = 80 * CAP;
- harness.with_policy(policy);
- let replies = (1..=10 * CAP)
- .map(|i| tool_call_response(&format!("t{i}")))
- .collect();
- harness
- .register_model("parent", Arc::new(ScriptedModel::new(replies)))
- .set_default_model("parent");
- harness.register_tool(Arc::new(FakeTool::returning("lookup", "ok")));
- harness.push_middleware(middleware);
-
- let sink = EventSink::new();
- let handle = SteeringHandle::new(SteeringPolicy::allow_all());
- let ctx = RunContext::new(RunConfig::new("agent_turn"), ())
- .with_events(sink.clone())
- .with_steering(handle.clone());
- sink.subscribe(CapPauser::new(handle, CAP, ctx.run_id().as_str(), None));
-
- harness
- .invoke_in_context(&(), ctx, vec![Message::user("go")])
- .await
- .expect("run completes")
-}
-
-/// Runs a one-call nested sub-agent on the parent's sink after every tool, the
-/// way the payload summarizer does for an oversized result. The child is named
-/// after the parent run so its run id (`agent_turn-d1-N`) shares the parent's
-/// prefix — attribution must still tell the two apart.
-struct NestedRunAfterEveryTool;
-
-#[async_trait]
-impl Middleware<()> for NestedRunAfterEveryTool {
- fn name(&self) -> &str {
- "nested_run_after_every_tool"
- }
-
- async fn after_tool(
- &self,
- ctx: &mut RunContext<()>,
- _state: &(),
- _invocation: &ToolInvocationIdentity,
- _result: &mut ToolResult,
- ) -> TaResult<()> {
- let model: Arc<dyn ChatModel<()>> = Arc::new(ScriptedModel::replies(vec!["summary"]));
- SubAgent::new("agent_turn", "nested", child_harness(model))
- .invoke_with_events(&(), (), ctx.depth(), "summarize", &ctx.events)
- .await?;
- Ok(())
- }
-}
-
-/// Fans out two sibling sub-agents on the parent's sink after every tool and
-/// joins them. Each child's model sleeps before answering, so both runs are in
-/// flight at once and their events interleave on the shared sink.
-struct OverlappingNestedRunsAfterEveryTool;
-
-#[async_trait]
-impl Middleware<()> for OverlappingNestedRunsAfterEveryTool {
- fn name(&self) -> &str {
- "overlapping_nested_runs_after_every_tool"
- }
-
- async fn after_tool(
- &self,
- ctx: &mut RunContext<()>,
- _state: &(),
- _invocation: &ToolInvocationIdentity,
- _result: &mut ToolResult,
- ) -> TaResult<()> {
- let depth = ctx.depth();
- let events = ctx.events.clone();
- let slow = || -> Arc<dyn ChatModel<()>> {
- Arc::new(SlowModel::new(Duration::from_millis(20), "summary"))
- };
- let first = SubAgent::new("agent_turn", "nested", child_harness(slow()));
- let second = SubAgent::new("summarizer", "nested", child_harness(slow()));
- let (first, second) = futures::join!(
- first.invoke_with_events(&(), (), depth, "first", &events),
- second.invoke_with_events(&(), (), depth, "second", &events),
- );
- first?;
- second?;
- Ok(())
- }
-}
-
-#[tokio::test]
-async fn nested_runs_on_the_shared_sink_do_not_spend_the_parents_cap() {
- let run = run_capped_parent(Arc::new(NestedRunAfterEveryTool)).await;
-
- assert!(run.paused.is_some(), "the cap pauser must pause the run");
- assert_eq!(
- run.model_calls, CAP,
- "the pause must land after the run's OWN {CAP} model calls; a nested run's \
- completions on the shared sink must not count toward the parent's cap"
- );
-}
-
-#[tokio::test]
-async fn overlapping_sibling_runs_on_the_shared_sink_do_not_spend_the_parents_cap() {
- let run = run_capped_parent(Arc::new(OverlappingNestedRunsAfterEveryTool)).await;
-
- assert!(run.paused.is_some(), "the cap pauser must pause the run");
- assert_eq!(
- run.model_calls, CAP,
- "concurrent sibling sub-agents on the shared sink must not count toward the \
- parent's {CAP}-call cap"
- );
-}
-
-/// The agent loop awaits tool middleware, so inside one harness run a parent
-/// completion can only land between child completions when a child outlives the
-/// tool call that started it. Drive that interleaving directly on the listener,
-/// with the crate's id formats, so the order is exact rather than timing-bound.
-#[test]
-fn parent_completions_interleaved_with_active_children_pause_only_on_the_runs_own_cap() {
- let sink = EventSink::new();
- let handle = SteeringHandle::new(SteeringPolicy::allow_all());
- sink.subscribe(CapPauser::new(handle.clone(), CAP, "agent_turn", None));
- let complete = |call_id: &str| {
- sink.emit(AgentEvent::ModelCompleted {
- call_id: call_id.into(),
- started_at_ms: None,
- usage: None,
- input: None,
- output: None,
- });
- };
-
- for call_id in [
- "agent_turn-model-1",
- "agent_turn-d1-7-model-1",
- "summarizer-d1-8-model-1",
- "agent_turn-model-2",
- "agent_turn-d1-7-model-2",
- "summarizer-d2-9-model-1",
- "agent_turn-d1-7-model-3",
- ] {
- complete(call_id);
- }
- assert_eq!(
- handle.pending(),
- 0,
- "five nested completions interleaved with two of the run's own must not request a pause"
- );
-
- complete("agent_turn-model-3");
- assert_eq!(
- handle.pending(),
- 1,
- "the pause must be requested exactly when the run's own {CAP}rd model call completes"
- );
-}
diff --git a/crates/openhuman-core/src/agent/tinyagents/observability/compaction_log.rs b/crates/openhuman-core/src/agent/tinyagents/observability/compaction_log.rs
deleted file mode 100644
index 939c83f00d..0000000000
--- a/crates/openhuman-core/src/agent/tinyagents/observability/compaction_log.rs
+++ /dev/null
@@ -1,33 +0,0 @@
-//! Journal projection of `AgentEvent::Compacted`.
-
-use tinyagents_harness::events::AgentEvent;
-
-/// Logs a context compaction at info with its token savings and the
-/// summarizer call's latency and usage (grep `context compacted`).
-///
-/// A compaction rewrites what the model sees and spends a summarizer call
-/// outside the turn's own model calls, so it is worth seeing at the default
-/// log level, with that call's cost.
-pub(super) fn log_compacted(event: &AgentEvent) {
- let AgentEvent::Compacted {
- reason,
- tokens_before,
- tokens_after,
- usage,
- latency_ms,
- } = event
- else {
- return;
- };
- tracing::info!(
- reason = reason.as_str(),
- tokens_before,
- tokens_after,
- saved_tokens = tokens_before.saturating_sub(*tokens_after),
- latency_ms = ?latency_ms,
- summarizer_input_tokens = ?usage.map(|u| u.input_tokens),
- summarizer_output_tokens = ?usage.map(|u| u.output_tokens),
- summarizer_cached_tokens = ?usage.map(|u| u.cache_read_tokens),
- "[tinyagents] context compacted"
- );
-}
diff --git a/crates/openhuman-core/src/agent/tinyagents/observability/event_projection.rs b/crates/openhuman-core/src/agent/tinyagents/observability/event_projection.rs
index 6a8f4d5dba..744e57695e 100644
--- a/crates/openhuman-core/src/agent/tinyagents/observability/event_projection.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/observability/event_projection.rs
@@ -286,7 +286,7 @@ impl EventListener for OpenhumanEventBridge {
"[tinyagents] context compressed before model call"
);
}
- AgentEvent::Compacted { .. } => super::compaction_log::log_compacted(&record.event),
+ AgentEvent::Compacted { .. } => tinyagents_harness::events::log_compacted(&record.event),
AgentEvent::UnknownToolCall {
call_id,
requested_name,
diff --git a/crates/openhuman-core/src/agent/tinyagents/response_shape.rs b/crates/openhuman-core/src/agent/tinyagents/response_shape.rs
index 99d71d8582..192071e28f 100644
--- a/crates/openhuman-core/src/agent/tinyagents/response_shape.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/response_shape.rs
@@ -28,7 +28,7 @@ use crate::agent::tinyagents::host::OpenHumanRunContext;
#[derive(Clone, Default)]
pub struct ResponseShape {
/// Observer captured before the host dispatches to the core worker.
- pub observer: Option<Arc<super::turn_observer::ObserverScope>>,
+ pub observer: Option<Arc<tinyagents_harness::observability::turn_observer::ObserverScope>>,
/// Host validation of the original terminal text, before any repair.
pub validator: Option<Arc<dyn ResponseValidator>>,
/// Bounded number of output repair attempts.
@@ -161,7 +161,7 @@ pub async fn with_response_shape<F: std::future::Future>(
let observer = scope.shape.observer.clone();
let run = RESPONSE_SHAPE.scope(scope, Box::pin(fut));
match observer {
- Some(observer) => super::turn_observer::with_observer(observer, run).await,
+ Some(observer) => tinyagents_harness::observability::turn_observer::with_observer(observer, run).await,
None => run.await,
}
}
diff --git a/crates/openhuman-core/src/agent/tinyagents/turn_observer.rs b/crates/openhuman-core/src/agent/tinyagents/turn_observer.rs
deleted file mode 100644
index 8eb1eab81a..0000000000
--- a/crates/openhuman-core/src/agent/tinyagents/turn_observer.rs
+++ /dev/null
@@ -1,297 +0,0 @@
-//! Root-turn observer hooks. Scopes attach once during harness construction;
-//! payload capture is opt-in and raw errors/provider options are never exposed.
-use super::host::OpenHumanRunContext;
-use async_trait::async_trait;
-use serde_json::Value;
-use std::sync::{Arc, Mutex};
-use std::time::Instant;
-use tinyagents_harness::context::RunContext;
-use tinyagents_harness::events::{AgentEvent, EventListener, EventRecord, EventSink};
-use tinyagents_harness::middleware::{MiddlewareModelOutcome, ModelHandler, ModelMiddleware};
-use tinyagents_harness::runtime::AgentHarness;
-use tinyinference_llm::model::ModelRequest;
-
-/// Explicit consent for capturing model messages and tool input/output.
-#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
-pub enum TraceContent {
- /// Only identifiers, durations, token counts, costs, and success/failure.
- #[default]
- MetadataOnly,
- /// Include messages and tool payloads. Hosts own their retention policy.
- Include,
-}
-/// Provider-reported usage; absent costs remain unknown.
-#[derive(Clone, Debug, Default, PartialEq)]
-pub struct ObservedUsage {
- /// Prompt tokens.
- pub input_tokens: u64,
- /// Output tokens.
- pub output_tokens: u64,
- /// Cached prompt tokens.
- pub cached_tokens: u64,
- /// Reasoning tokens.
- pub reasoning_tokens: u64,
- /// Provider charge in USD, never a local estimate.
- pub cost_usd: Option<f64>,
-}
-/// A curated model/tool observation. No raw errors or arbitrary metadata.
-#[derive(Clone, Debug, PartialEq)]
-pub enum TurnObservation {
- /// One model pipeline returned, even if later answer validation rejects it.
- Model {
- /// Harness run identifier.
- run_id: String,
- /// Model call identifier when supplied by the harness.
- call_id: Option<String>,
- /// Requested model identifier.
- requested_model: Option<String>,
- /// Provider-reported actual answering model.
- answered_model: Option<String>,
- /// Provider finish reason.
- finish_reason: Option<String>,
- /// Wall-clock time in milliseconds.
- duration_ms: u64,
- /// Whether the pipeline failed.
- failed: bool,
- /// Provider usage.
- usage: Option<ObservedUsage>,
- /// Conversation messages, only with explicit capture consent.
- input: Option<Value>,
- /// Assistant message, only with explicit capture consent.
- output: Option<Value>,
- },
- /// A tool started or returned; `failed=None` denotes its start.
- Tool {
- /// Harness run identifier, once its start was observed.
- run_id: Option<String>,
- /// Call identifier, pairs start with completion.
- call_id: String,
- /// Tool name.
- name: String,
- /// Terminal failure status, never the raw error text.
- failed: Option<bool>,
- /// Terminal duration if available.
- duration_ms: Option<u64>,
- /// Arguments, only with explicit capture consent.
- input: Option<Value>,
- /// Result, only with explicit capture consent.
- output: Option<Value>,
- },
-}
-/// Synchronous, nonblocking host callback. Queue export work in the host.
-pub trait Observer: Send + Sync {
- /// Called once per observed model outcome or tool event.
- fn on_event(&self, event: &TurnObservation);
-}
-/// Observer and capture consent shared by one turn's harness.
-pub struct ObserverScope {
- observer: Arc<dyn Observer>,
- capture: TraceContent,
- run_id: Mutex<Option<String>>,
-}
-impl ObserverScope {
- /// Construct a turn-local observer scope.
- pub fn new(observer: Arc<dyn Observer>, capture: TraceContent) -> Arc<Self> {
- Arc::new(Self {
- observer,
- capture,
- run_id: Mutex::default(),
- })
- }
- /// Harness run identifier observed during this scope's dispatch.
- pub fn run_id(&self) -> Option<String> {
- self.run_id
- .lock()
- .unwrap_or_else(std::sync::PoisonError::into_inner)
- .clone()
- }
- fn payload(&self, value: &Option<Value>) -> Option<Value> {
- (self.capture == TraceContent::Include)
- .then(|| value.clone())
- .flatten()
- }
-}
-tokio::task_local! { static OBSERVER: Arc<ObserverScope>; }
-/// Capture the current scope before dispatch crosses a runtime/task boundary.
-pub fn current_scope() -> Option<Arc<ObserverScope>> {
- OBSERVER.try_with(Arc::clone).ok()
-}
-
-impl std::fmt::Debug for ObserverScope {
- fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
- f.debug_struct("ObserverScope")
- .field("capture", &self.capture)
- .finish_non_exhaustive()
- }
-}
-
-/// Scope an observation context around turn dispatch.
-pub async fn with_observer<F: std::future::Future>(
- scope: Arc<ObserverScope>,
- future: F,
-) -> F::Output {
- OBSERVER.scope(scope, Box::pin(future)).await
-}
-/// Attach to a root harness and its event stream if a host scoped an observer.
-pub(super) fn install(
- harness: &mut AgentHarness<(), OpenHumanRunContext>,
- events: &EventSink,
- root: bool,
-) {
- if !root {
- return;
- }
- if let Ok(scope) = OBSERVER.try_with(Arc::clone) {
- if scope.capture == TraceContent::Include {
- let mut policy = harness.policy().clone();
- policy.capture.tool_io = true;
- harness.with_policy(policy);
- }
- harness.push_model_middleware(scope.clone());
- events.subscribe(scope);
- }
-}
-impl EventListener for ObserverScope {
- fn on_event(&self, record: &EventRecord) {
- if let AgentEvent::RunStarted { run_id, .. } = &record.event {
- *self
- .run_id
- .lock()
- .unwrap_or_else(std::sync::PoisonError::into_inner) = Some(run_id.to_string());
- }
- let (call_id, name, failed, duration_ms, input, output) = match &record.event {
- AgentEvent::ToolStarted {
- call_id,
- tool_name,
- input,
- ..
- } => (call_id, tool_name, None, None, self.payload(input), None),
- AgentEvent::ToolCompleted {
- call_id,
- tool_name,
- error,
- duration_ms,
- input,
- output,
- ..
- } => (
- call_id,
- tool_name,
- Some(error.is_some()),
- *duration_ms,
- self.payload(input),
- self.payload(output),
- ),
- AgentEvent::ToolFailed {
- call_id,
- tool_name,
- duration_ms,
- ..
- } => (call_id, tool_name, Some(true), *duration_ms, None, None),
- // Deltas, errors, metadata, and custom events can contain payloads.
- _ => return,
- };
- self.observer.on_event(&TurnObservation::Tool {
- run_id: self.run_id(),
- call_id: call_id.to_string(),
- name: name.clone(),
- failed,
- duration_ms,
- input,
- output,
- });
- }
-}
-#[async_trait]
-impl ModelMiddleware<(), OpenHumanRunContext> for ObserverScope {
- fn name(&self) -> &str {
- "host_turn_observer"
- }
- async fn wrap_model(
- &self,
- ctx: &mut RunContext<OpenHumanRunContext>,
- state: &(),
- request: ModelRequest,
- next: ModelHandler<'_, (), OpenHumanRunContext>,
- ) -> tinyagents_harness::error::Result<MiddlewareModelOutcome> {
- let run_id = ctx.run_id().to_string();
- let call_id = request
- .correlation
- .as_ref()
- .map(|correlation| correlation.call_id.clone());
- let requested_model = request.model.clone();
- // Serialize messages only: provider_options may contain credentials.
- let input = (self.capture == TraceContent::Include)
- .then(|| serde_json::to_value(&request.messages).ok())
- .flatten();
- let started = Instant::now();
- let result = next.run(ctx, state, request).await;
- let response = match &result {
- Ok(MiddlewareModelOutcome::Response(response)) => Some(response),
- _ => None,
- };
- let raw = response.and_then(|response| response.raw.as_ref());
- let answered_model = raw
- .and_then(|raw| raw.get("model"))
- .and_then(Value::as_str)
- .map(str::to_string)
- .or_else(|| {
- response
- .and_then(|response| response.resolved_model.as_ref())
- .map(|model| model.name.clone())
- });
- let raw_cost = raw
- .and_then(|raw| raw.pointer("/usage/cost"))
- .and_then(Value::as_f64);
- let usage = response
- .and_then(|response| response.usage.as_ref())
- .map(|usage| ObservedUsage {
- input_tokens: usage.input_tokens,
- output_tokens: usage.output_tokens,
- cached_tokens: usage.cache_read_tokens,
- reasoning_tokens: usage.reasoning_tokens,
- cost_usd: usage
- .charged_amount
- .as_ref()
- .map(|amount| amount.micros as f64 / 1_000_000.0)
- .or(raw_cost),
- })
- .or_else(|| {
- raw_cost.map(|cost_usd| ObservedUsage {
- cost_usd: Some(cost_usd),
- ..ObservedUsage::default()
- })
- });
- let output = if self.capture == TraceContent::Include {
- response.and_then(|response| serde_json::to_value(&response.message).ok())
- } else {
- None
- };
- self.observer.on_event(&TurnObservation::Model {
- run_id,
- call_id,
- requested_model,
- answered_model,
- finish_reason: response.and_then(|response| response.finish_reason.clone()),
- duration_ms: started.elapsed().as_millis().min(u128::from(u64::MAX)) as u64,
- failed: result.is_err(),
- usage,
- input,
- output,
- });
- result
- }
-}
-/// Existing TinyAgents exporter; this module adds no transport implementation.
-///
-/// Traces go out as OTLP: build requests from [`TraceSpan`]s with
-/// [`otlp_requests`] and send them with `LangfuseClient::send_otlp`, the
-/// supported Langfuse trace path. `create_score` still posts scores to the
-/// batch API, which remains supported for scores.
-#[cfg(feature = "langfuse")]
-pub mod langfuse {
- pub use tinyagents_harness::observability::{
- trace_export::{otlp::otlp_requests, ExportBrand, SpanKind, SpanStatus, TraceSpan},
- LangfuseAuth, LangfuseClient, LangfuseScore, LangfuseScoreValue, LangfuseTraceConfig,
- };
-}
diff --git a/crates/openhuman-core/src/agent/tinyagents/turn_runner.rs b/crates/openhuman-core/src/agent/tinyagents/turn_runner.rs
index c00da12401..f5278bfb6d 100644
--- a/crates/openhuman-core/src/agent/tinyagents/turn_runner.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/turn_runner.rs
@@ -463,7 +463,7 @@ pub(super) async fn run_turn_via_tinyagents_body(
}
}
let sink = EventSink::with_stream_id(journal_run_id.as_str());
- super::turn_observer::install(&mut harness, &sink, hosted_root.is_some());
+ tinyagents_harness::observability::turn_observer::install(&mut harness, &sink, hosted_root.is_some());
let events = Some(sink);
// Attach the event bridge for EVERY turn — including an unobserved
// (`on_progress = None`) background/cron turn (#4467, item 3). The bridge's
diff --git a/crates/openhuman-embed/Cargo.toml b/crates/openhuman-embed/Cargo.toml
index 641227d0a5..2c58405d12 100644
--- a/crates/openhuman-embed/Cargo.toml
+++ b/crates/openhuman-embed/Cargo.toml
@@ -14,7 +14,7 @@ publish = false
result_large_err = "allow"
[features]
-langfuse = ["openhuman-core/langfuse"]
+langfuse = ["openhuman-core/langfuse", "tinyagents-harness/langfuse"]
# `channels` is in core's default set already; enabling it here too compiles
# the `Runtime::channels` facade in a default build.
default = ["openhuman-core/default", "channels", "modules"]
diff --git a/crates/openhuman-embed/src/observe.rs b/crates/openhuman-embed/src/observe.rs
index d7e41a3af3..124f46903a 100644
--- a/crates/openhuman-embed/src/observe.rs
+++ b/crates/openhuman-embed/src/observe.rs
@@ -1,8 +1,8 @@
//! Host turn callbacks with explicit payload consent. Callbacks should enqueue
//! telemetry work; transport and retention belong to the embedding application.
use crate::{CoreError, LastTurnUsage, TurnOutcome};
-use openhuman_core::agent::tinyagents::turn_observer::{self, Observer, ObserverScope};
-pub use openhuman_core::agent::tinyagents::turn_observer::{
+use tinyagents_harness::observability::turn_observer::{self, Observer, ObserverScope};
+pub use tinyagents_harness::observability::turn_observer::{
ObservedUsage, TraceContent, TurnObservation,
};
use std::sync::Arc;
@@ -113,5 +113,5 @@ where
/// Enable the `langfuse` feature. Export requires explicit host credentials.
#[cfg(feature = "langfuse")]
pub mod langfuse {
- pub use openhuman_core::agent::tinyagents::turn_observer::langfuse::*;
+ pub use tinyagents_harness::observability::turn_observer::langfuse::*;
}
diff --git a/crates/openhuman-embed/src/turn_control.rs b/crates/openhuman-embed/src/turn_control.rs
index eb80a94255..18fce43b4a 100644
--- a/crates/openhuman-embed/src/turn_control.rs
+++ b/crates/openhuman-embed/src/turn_control.rs
@@ -348,7 +348,7 @@ impl Turn {
structured_retries: self.structured_retries,
provider_options: self.provider_options.clone(),
require_tool_call: self.require_tool_call,
- observer: openhuman_core::agent::tinyagents::turn_observer::current_scope(),
+ observer: tinyagents_harness::observability::turn_observer::current_scope(),
},
),
untrusted_input: self.untrusted_input,
diff --git a/crates/openhuman-embed/tests/observed_turns.rs b/crates/openhuman-embed/tests/observed_turns.rs
index 031fa4c46f..2b63b23fd1 100644
--- a/crates/openhuman-embed/tests/observed_turns.rs
+++ b/crates/openhuman-embed/tests/observed_turns.rs
@@ -134,7 +134,7 @@ async fn dispatch_on_worker(
with_response_shape, ResponseShape, ResponseShapeScope,
};
let shape = ResponseShapeScope::new(ResponseShape {
- observer: openhuman_core::agent::tinyagents::turn_observer::current_scope(),
+ observer: tinyagents_harness::observability::turn_observer::current_scope(),
..ResponseShape::default()
});
tokio::spawn(with_response_shape(shape, turn.send()))