Skip to content

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

feat(cli): add --params-stdin flag to call command

Steven Enamakel5c526e93f355
diff --git a/crates/openhuman-core/src/core/cli.rs b/crates/openhuman-core/src/core/cli.rs
index 8d9c84fb24..b702fae478 100644
--- a/crates/openhuman-core/src/core/cli.rs
+++ b/crates/openhuman-core/src/core/cli.rs
@@ -414,6 +414,7 @@ fn run_server_command(args: &[String]) -> Result<()> {
fn run_call_command(args: &[String]) -> Result<()> {
let mut method: Option<String> = None;
let mut params = "{}".to_string();
+ let mut params_stdin = false;
let mut i = 0usize;
while i < args.len() {
@@ -427,14 +428,24 @@ fn run_call_command(args: &[String]) -> Result<()> {
i += 2;
}
"--params" => {
+ if params_stdin {
+ return Err(anyhow::anyhow!("--params and --params-stdin are mutually exclusive"));
+ }
params = args
.get(i + 1)
.ok_or_else(|| anyhow::anyhow!("missing value for --params"))?
.clone();
i += 2;
}
+ "--params-stdin" => {
+ if params != "{}" {
+ return Err(anyhow::anyhow!("--params and --params-stdin are mutually exclusive"));
+ }
+ params_stdin = true;
+ i += 1;
+ }
"-h" | "--help" => {
- println!("Usage: openhuman call --method <name> [--params '<json>']");
+ println!("Usage: openhuman call --method <name> [--params '<json>' | --params-stdin]");
return Ok(());
}
other => return Err(anyhow::anyhow!("unknown call arg: {other}")),
@@ -442,6 +453,10 @@ fn run_call_command(args: &[String]) -> Result<()> {
}
let method = method.ok_or_else(|| anyhow::anyhow!("--method is required"))?;
+ if params_stdin {
+ std::io::Read::read_to_string(&mut std::io::stdin(), &mut params)
+ .map_err(|e| anyhow::anyhow!("failed to read --params-stdin: {e}"))?;
+ }
let params = parse_json_params(&params).map_err(anyhow::Error::msg)?;
// Raw calls bypass namespace parsing, but not the configured memory-driver
@@ -693,7 +708,7 @@ fn print_general_help(grouped: &BTreeMap<String, Vec<ControllerSchema>>) {
println!("Usage:");
println!(" openhuman [OPTIONS] (show this help)");
println!(" openhuman run [--host <addr>] [--port <u16>] [--jsonrpc-only] [--verbose]");
- println!(" openhuman call --method <name> [--params '<json>']");
+ println!(" openhuman call --method <name> [--params '<json>' | --params-stdin]");
println!(
" openhuman mcp [-v|--verbose] (stdio MCP server; read-only memory tools)"
);
diff --git a/scripts/prompt-eval.sh b/scripts/prompt-eval.sh
index 1b1890c201..a15cf455f2 100755
--- a/scripts/prompt-eval.sh
+++ b/scripts/prompt-eval.sh
@@ -4,7 +4,7 @@
# Tier 1 (`tests/agent_prompt_comprehension_e2e.rs`) pins the script; only this
# answers whether a model follows it. See docs/prompt-evals.md.
#
-# Usage: scripts/prompt-eval.sh [--case <id>] [--runs N] [--bin <openhuman-core>] [--real-workspace]
+# Usage: scripts/prompt-eval.sh [--case <id>] [--runs N] [--bin <openhuman-core>] [--real-workspace] [--allow-disabled]
#
# --runs N repeats every case N times (default 1). One run is a sample, not a
# baseline: every run is its own row (case + ts + run + models), never averaged.
@@ -34,6 +34,7 @@ OUT="$ROOT/target/prompt-eval-runs.jsonl"
ONLY=""
REAL=0
RUNS=1
+ALLOW_DISABLED=0
while [ $# -gt 0 ]; do
case "$1" in
@@ -41,6 +42,7 @@ while [ $# -gt 0 ]; do
--bin) BIN="$2"; shift 2 ;;
--real-workspace) REAL=1; shift ;;
--runs) RUNS="$2"; shift 2 ;;
+ --allow-disabled) ALLOW_DISABLED=1; shift ;;
-h|--help) sed -n '2,20p' "$0"; exit 0 ;;
*) echo "unknown arg: $1" >&2; exit 2 ;;
esac
@@ -78,6 +80,7 @@ for run in $(seq 1 "$RUNS"); do
ws="$(mktemp -d -t prompt-eval)"
export RUST_LOG="${RUST_LOG:-info}"
if [ "$REAL" = 1 ]; then
+ unset OPENHUMAN_WORKSPACE OPENHUMAN_KEYRING_BACKEND
# Transcripts land in the real workspace; score only files this case wrote.
export PROMPT_EVAL_TRANSCRIPT_ROOT="$HOME/.openhuman" PROMPT_EVAL_SINCE="$(date +%s)"
else
@@ -86,17 +89,25 @@ for run in $(seq 1 "$RUNS"); do
fi
core() { "$BIN" call --method "$1" --params "$2" 2>>"$ws/core.log"; }
+ core_stdin() { "$BIN" call --method "$1" --params-stdin 2>>"$ws/core.log"; }
+
+ enabled=$(python3 -c 'import json,sys; c=[c for c in json.load(open(sys.argv[1]))["cases"] if c["id"]==sys.argv[2]][0]; print("1" if c.get("enabled", True) else "0")' "$CASES" "$id")
+ if [ "$enabled" = 0 ]; then
+ if [ "$ALLOW_DISABLED" != 1 ]; then
+ echo "$id run $run: SKIPPED — disabled (use --allow-disabled after validating its write-call matcher)" >&2
+ continue
+ fi
+ python3 -c 'import json,sys; c=json.load(open(sys.argv[1])); case=next(x for x in c["cases"] if x["id"]==sys.argv[2]); assert case.get("forbid_calls"), "disabled case must define forbidden calls"; assert case.get("_gate"), "disabled case must document its gate"' "$CASES" "$id"
+ fi
# `call` does not run the server's boot-env credential seeding, so install it.
- # ponytail: the credential rides argv (visible in `ps`) — `call` takes params
- # no other way; fine on a dev machine, add a --params-file before a shared host.
if [ "$REAL" = 0 ]; then
if [ -n "${OPENHUMAN_BACKEND_API_KEY:-}" ]; then
cred=$(python3 -c 'import json,os; print(json.dumps({"token": os.environ["OPENHUMAN_BACKEND_API_KEY"], "kind": "api-key"}))')
else
cred=$(python3 -c 'import json,os; print(json.dumps({"token": os.environ["OPENHUMAN_BACKEND_SESSION_TOKEN"], "kind": "session"}))')
fi
- core openhuman.auth_set_credential "$cred" >/dev/null
+ printf '%s' "$cred" | core_stdin openhuman.auth_set_credential >/dev/null
fi
entry=$(python3 -c 'import json,sys; c=[c for c in json.load(open(sys.argv[1]))["cases"] if c["id"]==sys.argv[2]][0]; print(c["entry"]); print(c["message"])' "$CASES" "$id")
diff --git a/scripts/prompt-eval/cases.json b/scripts/prompt-eval/cases.json
index 27ce01d798..04adc6a42c 100644
--- a/scripts/prompt-eval/cases.json
+++ b/scripts/prompt-eval/cases.json
@@ -67,6 +67,7 @@
"max_consecutive": {},
"max_input_tokens": 60000,
"judge": false,
+ "expected_response": "391",
"writes": [],
"surface": "orchestration"
},
@@ -121,6 +122,7 @@
},
{
"id": "composio-gmail-read",
+ "enabled": false,
"surface": "composio",
"_why": "Integration hand-off to a connected toolkit, read-only. Exercises delegate_to_integrations_agent and the text-mode integrations_agent (see #6334).",
"entry": "agent_chat",
diff --git a/scripts/prompt-eval/score.py b/scripts/prompt-eval/score.py
index 3aac9946df..a1dd46937a 100755
--- a/scripts/prompt-eval/score.py
+++ b/scripts/prompt-eval/score.py
@@ -211,6 +211,11 @@ def score(doc, case, ws, secs, run=1):
checks += 1
if not re.search(case["reply_regex"], reply_text(result)):
failures.append("reply_regex")
+ if case.get("expected_response") is not None:
+ checks += 1
+ expected = str(case["expected_response"])
+ if not re.search(r"(?<!\d)" + re.escape(expected) + r"(?!\d)", reply_text(result)):
+ failures.append("expected_response")
# 3. Cost. ponytail: sums every transcript's _meta; if a parent's totals ever
# include its children's, this double-counts — switch to root-only then.