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
feat(tinyagents): add run context to harness assembly
Steven Enamakelef9b66933b48
diff --git a/crates/openhuman-core/src/agent/tinyagents/harness_assembly.rs b/crates/openhuman-core/src/agent/tinyagents/harness_assembly.rsindex 8346156332..e07d5a3045 100644--- a/crates/openhuman-core/src/agent/tinyagents/harness_assembly.rs+++ b/crates/openhuman-core/src/agent/tinyagents/harness_assembly.rs@@ -156,6 +156,9 @@ pub(super) fn assemble_turn_harness(// compaction summarizer recalls under it. `None` leaves compaction// memory-free.memory_turn: Option<Arc<crate::memory::lifecycle::hooks::MemoryTurn>>,+ // This turn's tool rules (`OpenHumanRunContext::tool_rules`): one rule set+ // the harness applies to the catalogue, `tool_search` and every call.+ tool_rules: Option<Arc<tinyagents_harness::tool::ToolRulePolicy>>,) -> AssembledTurnHarness {let mut harness: AgentHarness<(), OpenHumanRunContext> = AgentHarness::new();// Cross-route fallback ownership (issue #4249, Workstream 02.2): populate the@@ -181,6 +184,15 @@ pub(super) fn assemble_turn_harness(// `prompt-size`). Without this the harness appended a second copy of// both on every text-dialect call.policy.host_renders_tool_catalogue = true;+ if let Some(rules) = tool_rules.filter(|rules| !rules.is_permissive()) {+ tracing::debug!(+ model,+ layers = rules.rules.layers.len(),+ context = ?rules.context,+ "[tool_rules] turn harness carries tool rules"+ );+ policy.tool_rules = (*rules).clone();+ }tracing::debug!(model,?tool_dialect,diff --git a/crates/openhuman-core/src/agent/tinyagents/host/run_context.rs b/crates/openhuman-core/src/agent/tinyagents/host/run_context.rsindex 1efa5f1dc7..b0d05bbad7 100644--- a/crates/openhuman-core/src/agent/tinyagents/host/run_context.rs+++ b/crates/openhuman-core/src/agent/tinyagents/host/run_context.rs@@ -300,6 +300,13 @@ pub struct OpenHumanRunContext {/// harness keeps them off the wire, indexes them for search and still/// admits a call by name. Empty for every turn without such a list.pub(crate) deferred_tool_names: Arc<std::collections::HashSet<String>>,+ /// Tool rules for this turn (`crate::tools::rules`): the operator's and+ /// the agent definition's layers, evaluated in this turn's channel/agent+ /// context. Installed as the harness `RunPolicy::tool_rules`, which+ /// applies them to the catalogue, `tool_search` and every call. A child+ /// run inherits its parent's layers (see [`Self::child`]) and may only add+ /// to them. `None` restricts nothing.+ pub(crate) tool_rules: Option<Arc<tinyagents_harness::tool::ToolRulePolicy>>,/// Context middleware snapshot prepared for this exact turn.pub(crate) context_middleware: Option<TurnContextMiddleware>,/// Model/harness sidecars consumed only after a durable commit.@@ -363,6 +370,7 @@ impl OpenHumanRunContext {current_tools: None,current_synthesized_tools: None,deferred_tool_names: Arc::new(std::collections::HashSet::new()),+ tool_rules: None,context_middleware: None,session_sidecar: Arc::new(Mutex::new(SessionTurnSidecar::default())),required_output: None,diff --git a/crates/openhuman-core/src/agent/tinyagents/turn_runner.rs b/crates/openhuman-core/src/agent/tinyagents/turn_runner.rsindex ba7610064b..9b1ccc280b 100644--- a/crates/openhuman-core/src/agent/tinyagents/turn_runner.rs+++ b/crates/openhuman-core/src/agent/tinyagents/turn_runner.rs@@ -296,6 +296,7 @@ pub(super) async fn run_turn_via_tinyagents_body(),has_thread,run_context.memory_turn.clone(),+ run_context.tool_rules.clone(),);// Fail-closed registry validation gate (issue #4249, Workstream 10 — registry).