Skip to content

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

feat(agent): support typed message input for agent turns

Steven Enamakeld9b2b72d990b
diff --git a/crates/openhuman-core/src/agent/turn_host.rs b/crates/openhuman-core/src/agent/turn_host.rs
index de603e85d1..b77ca583c7 100644
--- a/crates/openhuman-core/src/agent/turn_host.rs
+++ b/crates/openhuman-core/src/agent/turn_host.rs
@@ -57,6 +57,9 @@ impl std::fmt::Debug for TrustedAgentTurn {
/// The trusted, already-routed inputs for one agent turn.
pub(crate) struct AgentTurnRequest {
pub(crate) message: String,
+ /// Trusted typed message assembled after validating attachment refs at the
+ /// owning persistence boundary. `None` retains the normal text conversion.
+ pub(crate) message_input: Option<tinyinference_llm::message::Message>,
pub(crate) thread_id: Option<String>,
pub(crate) origin: AgentTurnOrigin,
pub(crate) approval: ApprovalTurnContext,
@@ -120,15 +123,20 @@ impl AgentTurnHost {
// Keep the large agent future behind a pointer while the origin scope
// is active. The origin is explicit and independent from RPC metadata.
- Box::pin(with_origin(
- request.origin.clone(),
- session.run_single_with_approval(
+ let turn = match request.message_input {
+ Some(input) => session.run_single_with_approval_and_message(
&request.message,
- Some(request.origin),
+ input,
+ Some(request.origin.clone()),
request.approval,
),
- ))
- .await
+ None => session.run_single_with_approval(
+ &request.message,
+ Some(request.origin.clone()),
+ request.approval,
+ ),
+ };
+ Box::pin(with_origin(request.origin, turn)).await
}
}