Skip to content

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

refactor(agent): move ParentExecutionContext into subagent_host

Steven Enamakelf5957b4ef6c8
diff --git a/crates/openhuman-core/src/agent/README.md b/crates/openhuman-core/src/agent/README.md
index c981a83729..fca6624a94 100644
--- a/crates/openhuman-core/src/agent/README.md
+++ b/crates/openhuman-core/src/agent/README.md
@@ -187,7 +187,7 @@ target `AgentDefinition` and call `subagent_host::run_subagent_with_parent`.
| tool call: spawn_subagent { agent_id, prompt }
v
orchestration/tools/spawn_subagent.rs
- | read ParentExecutionContext (run context `parent`, harness/fork_context.rs)
+ | read ParentExecutionContext (run context `parent`, subagent_host/fork_context.rs)
v
subagent_host::run_subagent_with_parent
| resolve definition, model, narrowed tools, narrowed prompt,
@@ -345,7 +345,7 @@ Persistence, setup and RPC:
deltas, cost updates and the `Subagent*` family.
- `AgentDefinition`, `AgentDefinitionRegistry`, `ToolScope`, `SandboxMode`
(`../agent_registry/host_definition.rs` + `tinyagents-definition`): what an agent is.
-- `ParentExecutionContext` ([`harness/fork_context.rs`](./harness/fork_context.rs)): explicit parent
+- `ParentExecutionContext` ([`subagent_host/fork_context.rs`](./subagent_host/fork_context.rs)): explicit parent
state a sub-agent reads from the run context (`parent`); `triage::parent_context::build_root_parent`
builds one for runs with no parent turn.
- `run_subagent`, `run_subagent_with_parent`, `SubagentRunOptions`
diff --git a/crates/openhuman-core/src/agent/orchestration/tools.rs b/crates/openhuman-core/src/agent/orchestration/tools.rs
index 8818001cd1..36dd250ee1 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools.rs
@@ -19,7 +19,7 @@ mod tools_e2e_tests;
#[cfg(test)]
pub(crate) fn live_parent_run_context(
kind: &str,
- parent: crate::agent::harness::ParentExecutionContext,
+ parent: crate::agent::subagent_host::ParentExecutionContext,
) -> tinyagents_harness::context::RunContext<crate::agent::tinyagents::host::OpenHumanRunContext> {
crate::agent::tinyagents::host::OpenHumanRunContext::new()
.with_host_env(&parent.host_env)
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_async_tests.rs b/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_async_tests.rs
index 85ddb23173..2b9e55d274 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_async_tests.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_async_tests.rs
@@ -1,5 +1,5 @@
use super::*;
-use crate::agent::harness::fork_context::ParentExecutionContext;
+use crate::agent::subagent_host::ParentExecutionContext;
use crate::agent_registry::host_definition::AgentDefinitionRegistry;
use crate::config::AgentConfig;
use std::collections::HashSet;
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_surface.rs b/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_surface.rs
index 81492d21a8..c48b59b196 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_surface.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_surface.rs
@@ -328,7 +328,7 @@ impl SpawnSubagentTool {
args: serde_json::Value,
options: ToolCallOptions,
tool_context: Option<&dyn ToolRunContext>,
- parent: crate::agent::harness::ParentExecutionContext,
+ parent: crate::agent::subagent_host::ParentExecutionContext,
) -> anyhow::Result<ToolResult> {
let live_parent = super::live_parent_run_context("direct-async-subagent", parent);
let detached_parent =
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_continuation_tests.rs b/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_continuation_tests.rs
index c72461c0c2..c16f63c821 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_continuation_tests.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_continuation_tests.rs
@@ -581,7 +581,7 @@ impl tinyinference_llm::model::ChatModel<()> for TwoTurnModel {
pub(super) fn core_backed_live_parent(
workspace: &std::path::Path,
- parent: crate::agent::harness::ParentExecutionContext,
+ parent: crate::agent::subagent_host::ParentExecutionContext,
session_id: &str,
thread_id: &str,
) -> (
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_tests.rs b/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_tests.rs
index 0b8e9669e6..6e46be695f 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_tests.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_tests.rs
@@ -1,5 +1,5 @@
use super::*;
-use crate::agent::harness::ParentExecutionContext;
+use crate::agent::subagent_host::ParentExecutionContext;
use crate::agent_registry::host_definition::AgentDefinitionRegistry;
use crate::integrations::ConnectedIntegration;
use async_trait::async_trait;
diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session/parent_snapshot.rs b/crates/openhuman-core/src/agent/session_host/runtime_session/parent_snapshot.rs
index 7ecd369909..356c2e10ad 100644
--- a/crates/openhuman-core/src/agent/session_host/runtime_session/parent_snapshot.rs
+++ b/crates/openhuman-core/src/agent/session_host/runtime_session/parent_snapshot.rs
@@ -8,8 +8,8 @@ impl OpenHumanTurnPrelude {
/// descriptor takes precedence over the session's own.
pub(in crate::agent::session_host) fn parent_context(
&self,
- inherited: Option<&crate::agent::harness::ParentExecutionContext>,
- ) -> crate::agent::harness::ParentExecutionContext {
+ inherited: Option<&crate::agent::subagent_host::ParentExecutionContext>,
+ ) -> crate::agent::subagent_host::ParentExecutionContext {
let surface = self
.tool_surface
.lock()
@@ -25,7 +25,7 @@ impl OpenHumanTurnPrelude {
mutable.connected_integrations.clone(),
)
};
- crate::agent::harness::ParentExecutionContext {
+ crate::agent::subagent_host::ParentExecutionContext {
agent_definition_id: self.agent_definition_id.clone(),
allowed_subagent_ids: self.allowed_subagent_ids.clone(),
turn_model_source: self.turn_model_source.clone(),
diff --git a/crates/openhuman-core/src/agent/subagent_host/lifecycle_storage_adoption_tests.rs b/crates/openhuman-core/src/agent/subagent_host/lifecycle_storage_adoption_tests.rs
index 52183262de..8be70193e6 100644
--- a/crates/openhuman-core/src/agent/subagent_host/lifecycle_storage_adoption_tests.rs
+++ b/crates/openhuman-core/src/agent/subagent_host/lifecycle_storage_adoption_tests.rs
@@ -167,7 +167,7 @@ fn owner_file_pause_is_imported_and_the_original_bytes_stay_unchanged() {
#[tokio::test]
async fn a_detached_driver_uses_its_carried_actor_for_lifecycle_commits() {
- use crate::agent::harness::fork_context::ParentExecutionContext;
+ use crate::agent::subagent_host::ParentExecutionContext;
use crate::agent::tinyagents::host::OpenHumanRunContext;
use std::sync::Arc;
use tinyagents_harness::context::{RunConfig, RunContext};
diff --git a/crates/openhuman-core/src/agent/subagent_host/ops/mod.rs b/crates/openhuman-core/src/agent/subagent_host/ops/mod.rs
index 7b60a9c2c4..5fbf4113bf 100644
--- a/crates/openhuman-core/src/agent/subagent_host/ops/mod.rs
+++ b/crates/openhuman-core/src/agent/subagent_host/ops/mod.rs
@@ -44,7 +44,7 @@ pub(super) use super::tool_prep::filter_tool_indices;
#[cfg(test)]
pub(super) use super::types::{SubagentMode, SubagentRunError, SubagentRunOptions};
#[cfg(test)]
-pub(super) use crate::agent::harness::fork_context::ParentExecutionContext;
+pub(super) use crate::agent::subagent_host::ParentExecutionContext;
#[cfg(test)]
pub(super) use crate::agent::tinyagents::budget::MAX_SPAWN_DEPTH;
#[cfg(test)]
diff --git a/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs b/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs
index 0889616897..c0ad4faf96 100644
--- a/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs
+++ b/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs
@@ -9,7 +9,7 @@
use std::collections::HashSet;
use std::time::Instant;
-use crate::agent::harness::fork_context::ParentExecutionContext;
+use crate::agent::subagent_host::ParentExecutionContext;
use crate::agent::prompts::render_subagent_system_prompt_with_format;
use crate::agent::prompts::{PromptContext, SubagentRenderOptions};
use crate::agent::session_host::dedup_visible_tool_specs;
diff --git a/crates/openhuman-core/src/agent/tinyagents/host/run_context.rs b/crates/openhuman-core/src/agent/tinyagents/host/run_context.rs
index 3adce68112..02b8dd3dc0 100644
--- a/crates/openhuman-core/src/agent/tinyagents/host/run_context.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/host/run_context.rs
@@ -14,7 +14,7 @@ use std::time::Duration;
use tokio::sync::mpsc::Sender;
-use crate::agent::harness::fork_context::{AgentContextPreparedSource, ParentExecutionContext};
+use crate::agent::subagent_host::{AgentContextPreparedSource, ParentExecutionContext};
use crate::agent::subagent_host::SubagentUsage;
use crate::agent::tinyagents::{
middleware::turn_context::TurnContextMiddleware, turn_policy::ToolPolicyEnforcement,
diff --git a/crates/openhuman-core/src/agent/tools/todo.rs b/crates/openhuman-core/src/agent/tools/todo.rs
index 5c4211df68..e02cc64a70 100644
--- a/crates/openhuman-core/src/agent/tools/todo.rs
+++ b/crates/openhuman-core/src/agent/tools/todo.rs
@@ -17,7 +17,7 @@
//! (see [`current_scope`] / [`legacy_session_key`]) so an in-flight list isn't
//! dropped by the rekey.
-use crate::agent::harness::fork_context::ParentExecutionContext;
+use crate::agent::subagent_host::ParentExecutionContext;
use async_trait::async_trait;
use std::path::PathBuf;
use std::sync::Arc;
diff --git a/crates/openhuman-core/src/skills/README.md b/crates/openhuman-core/src/skills/README.md
index 50df584425..1bcf892979 100644
--- a/crates/openhuman-core/src/skills/README.md
+++ b/crates/openhuman-core/src/skills/README.md
@@ -228,7 +228,7 @@ rather than re-implementing it:
Other owners: the orchestrator prompt renders the catalog
(`agent_registry/agents/orchestrator/prompt.rs`), channel turns render their
own skills list (`agent/context/channels_prompt.rs`), fork context carries the
-parent's skill list to sub-agents (`agent/harness/fork_context.rs`), and the
+parent's skill list to sub-agents (`agent/subagent_host/fork_context.rs`), and the
flows domain contributes `Flow`-scope entries (`flows/catalogue.rs`).
## Gotchas
diff --git a/crates/openhuman-core/src/triage/escalation.rs b/crates/openhuman-core/src/triage/escalation.rs
index 7c2e78eeba..10f5abdb63 100644
--- a/crates/openhuman-core/src/triage/escalation.rs
+++ b/crates/openhuman-core/src/triage/escalation.rs
@@ -17,7 +17,7 @@ use crate::core::runtime::DispatchCtx;
use anyhow::{anyhow, Context};
use super::parent_context::build_root_parent;
-use crate::agent::harness::fork_context::ParentExecutionContext;
+use crate::agent::subagent_host::ParentExecutionContext;
use crate::agent_registry::host_definition::AgentDefinitionRegistry;
use crate::config::Config;
diff --git a/crates/openhuman-core/src/triage/parent_context.rs b/crates/openhuman-core/src/triage/parent_context.rs
index f12c63d36b..5a80d73e68 100644
--- a/crates/openhuman-core/src/triage/parent_context.rs
+++ b/crates/openhuman-core/src/triage/parent_context.rs
@@ -10,7 +10,7 @@ use std::sync::Arc;
use anyhow::{Context, Result};
-use crate::agent::harness::fork_context::ParentExecutionContext;
+use crate::agent::subagent_host::ParentExecutionContext;
use crate::agent::OpenHumanSessionHost;
use crate::config::Config;
diff --git a/tests/composio_list_tools_stack_overflow_regression.rs b/tests/composio_list_tools_stack_overflow_regression.rs
index e2070e006e..db369be0dd 100644
--- a/tests/composio_list_tools_stack_overflow_regression.rs
+++ b/tests/composio_list_tools_stack_overflow_regression.rs
@@ -108,7 +108,7 @@
#![cfg(not(coverage))]
use async_trait::async_trait;
-use openhuman_core::agent::harness::ParentExecutionContext;
+use openhuman_core::agent::subagent_host::ParentExecutionContext;
use openhuman_core::agent::subagent_host::{OpenHumanSubagentHost, SubagentRunOptions};
use openhuman_core::agent_registry::host_definition::AgentDefinitionRegistry;
use openhuman_core::config::AgentConfig;
diff --git a/tests/in_process/calendar_grounding_e2e.rs b/tests/in_process/calendar_grounding_e2e.rs
index ba406aae43..59810afe2e 100644
--- a/tests/in_process/calendar_grounding_e2e.rs
+++ b/tests/in_process/calendar_grounding_e2e.rs
@@ -166,7 +166,7 @@ async fn test_subagent_has_current_date_context() -> Result<()> {
let _ =
openhuman_core::agent_registry::host_definition::AgentDefinitionRegistry::init_global_builtins();
- let parent = openhuman_core::agent::harness::ParentExecutionContext {
+ let parent = openhuman_core::agent::subagent_host::ParentExecutionContext {
agent_definition_id: "orchestrator".into(),
allowed_subagent_ids: ["summarizer".to_string()].into_iter().collect(),
turn_model_source: openhuman_core::agent::tinyagents::TurnModelSource::from_model(model),