Skip to content

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

feat(subagent-host): report agent tier in subagent outcomes

Steven Enamakel01a91e91a999
diff --git a/crates/openhuman-core/src/agent/subagent_host/lifecycle_outcome.rs b/crates/openhuman-core/src/agent/subagent_host/lifecycle_outcome.rs
index 6c5f26356f..b4ada052f5 100644
--- a/crates/openhuman-core/src/agent/subagent_host/lifecycle_outcome.rs
+++ b/crates/openhuman-core/src/agent/subagent_host/lifecycle_outcome.rs
@@ -13,6 +13,10 @@ pub(super) fn host_outcome_to_neutral(
let usage_cost = outcome.usage.cost();
let mut extensions = std::collections::BTreeMap::from_iter([
("agent_id".into(), serde_json::json!(definition.id)),
+ (
+ "tier".into(),
+ serde_json::json!(definition.agent_tier.as_str()),
+ ),
(
"worker_thread_id".into(),
serde_json::json!(options.worker_thread_id),
@@ -75,7 +79,7 @@ pub(super) fn host_outcome_to_neutral(
SubagentOutcome {
task_id: outcome.task_id,
worker_thread_id: options.worker_thread_id.clone(),
- tier: None,
+ tier: Some(definition.agent_tier.as_str().to_owned()),
model_override: options.model_override.clone(),
cost_usd: usage_cost.usd(),
cost_source: Some(usage_cost.source),
diff --git a/crates/openhuman-embed/src/runtime/seams_tests.rs b/crates/openhuman-embed/src/runtime/seams_tests.rs
index d53f3dc396..0c2cfeb7c2 100644
--- a/crates/openhuman-embed/src/runtime/seams_tests.rs
+++ b/crates/openhuman-embed/src/runtime/seams_tests.rs
@@ -33,7 +33,7 @@ impl LearningSink for NamedPostTurn {
fn name(&self) -> &str {
self.0
}
- async fn on_turn_complete(&self, _ctx: &TurnContextTurnSummary) -> anyhow::Result<()> {
+ async fn on_turn_complete(&self, _ctx: &TurnSummary) -> anyhow::Result<()> {
Ok(())
}
}
diff --git a/crates/openhuman-embed/tests/runtime_observation.rs b/crates/openhuman-embed/tests/runtime_observation.rs
index 11f758cde3..add4d0a2da 100644
--- a/crates/openhuman-embed/tests/runtime_observation.rs
+++ b/crates/openhuman-embed/tests/runtime_observation.rs
@@ -2,7 +2,7 @@
mod common;
use async_trait::async_trait;
use openhuman_embed::providers::{ChatModel, ModelRequest, ModelResponse};
-use openhuman_embed::seams::{LearningSink, TurnContext};
+use openhuman_embed::seams::{LearningSink, TurnSummary};
use openhuman_embed::{
Access, AgentDefinitionSpec, AgentSpec, InMemorySessionStores, ModelDefaults, Provider,
Runtime, RuntimeEventKind, SessionStoreProvider, StreamEvent,
@@ -33,7 +33,7 @@ impl LearningSink for Hook {
fn name(&self) -> &str {
self.name
}
- async fn on_turn_complete(&self, ctx: &TurnContextTurnSummary) -> anyhow::Result<()> {
+ async fn on_turn_complete(&self, ctx: &TurnSummary) -> anyhow::Result<()> {
self.seen.send(ctx.agent_id.clone().unwrap_or_default())?;
Ok(())
}
diff --git a/crates/openhuman-embed/tests/scoped_hooks.rs b/crates/openhuman-embed/tests/scoped_hooks.rs
index 36007c1431..c2b00b9145 100644
--- a/crates/openhuman-embed/tests/scoped_hooks.rs
+++ b/crates/openhuman-embed/tests/scoped_hooks.rs
@@ -9,7 +9,7 @@ use common::{
chat_completion, eventually, offline_config, route, runtime, scripted_provider, stub_backend,
tool_call_completion,
};
-use openhuman_embed::seams::{LearningSink, ToolHook, ToolHookContext, TurnContext};
+use openhuman_embed::seams::{LearningSink, OpenHumanRunContext, ToolHook, ToolHookContext, TurnSummary};
use openhuman_embed::{
AgentDefinitionSpec, AgentSpec, HostTurnTools, Runtime, Tool, ToolScopeSpec, Workspace,
};
@@ -69,7 +69,7 @@ impl LearningSink for Observer {
fn name(&self) -> &str {
"same-policy-name"
}
- async fn on_turn_complete(&self, ctx: &TurnContextTurnSummary) -> anyhow::Result<()> {
+ async fn on_turn_complete(&self, ctx: &TurnSummary) -> anyhow::Result<()> {
assert!(ctx.session_id.is_some());
assert!(ctx.agent_id.is_some());
self.record("turn", ctx.user_message.lines().last().unwrap());