Skip to content

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

feat(subagent): share in-flight state across driver bundles

Steven Enamakel005364c4a1fa
diff --git a/crates/openhuman-core/src/agent/subagent_host/lifecycle.rs b/crates/openhuman-core/src/agent/subagent_host/lifecycle.rs
index 9b6da94120..3728d8bbc9 100644
--- a/crates/openhuman-core/src/agent/subagent_host/lifecycle.rs
+++ b/crates/openhuman-core/src/agent/subagent_host/lifecycle.rs
@@ -396,7 +396,10 @@ async fn invoke_driver_tool_with_request(
.unwrap_or_else(|| PathBuf::from(".openhuman/subagent_checkpoints"))
}),
);
- let bundle = OpenHumanDriverBundle::new(checkpoint_dir)?;
+ let bundle = OpenHumanDriverBundle::with_in_flight(
+ checkpoint_dir.clone(),
+ shared_subagent_flight(&parent.data.dispatch_ctx(), &checkpoint_dir),
+ )?;
let request_host = host_request.clone();
let request_task_id = task_id.clone();
let request_continuation = continuation;
diff --git a/crates/openhuman-core/src/agent/subagent_host/lifecycle/driver_adapter.rs b/crates/openhuman-core/src/agent/subagent_host/lifecycle/driver_adapter.rs
index 338230cee1..d4f5811e9e 100644
--- a/crates/openhuman-core/src/agent/subagent_host/lifecycle/driver_adapter.rs
+++ b/crates/openhuman-core/src/agent/subagent_host/lifecycle/driver_adapter.rs
@@ -11,6 +11,16 @@ pub(crate) struct OpenHumanDriverBundle {
impl OpenHumanDriverBundle {
pub(crate) fn new(checkpoint_dir: PathBuf) -> Result<Self, SubagentRunError> {
+ Self::with_in_flight(
+ checkpoint_dir,
+ tinyagents_orchestration::subagent::SubagentInFlight::default(),
+ )
+ }
+
+ pub(crate) fn with_in_flight(
+ checkpoint_dir: PathBuf,
+ in_flight: tinyagents_orchestration::subagent::SubagentInFlight,
+ ) -> Result<Self, SubagentRunError> {
let failures = Arc::new(Mutex::new(HashMap::new()));
let host_outcome = Arc::new(Mutex::new(HashMap::new()));
let configured_tool_result = Arc::new(Mutex::new(HashMap::new()));
@@ -36,7 +46,8 @@ impl OpenHumanDriverBundle {
executor: Some(executor),
persistence: Some(lifecycle_persistence),
})
- .map_err(map_lifecycle_error)?,
+ .map_err(map_lifecycle_error)?
+ .with_shared_in_flight(in_flight),
);
Ok(Self {
driver,