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(agent): add Python and TypeScript tool call formats
Steven Enamakelab624077ef1e
diff --git a/crates/openhuman-core/src/agent/prompts/sections.rs b/crates/openhuman-core/src/agent/prompts/sections.rsindex 91361063e5..6afc5cf662 100644--- a/crates/openhuman-core/src/agent/prompts/sections.rs+++ b/crates/openhuman-core/src/agent/prompts/sections.rs@@ -391,7 +391,10 @@ impl PromptSection for ToolsSection {}}).collect();- let mut out = render_pformat_catalogue(&visible);+ let mut out = match ctx.tool_call_format.code_style() {+ Some(style) => tinytools_agent::render::render_code_catalogue(&visible, style),+ None => render_pformat_catalogue(&visible),+ };if !ctx.dispatcher_instructions.is_empty() {out.push('\n');out.push_str(ctx.dispatcher_instructions);diff --git a/crates/openhuman-core/src/agent/prompts/types.rs b/crates/openhuman-core/src/agent/prompts/types.rsindex 353465c7cf..0a5fd938a0 100644--- a/crates/openhuman-core/src/agent/prompts/types.rs+++ b/crates/openhuman-core/src/agent/prompts/types.rs@@ -293,6 +293,21 @@ pub enum ToolCallFormat {/// Provider supplies structured tool calls — catalogue is/// informational. Renders in the same JSON-schema form as `Json`.Native,+ /// Python `def` signatures; the model calls `name(arg="value")`.+ Python,+ /// TypeScript `function` signatures; the model calls `name({arg: "value"})`.+ TypeScript,+}++impl ToolCallFormat {+ /// 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 {+ ToolCallFormat::Python => Some(tinytools_agent::dialect::CodeStyle::Python),+ ToolCallFormat::TypeScript => Some(tinytools_agent::dialect::CodeStyle::TypeScript),+ ToolCallFormat::PFormat | ToolCallFormat::Json | ToolCallFormat::Native => None,+ }+ }}/// Map the canonical dialect's catalogue spelling onto the host prompt wire@@ -304,6 +319,8 @@ pub(crate) fn tool_call_format_from_dialect(tinytools_agent::dialect::ToolCallFormat::PFormat => ToolCallFormat::PFormat,tinytools_agent::dialect::ToolCallFormat::Json => ToolCallFormat::Json,tinytools_agent::dialect::ToolCallFormat::Native => ToolCallFormat::Native,+ tinytools_agent::dialect::ToolCallFormat::Python => ToolCallFormat::Python,+ tinytools_agent::dialect::ToolCallFormat::TypeScript => ToolCallFormat::TypeScript,}}diff --git a/crates/openhuman-core/src/agent/subagent_host/tool_prep.rs b/crates/openhuman-core/src/agent/subagent_host/tool_prep.rsindex a00671b0ee..fc0768552e 100644--- a/crates/openhuman-core/src/agent/subagent_host/tool_prep.rs+++ b/crates/openhuman-core/src/agent/subagent_host/tool_prep.rs@@ -233,7 +233,9 @@ pub(crate) fn subagent_prompt_protocol(text_mode: bool,) -> (crate::agent::prompts::ToolCallFormat, String) {use crate::agent::prompts::ToolCallFormat;- use tinytools_agent::dialect::{NativeDialect, PFormatDialect, ToolDialect, XmlDialect};+ use tinytools_agent::dialect::{+ CodeDialect, CodeStyle, NativeDialect, PFormatDialect, ToolDialect, XmlDialect,+ };use tinytools_agent::PFormatRegistry;if text_mode {return (ToolCallFormat::PFormat, String::new());@@ -245,6 +247,8 @@ pub(crate) fn subagent_prompt_protocol(}ToolCallFormat::Native => NativeDialect.prompt_instructions(&empty_tools),ToolCallFormat::Json => XmlDialect.prompt_instructions(&empty_tools),+ ToolCallFormat::Python => CodeDialect::instructions(CodeStyle::Python),+ ToolCallFormat::TypeScript => CodeDialect::instructions(CodeStyle::TypeScript),};(parent_format, instructions)}diff --git a/crates/openhuman-core/src/agent/tinyagents/config.rs b/crates/openhuman-core/src/agent/tinyagents/config.rsindex 767030b6b7..fd93bedcf6 100644--- a/crates/openhuman-core/src/agent/tinyagents/config.rs+++ b/crates/openhuman-core/src/agent/tinyagents/config.rs@@ -40,6 +40,8 @@ fn dispatcher_from(raw: &str) -> ToolDispatcher {"native" => ToolDispatcher::Native,"xml" => ToolDispatcher::Xml,"pformat" => ToolDispatcher::Pformat,+ "python" => ToolDispatcher::Python,+ "typescript" => ToolDispatcher::Typescript,other => {tracing::warn!(target: "tinyagents",diff --git a/crates/openhuman-core/src/agent/tinyagents/config_tests.rs b/crates/openhuman-core/src/agent/tinyagents/config_tests.rsindex db6e5b38d2..cd39d67ae3 100644--- a/crates/openhuman-core/src/agent/tinyagents/config_tests.rs+++ b/crates/openhuman-core/src/agent/tinyagents/config_tests.rs@@ -67,6 +67,8 @@ fn every_dispatcher_spelling_maps_and_unknown_falls_back_to_auto() {("native", ToolDispatcher::Native),("xml", ToolDispatcher::Xml),("pformat", ToolDispatcher::Pformat),+ ("python", ToolDispatcher::Python),+ ("typescript", ToolDispatcher::Typescript),// Case and surrounding whitespace are tolerated.(" NATIVE ", ToolDispatcher::Native),// A typo must not fail the session.diff --git a/crates/openhuman-core/src/config/schema/agent.rs b/crates/openhuman-core/src/config/schema/agent.rsindex 7b2e7d7a9d..92b258d5e9 100644--- a/crates/openhuman-core/src/config/schema/agent.rs+++ b/crates/openhuman-core/src/config/schema/agent.rs@@ -246,6 +246,15 @@ pub struct AgentConfig {/// - `"xml"`: force JSON-in-tag./// - `"pformat"`: force compact positional P-Format (`tool[a|b]`) — most/// token-efficient, but mis-parses on some models, so it is opt-in only.+ /// - `"python"`: force code-style calls with Python signatures in the+ /// prompt (`def read_file(path: str, limit: int = None) -> str`, called+ /// as `read_file(path="x")`). Compact like P-Format but a syntax small+ /// code-trained models already write; opt-in only.+ /// - `"typescript"`: the same with TypeScript signatures and+ /// `read_file({path: "x"})` calls; opt-in only.+ ///+ /// The `OPENHUMAN_TOOL_DISPATCHER` environment variable overrides this+ /// field for one launch.#[serde(default = "default_agent_tool_dispatcher")]pub tool_dispatcher: String,/// **Legacy** — maximum characters of memory context to inject per