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
fix(agent): pin harness tool dialect to the session prompt's format
Steven Enamakel52dad812e2c9
diff --git a/crates/openhuman-core/src/agent/prompts/types.rs b/crates/openhuman-core/src/agent/prompts/types.rsindex 0a5fd938a0..234b959ddb 100644--- a/crates/openhuman-core/src/agent/prompts/types.rs+++ b/crates/openhuman-core/src/agent/prompts/types.rs@@ -300,6 +300,23 @@ pub enum ToolCallFormat {}impl ToolCallFormat {+ /// The harness policy that speaks this format.+ ///+ /// `Native` maps to `Auto` rather than forcing native: the session only+ /// picks it when the provider profile supports native tools, and `Auto`+ /// resolves to the same thing while still letting the harness fall back+ /// for a model that turns out not to.+ pub(crate) fn harness_dispatcher(self) -> tinyagents_harness::config::ToolDispatcher {+ use tinyagents_harness::config::ToolDispatcher;+ match self {+ ToolCallFormat::PFormat => ToolDispatcher::Pformat,+ ToolCallFormat::Json => ToolDispatcher::Xml,+ ToolCallFormat::Native => ToolDispatcher::Auto,+ ToolCallFormat::Python => ToolDispatcher::Python,+ ToolCallFormat::TypeScript => ToolDispatcher::Typescript,+ }+ }+/// The code style behind a code-call format, `None` for the others.pub(crate) fn code_style(self) -> Option<tinytools_agent::dialect::CodeStyle> {match self {diff --git a/crates/openhuman-core/src/agent/session_host/driver.rs b/crates/openhuman-core/src/agent/session_host/driver.rsindex 588ea117c3..6acc8ec0b7 100644--- a/crates/openhuman-core/src/agent/session_host/driver.rs+++ b/crates/openhuman-core/src/agent/session_host/driver.rs@@ -178,7 +178,13 @@ impl SessionDriver<OpenHumanRunContext> for OpenHumanSessionDriver {.map(|spec| spec.name.clone()).collect();ensure_snapshot_tools_are_executable(&visible_tool_names, &tools, &synthesized_tools)?;- let run_context = request.run_context.data.clone();+ // The harness must speak the dialect this session's prompt was+ // composed for: a text dialect strips schemas off the wire and needs+ // the positional registry to recover P-Format / code-style calls.+ let run_context = request.run_context.data.clone().with_tool_dialect(+ crate::agent::prompts::tool_call_format_from_dialect(self.dispatcher.tool_call_format())+ .harness_dispatcher(),+ );let outcome = match graph::run_chat_turn_graph(ChatTurnGraph {turn_models,model: self.model_name.clone(),diff --git a/crates/openhuman-core/src/agent/tinyagents/harness_assembly.rs b/crates/openhuman-core/src/agent/tinyagents/harness_assembly.rsindex 6b7a7f3208..2718088f54 100644--- a/crates/openhuman-core/src/agent/tinyagents/harness_assembly.rs+++ b/crates/openhuman-core/src/agent/tinyagents/harness_assembly.rs@@ -132,6 +132,9 @@ pub(super) fn assemble_turn_harness(// `MaxIterationsExceeded`) must keep doing that, and handing it a wrap-up// would silently convert a documented error into an answer.pause_at_cap: bool,+ // The dialect the session composed its prompt for; see+ // `OpenHumanRunContext::tool_dialect`.+ tool_dialect: tinyagents_harness::config::ToolDispatcher,) -> AssembledTurnHarness {let mut harness: AgentHarness<(), OpenHumanRunContext> = AgentHarness::new();// Cross-route fallback ownership (issue #4249, Workstream 02.2): populate the@@ -144,6 +147,12 @@ pub(super) fn assemble_turn_harness(let mut policy = run_policy_for(max_iterations, deterministic_cacheable);let route_fallback = routes::route_fallback_policy(model);policy.fallback = route_fallback.clone();+ policy.tool_dialect = tool_dialect;+ tracing::debug!(+ model,+ ?tool_dialect,+ "[models] turn harness tool dialect pinned from the session"+ );tracing::debug!(model,fallback_chain = ?route_fallback.as_ref().map(|f| &f.models),diff --git a/crates/openhuman-core/src/agent/tinyagents/host/run_context.rs b/crates/openhuman-core/src/agent/tinyagents/host/run_context.rsindex 2d80d3eb46..0b39091b04 100644--- a/crates/openhuman-core/src/agent/tinyagents/host/run_context.rs+++ b/crates/openhuman-core/src/agent/tinyagents/host/run_context.rs@@ -295,6 +295,12 @@ pub struct OpenHumanRunContext {/// Required structured-output contract for this exact host turn. The/// driver repairs it before returning a candidate to runtime validation.pub(crate) required_output: Option<tinyagents_harness::config::RequiredOutput>,+ /// The tool dialect the owning session composed its system prompt for,+ /// as the harness policy spells it. The turn harness runs the same+ /// dialect so a text protocol strips its schemas off the wire and builds+ /// the registry that recovers positional / code-style calls; `Auto`+ /// (the default) leaves the harness to choose from the model profile.+ pub(crate) tool_dialect: tinyagents_harness::config::ToolDispatcher,}impl Default for OpenHumanRunContext {@@ -334,9 +340,20 @@ impl OpenHumanRunContext {context_middleware: None,session_sidecar: Arc::new(Mutex::new(SessionTurnSidecar::default())),required_output: None,+ tool_dialect: tinyagents_harness::config::ToolDispatcher::Auto,}}+ /// Pins the harness tool dialect to the one the session prompt speaks.+ #[must_use]+ pub(crate) fn with_tool_dialect(+ mut self,+ dialect: tinyagents_harness::config::ToolDispatcher,+ ) -> Self {+ self.tool_dialect = dialect;+ self+ }+/// Sets the direct TinyTools workspace descriptor for this run.pub fn with_workspace(mut self, workspace: tinytools::WorkspaceDescriptor) -> Self {self.workspace = Some(workspace);diff --git a/crates/openhuman-core/src/agent/tinyagents/turn_runner.rs b/crates/openhuman-core/src/agent/tinyagents/turn_runner.rsindex ae2c8d107c..b0c222c87f 100644--- a/crates/openhuman-core/src/agent/tinyagents/turn_runner.rs+++ b/crates/openhuman-core/src/agent/tinyagents/turn_runner.rs@@ -275,6 +275,7 @@ async fn run_turn_via_tinyagents_inner(deterministic_cacheable,hosted_root.is_some(),pause_at_cap,+ run_context.tool_dialect,);// Fail-closed registry validation gate (issue #4249, Workstream 10 — registry).