Skip to content

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

Merge remote-tracking branch 'upstream/main' into pr/6767

Steven Enamakel9e6d2328ff1a
diff --cc crates/openhuman-core/src/tools/toolpacks/registry.rs
index 669bb483a7,ea616924b1..1d47433521
--- a/crates/openhuman-core/src/tools/toolpacks/registry.rs
+++ b/crates/openhuman-core/src/tools/toolpacks/registry.rs
@@@ -57,7 -57,7 +57,7 @@@ pub const PACKS: &[ToolPack] = &
"list_agent_definitions",
"list_connectable_toolkits",
],
-- owners: &["workflow_builder", "flow_discovery"],
++ owners: &["orchestrator", "workflow_builder", "flow_discovery"],
guide: "",
},
ToolPack {
diff --cc tests/agent_prompt_comprehension_e2e.rs
index 616a58f16d,30148279db..973be45fe2
--- a/tests/agent_prompt_comprehension_e2e.rs
+++ b/tests/agent_prompt_comprehension_e2e.rs
@@@ -660,39 -661,44 +660,39 @@@ fn system_text(request: &Value) -> Stri
}
/// Tool names the agent called, in order, read from its last request (which
-/// carries its whole history). Native requests carry `tool_calls`; the
-/// prompt-rendered (text) dialect replays each call as
-/// `<tool_call>{"name": …}</tool_call>` in the assistant message's content.
+/// carries its whole history).
fn called_tools(request: &Value) -> Vec<String> {
- let messages = request
- request
-- .pointer("/body/messages")
- .and_then(Value::as_array);
- .and_then(Value::as_array)
++ let messages = request.pointer("/body/messages").and_then(Value::as_array);
+ let mut calls = Vec::new();
- for message in messages.into_iter().flatten().filter(|message| {
- message.get("role").and_then(Value::as_str) == Some("assistant")
- }) {
++ for message in messages
+ .into_iter()
+ .flatten()
- .filter(|m| m.get("role").and_then(Value::as_str) == Some("assistant"))
- .flat_map(|m| {
- let native: Vec<String> = m
- .get("tool_calls")
- .and_then(Value::as_array)
- .into_iter()
- .flatten()
- .filter_map(|tc| tc.pointer("/function/name").and_then(Value::as_str))
- .map(str::to_string)
- .collect();
- if !native.is_empty() {
- return native;
++ .filter(|message| message.get("role").and_then(Value::as_str) == Some("assistant"))
++ {
+ if let Some(structured) = message.get("tool_calls").and_then(Value::as_array) {
+ calls.extend(
+ structured
+ .iter()
+ .filter_map(|call| call.pointer("/function/name").and_then(Value::as_str))
+ .map(str::to_string),
+ );
+ }
+ let Some(mut content) = message.get("content").and_then(Value::as_str) else {
+ continue;
+ };
+ while let Some((_, after_open)) = content.split_once("<tool_call>") {
+ let Some((payload, after_close)) = after_open.split_once("</tool_call>") else {
+ break;
+ };
+ if let Ok(call) = serde_json::from_str::<Value>(payload.trim()) {
+ if let Some(name) = call.get("name").and_then(Value::as_str) {
+ calls.push(name.to_string());
+ }
}
- m.get("content")
- .and_then(Value::as_str)
- .map(text_dialect_calls)
- .unwrap_or_default()
- })
- .collect()
-}
-
-fn text_dialect_calls(content: &str) -> Vec<String> {
- content
- .split("<tool_call>")
- .skip(1)
- .filter_map(|chunk| chunk.split_once("</tool_call>").map(|(call, _)| call))
- .filter_map(|call| serde_json::from_str::<Value>(call.trim()).ok())
- .filter_map(|call| call.get("name").and_then(Value::as_str).map(str::to_string))
- .collect()
+ content = after_close;
+ }
+ }
+ calls
}
fn max_consecutive(calls: &[String], tool: &str) -> usize {