Skip to content

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

docs(openhuman-embed): document physical dispatch observer behavior

Steven Enamakelb1cac5854373
diff --git a/crates/openhuman-core/src/inference/host_runtime/ops/complete_once.rs b/crates/openhuman-core/src/inference/host_runtime/ops/complete_once.rs
index f44446c0c2..06049821aa 100644
--- a/crates/openhuman-core/src/inference/host_runtime/ops/complete_once.rs
+++ b/crates/openhuman-core/src/inference/host_runtime/ops/complete_once.rs
@@ -120,9 +120,8 @@ pub async fn complete_once_observed(
let model: std::sync::Arc<dyn ChatModel<()>> = match (budget, observer) {
(Some(budget), observer) => budget.wrap_with_observer(model, observer),
(None, Some(observer)) => {
- let normalized = std::sync::Arc::new(
- tinyagents_harness::cost::GatewayChargeModel::new(model),
- );
+ let normalized =
+ std::sync::Arc::new(tinyagents_harness::cost::GatewayChargeModel::new(model));
std::sync::Arc::new(
tinyagents_harness::observability::physical_dispatch::ObservedChatModel::new(
normalized, observer,
diff --git a/crates/openhuman-embed/README.md b/crates/openhuman-embed/README.md
index 3ec134f53c..dc1608304a 100644
--- a/crates/openhuman-embed/README.md
+++ b/crates/openhuman-embed/README.md
@@ -30,6 +30,16 @@ tools that spawn independent tasks or processes must provide their own cleanup;
MCP server lifecycles remain owned by the agent. Keep polling `send()` while
awaiting cancellation, for example in a spawned task.
+## Observing provider dispatches
+
+Attach `Completer::physical_observer` to receive one content-free terminal event
+for each admitted provider dispatch. Structured JSON repairs produce separate
+events, while request and response content remains private. With a model budget,
+the explicit and turn-scoped observers run inside admission and after gateway
+charge normalization, so they see the same authoritative amount the ledger
+settles. A budget refusal before dispatch creates no physical event. The
+existing `CompletionObserver` remains a once-per-logical-call callback.
+
## Steering one turn
Acquire `Turn::steering_handle()` before sending a turn to add messages to it
diff --git a/crates/openhuman-embed/src/complete.rs b/crates/openhuman-embed/src/complete.rs
index 7bb18e7a0a..0ca427ee30 100644
--- a/crates/openhuman-embed/src/complete.rs
+++ b/crates/openhuman-embed/src/complete.rs
@@ -507,10 +507,7 @@ impl Completer {
/// With a budget, the observer receives charge-normalized usage after
/// admission, matching the amount settled by the ledger. A refusal before
/// provider dispatch does not produce a physical-dispatch event.
- pub fn physical_observer(
- mut self,
- observer: Arc<dyn PhysicalDispatchObserver>,
- ) -> Self {
+ pub fn physical_observer(mut self, observer: Arc<dyn PhysicalDispatchObserver>) -> Self {
self.physical_observer = Some(observer);
self
}
diff --git a/crates/openhuman-embed/src/complete_tests.rs b/crates/openhuman-embed/src/complete_tests.rs
index 3709170d4d..af8d42be33 100644
--- a/crates/openhuman-embed/src/complete_tests.rs
+++ b/crates/openhuman-embed/src/complete_tests.rs
@@ -221,10 +221,7 @@ impl tinyagents_harness::observability::PhysicalDispatchObserver for PhysicalRec
struct TurnRecorder(Mutex<Vec<tinyagents_harness::observability::turn_observer::TurnObservation>>);
impl tinyagents_harness::observability::turn_observer::Observer for TurnRecorder {
- fn on_event(
- &self,
- event: &tinyagents_harness::observability::turn_observer::TurnObservation,
- ) {
+ fn on_event(&self, event: &tinyagents_harness::observability::turn_observer::TurnObservation) {
self.0.lock().unwrap().push(event.clone());
}
}
@@ -262,7 +259,7 @@ async fn physical_observer_reports_content_free_provider_outcome() {
#[tokio::test]
async fn physical_observer_sees_the_buyer_charge_settled_by_the_budget() {
use tinyagents_harness::observability::turn_observer::{
- ObserverScope, TraceContent, TurnObservation, with_observer,
+ with_observer, ObserverScope, TraceContent, TurnObservation,
};
let mut reply = body("hi", "stop");