Skip to content

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

feat(agent): add handler for context breakdown

Steven Enamakelac0740231c9b
diff --git a/crates/openhuman-core/src/agent/schemas.rs b/crates/openhuman-core/src/agent/schemas.rs
index 0a23e6558a..ca709225db 100644
--- a/crates/openhuman-core/src/agent/schemas.rs
+++ b/crates/openhuman-core/src/agent/schemas.rs
@@ -683,6 +683,15 @@ fn handle_registry_snapshot(_params: Map<String, Value>) -> ControllerFuture {
})
}
+fn handle_context_breakdown(params: Map<String, Value>) -> ControllerFuture {
+ Box::pin(async move {
+ let p = deserialize_params::<crate::agent::context_breakdown::ContextBreakdownParams>(
+ params,
+ )?;
+ to_json(crate::agent::context_breakdown::context_breakdown(p).await?)
+ })
+}
+
fn deserialize_params<T: DeserializeOwned>(params: Map<String, Value>) -> Result<T, String> {
serde_json::from_value(Value::Object(params)).map_err(|e| format!("invalid params: {e}"))
}