The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
refactor(subagent_host): replace role contract with shared subagent framing
Steven Enamakel3bc9287e0f9d
diff --git a/crates/openhuman-core/src/agent/subagent_host/mod.rs b/crates/openhuman-core/src/agent/subagent_host/mod.rsindex e4d0842b99..1bfe51478b 100644--- a/crates/openhuman-core/src/agent/subagent_host/mod.rs+++ b/crates/openhuman-core/src/agent/subagent_host/mod.rs@@ -75,4 +75,4 @@ pub use types::{SubagentRunStatus, SubagentUsage,};-pub(crate) use ops::{append_subagent_role_contract, resolve_subagent_source};+pub(crate) use ops::resolve_subagent_source;diff --git a/crates/openhuman-core/src/agent/subagent_host/ops/mod.rs b/crates/openhuman-core/src/agent/subagent_host/ops/mod.rsindex 9462ebd2ba..86057dbdc0 100644--- a/crates/openhuman-core/src/agent/subagent_host/ops/mod.rs+++ b/crates/openhuman-core/src/agent/subagent_host/ops/mod.rs@@ -12,7 +12,7 @@//! | File | Contents |//! | ------------------- | -------------------------------------------------------------- |//! | `provider.rs` | `resolve_subagent_source`, `user_is_signed_in_to_composio` |-//! | `prompt.rs` | Role-contract suffix, `append_subagent_role_contract`, `dedup_tool_specs_by_name` |+//! | `prompt.rs` | Artifact-offload contract and tool-spec deduplication |//! | `runner.rs` | `run_subagent`, `run_typed_mode` |//! | `graph.rs` | `run_subagent_via_graph` — the sub-agent turn graph + tools |//! | `checkpoint.rs` | `SubagentCheckpoint` — cap-hit summary |@@ -32,7 +32,6 @@ mod runner;// execution leaf after a neutral driver has prepared and admitted a request.pub(crate) use runner::run_subagent_direct;-pub(crate) use prompt::append_subagent_role_contract;pub(crate) use provider::resolve_subagent_source;// Re-exports for test companion modules that use `use super::*`.diff --git a/crates/openhuman-core/src/agent/subagent_host/ops/prompt_tests.rs b/crates/openhuman-core/src/agent/subagent_host/ops/prompt_tests.rsindex c0499f3f32..4563e55b7b 100644--- a/crates/openhuman-core/src/agent/subagent_host/ops/prompt_tests.rs+++ b/crates/openhuman-core/src/agent/subagent_host/ops/prompt_tests.rs@@ -1,8 +1 @@use super::*;--#[test]-fn other_agents_get_role_contract_suffix() {- let out = append_subagent_role_contract("body".to_string(), "researcher");- assert!(out.contains("Sub-agent Result Contract"));- assert!(out.contains("Recommended next step"));-}diff --git a/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs b/crates/openhuman-core/src/agent/subagent_host/ops/runner.rsindex 7989a0dbe1..98a65b9b3e 100644--- a/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs+++ b/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs@@ -27,6 +27,7 @@ use tinyagents_definition::{validate_tier_transition, AgentTier, IterationPolicy, PromptSource,SandboxMode as AgentSandboxMode,};+use tinyagents_orchestration::subagent::{subagent_framing, SubagentRole};use tinyagents_harness::artifacts::{effective_offload_threshold, extract_artifact_paths, note_artifact_handoff,DEFAULT_OFFLOAD_THRESHOLD_BYTES, HANDOFF_STAGE_RECORDED,@@ -36,7 +37,7 @@ use tinytools::{SandboxMode as TinyagentsSandboxMode, ToolSpec, WorkspaceDescripuse tinytools_std::file_state::with_file_state_agent_id;use super::prompt::{- append_artifact_offload_contract, append_subagent_role_contract, dedup_tool_specs_by_name,+ append_artifact_offload_contract, dedup_tool_specs_by_name,};use super::provider::resolve_subagent_source;@@ -802,7 +803,8 @@ async fn run_typed_mode(}};- let system_prompt = append_subagent_role_contract(system_prompt, &definition.id);+ let framing = subagent_framing(SubagentRole::Leaf, options.run_context.spawn_depth, task_prompt);+ let system_prompt = format!("{}\n\n{framing}", system_prompt.trim_end());// #3883: only agents that actually hold a file-write tool are told to// offload. `visible_tool_names` is this sub-agent's real, post-filter tool// surface, so the contract can never advertise a tool the child cannot call.diff --git a/crates/openhuman-core/src/agent/subagent_host/ops_tests_slug_filter_typed_mode_tests.rs b/crates/openhuman-core/src/agent/subagent_host/ops_tests_slug_filter_typed_mode_tests.rsindex 0e549808c7..1aa79dd240 100644--- a/crates/openhuman-core/src/agent/subagent_host/ops_tests_slug_filter_typed_mode_tests.rs+++ b/crates/openhuman-core/src/agent/subagent_host/ops_tests_slug_filter_typed_mode_tests.rs@@ -73,25 +73,6 @@ fn subagent_mode_as_str_roundtrip() {assert_eq!(SubagentMode::Typed.as_str(), "typed");}-#[test]-fn append_subagent_role_contract_adds_role_and_brevity_rules() {- let rendered = append_subagent_role_contract("base prompt".to_string(), "researcher");- assert!(rendered.contains("## Sub-agent Role Contract"));- assert!(rendered.contains("You are a sub-agent working for a parent OpenHuman agent"));- assert!(rendered.contains("Keep your final response concise and synthesis-ready"));- assert!(rendered.contains("## Sub-agent Result Contract"));- assert!(rendered.contains("Evidence used"));- assert!(rendered.contains("Do not include facts in Answer that are not supported"));- assert!(rendered.contains("truncated, partial, or too large"));-}--#[test]-fn append_subagent_role_contract_is_idempotent() {- let once = append_subagent_role_contract("base prompt".to_string(), "researcher");- let twice = append_subagent_role_contract(once.clone(), "researcher");- assert_eq!(once, twice, "contract suffix should only appear once");-}-#[tokio::test]async fn typed_mode_injects_current_date_and_time_into_user_message() {let provider = ScriptedProvider::new(vec![text_response("ok")]);