Skip to content

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

refactor(agent_runs): move agent chat params into agent_chat module

Steven Enamakelbcccb1850c4b
diff --git a/crates/openhuman-core/src/agent_runs/agent_chat/mod.rs b/crates/openhuman-core/src/agent_runs/agent_chat/mod.rs
index ba0274c760..f616eb3a45 100644
--- a/crates/openhuman-core/src/agent_runs/agent_chat/mod.rs
+++ b/crates/openhuman-core/src/agent_runs/agent_chat/mod.rs
@@ -1,6 +1,7 @@
//! Full agent chat turns and their shared turn guards.
pub(crate) mod guards;
+pub(crate) mod params;
mod session_turn;
pub(crate) use session_turn::{
diff --git a/crates/openhuman-core/src/agent_runs/agent_chat/params.rs b/crates/openhuman-core/src/agent_runs/agent_chat/params.rs
new file mode 100644
index 0000000000..df6a88558d
--- /dev/null
+++ b/crates/openhuman-core/src/agent_runs/agent_chat/params.rs
@@ -0,0 +1,12 @@
+use serde::Deserialize;
+
+/// Fields shared by the two full agent-chat controller surfaces.
+#[derive(Debug, Deserialize)]
+pub(crate) struct AgentChatParams {
+ pub(crate) message: String,
+ pub(crate) model_override: Option<String>,
+ pub(crate) temperature: Option<f64>,
+ pub(crate) thread_id: Option<String>,
+ /// Optional per-turn working directory for filesystem and shell tools.
+ pub(crate) cwd: Option<String>,
+}
diff --git a/crates/openhuman-core/src/agent_runs/agent_chat/session_turn.rs b/crates/openhuman-core/src/agent_runs/agent_chat/session_turn.rs
index 4979330f91..acae9b1509 100644
--- a/crates/openhuman-core/src/agent_runs/agent_chat/session_turn.rs
+++ b/crates/openhuman-core/src/agent_runs/agent_chat/session_turn.rs
@@ -3,7 +3,6 @@
use crate::agent::OpenHumanSessionHost;
use crate::config::Config;
use crate::core::Outcome;
-use crate::inference::provider as providers;
use super::guards::{
effective_agent_chat_origin, enforce_user_prompt_or_reject, grant_turn_cwd,
@@ -626,3 +625,7 @@ pub async fn agent_chat_reply_for(
Ok(AgentChatReply { text, hit_cap })
}
+#[cfg(test)]
+#[path = "session_turn_tests.rs"]
+mod tests;
+
diff --git a/crates/openhuman-core/src/agent_runs/schemas.rs b/crates/openhuman-core/src/agent_runs/schemas.rs
index d1980230c6..d8ebf3c336 100644
--- a/crates/openhuman-core/src/agent_runs/schemas.rs
+++ b/crates/openhuman-core/src/agent_runs/schemas.rs
@@ -1,6 +1,5 @@
use crate::core::runtime::DispatchCtx;
use serde::de::DeserializeOwned;
-use serde::Deserialize;
use serde_json::{Map, Value};
use crate::config::rpc as config_rpc;
@@ -8,25 +7,7 @@ use crate::core::all::{ControllerFuture, RegisteredController};
use crate::core::Outcome;
use crate::core::{ControllerSchema, FieldSchema, TypeSchema};
-/// Params for `agent.chat` and `agent.chat_simple`.
-///
-/// A near-copy of the params in
-/// [`crate::inference::host_runtime::schemas`], which backs the
-/// `inference.agent_chat*` namespace over the same ops. That surface carries
-/// two fields this one does not — a per-call `inference_url` + `api_key` —
-/// because `agent.chat` describes a turn on the account's own configured
-/// inference.
-#[derive(Debug, Deserialize)]
-struct AgentChatParams {
- message: String,
- model_override: Option<String>,
- temperature: Option<f64>,
- thread_id: Option<String>,
- /// Optional per-turn working directory for the agent's filesystem / shell
- /// tools. Absent or empty keeps the configured `action_dir`. Ignored by the
- /// `*_simple` variant, which runs a bare provider call with no tools.
- cwd: Option<String>,
-}
+use crate::agent_runs::agent_chat::params::AgentChatParams;
pub fn all_controller_schemas() -> Vec<ControllerSchema> {
vec![
@@ -265,7 +246,7 @@ fn handle_chat(ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture
let p = deserialize_params::<AgentChatParams>(params)?;
let mut config = ctx.load_config().await?;
to_json(
- crate::inference::host_runtime::ops::agent_chat(
+ crate::agent_runs::agent_chat::agent_chat(
&mut config,
&p.message,
p.model_override,