Skip to content

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

docs(agent_chat): clarify agent_chat schema field and output descriptions

Steven Enamakel1ff89ec45ea1
diff --git a/crates/openhuman-core/src/agent_runs/agent_chat/controllers.rs b/crates/openhuman-core/src/agent_runs/agent_chat/controllers.rs
index e73407975d..b4eb2c682a 100644
--- a/crates/openhuman-core/src/agent_runs/agent_chat/controllers.rs
+++ b/crates/openhuman-core/src/agent_runs/agent_chat/controllers.rs
@@ -5,10 +5,6 @@ use crate::agent_runs::agent_chat::params::AgentChatParams;
use crate::core::all::{ControllerFuture, RegisteredController};
use crate::core::{ControllerSchema, FieldSchema, TypeSchema};
-#[cfg(test)]
-#[path = "controllers_tests.rs"]
-mod tests;
-
#[derive(Debug, Deserialize)]
struct InferenceAgentChatParams {
#[serde(flatten)]
@@ -24,31 +20,53 @@ struct InferenceAgentChatParams {
}
pub(crate) fn schemas(function: &str) -> ControllerSchema {
- let inputs = vec![
- required_string("message", "User message."),
- optional_string("model_override", "Optional model override."),
- optional_f64("temperature", "Optional temperature override."),
- optional_string("thread_id", "Optional backend thread id for cache grouping and inference logs."),
- optional_string("agent_id", "Optional agent definition id to run the turn as. Omit for the orchestrator."),
- optional_string("cwd", "Optional working directory for this turn; must be an existing directory."),
- optional_string("inference_url", "Optional OpenAI-compatible endpoint for this call only. Requires api_key; never persisted."),
- optional_string("api_key", "Bearer for inference_url. Scoped to this call and to that endpoint alone."),
- FieldSchema {
- name: "inference_headers",
- ty: TypeSchema::Option(Box::new(TypeSchema::Array(Box::new(TypeSchema::Json)))),
- comment: "Custom header name/value pairs for inference_url only; never persisted.",
- required: false,
- },
- ];
match function {
"agent_chat" => ControllerSchema {
namespace: "inference",
function: "agent_chat",
description: "Run one-shot agent chat with optional model overrides.",
- inputs,
+ inputs: vec![
+ required_string("message", "User message."),
+ optional_string("model_override", "Optional model override."),
+ optional_f64("temperature", "Optional temperature override."),
+ optional_string(
+ "thread_id",
+ "Optional backend thread id for cache grouping and inference logs.",
+ ),
+ optional_string(
+ "agent_id",
+ "Optional agent definition id to run the turn as. Omit for the \
+ orchestrator.",
+ ),
+ optional_string(
+ "cwd",
+ "Optional working directory for this turn: the agent's file and shell \
+ tools are rooted here, so relative paths resolve inside it. Must be an \
+ existing directory. Omit (or pass empty) to use the configured action_dir.",
+ ),
+ optional_string(
+ "inference_url",
+ "Optional OpenAI-compatible endpoint for this call only. \
+ Requires api_key; never persisted.",
+ ),
+ optional_string(
+ "api_key",
+ "Bearer for inference_url. Scoped to this call and to that \
+ endpoint alone.",
+ ),
+ FieldSchema {
+ name: "inference_headers",
+ ty: TypeSchema::Option(Box::new(TypeSchema::Array(Box::new(TypeSchema::Json)))),
+ comment:
+ "Custom header name/value pairs for inference_url only; never persisted.",
+ required: false,
+ },
+ ],
outputs: vec![json_output(
"response",
- "Agent response payload with result, logs, hit_cap, and an optional checkpoint.",
+ "Agent response payload: `result` (the reply text), `logs`, `hit_cap` (true when \
+ the turn stopped at its tool-iteration cap instead of finishing) and, only when \
+ hit_cap is true, `checkpoint` (the resumable checkpoint text, equal to `result`).",
)],
},
"agent_chat_simple" => ControllerSchema {
@@ -190,3 +208,7 @@ fn json_output(name: &'static str, comment: &'static str) -> FieldSchema {
required: true,
}
}
+
+#[cfg(test)]
+#[path = "controllers_tests.rs"]
+mod tests;
diff --git a/crates/openhuman-core/src/agent_runs/agent_chat/controllers_tests.rs b/crates/openhuman-core/src/agent_runs/agent_chat/controllers_tests.rs
index 1b59e4150c..7676e6bf7a 100644
--- a/crates/openhuman-core/src/agent_runs/agent_chat/controllers_tests.rs
+++ b/crates/openhuman-core/src/agent_runs/agent_chat/controllers_tests.rs
@@ -47,3 +47,23 @@ fn inference_agent_chat_parses_its_route_fields() {
vec![("x-test".into(), "value".into())]
);
}
+
+#[test]
+fn inference_agent_chat_keeps_the_optional_agent_id_schema_and_typed_route_fields() {
+ let schema = schemas("agent_chat");
+ let agent_id = schema
+ .inputs
+ .iter()
+ .find(|field| field.name == "agent_id")
+ .expect("agent_id is part of the inference chat contract");
+ assert!(!agent_id.required);
+
+ let invalid = serde_json::from_value::<InferenceAgentChatParams>(serde_json::json!({
+ "message": "hello",
+ "inference_url": 7
+ }));
+ assert!(
+ invalid.is_err(),
+ "the inference surface still validates route fields"
+ );
+}
diff --git a/crates/openhuman-core/src/core/all.rs b/crates/openhuman-core/src/core/all.rs
index d3640e944e..e57fdc9f6b 100644
--- a/crates/openhuman-core/src/core/all.rs
+++ b/crates/openhuman-core/src/core/all.rs
@@ -515,6 +515,7 @@ fn build_registered_controllers() -> Vec<GroupedController> {
let mut inference_controllers = crate::inference::all_inference_registered_controllers();
// Agent-owned chat keeps inference's capability group and contract order.
// Append it before the local runtime's speech controllers.
+ // This remains the registry's sole registration site for these methods.
inference_controllers
.extend(crate::agent_runs::all_inference_agent_chat_registered_controllers());
inference_controllers.extend(crate::inference::all_local_inference_registered_controllers());