Skip to content

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

docs(agent): document direct TurnSpec::run_hosted call path

Steven Enamakel4815cba1a91e
diff --git a/crates/openhuman-core/src/agent/README.md b/crates/openhuman-core/src/agent/README.md
index 3585743176..9d34c4f4ea 100644
--- a/crates/openhuman-core/src/agent/README.md
+++ b/crates/openhuman-core/src/agent/README.md
@@ -76,17 +76,16 @@ the bus path because they keep their own history.
tinyagents_runtime::Session::turn
|-- OpenHumanSessionHooks::before_turn prompt, memory pack, tools
|-- OpenHumanSessionDriver::execute session_host/driver.rs
+ | | construct one TurnSpec and call TurnSpec::run_hosted
| v
- | run_chat_turn_graph session_host/turn/graph.rs
- | v
- | TurnSpec::run_hosted tinyagents/turn_exec.rs
+ | TurnDriver::drive_turn tinyagents/turn_exec.rs
| | TurnDriver::prepare: models + tools; install_turn_middleware
| v
| AgentHarness loop <---------------------------------+
| model call -> tool calls -> middleware -> results --+
| | events -> OpenhumanEventBridge -> AgentProgress -> on_progress
| v
- | grounded close if the loop hit its cap
+ | grounded close if the loop hit its cap (host adapter)
|-- OpenHumanTranscriptCodec durable rows, commit
|-- after_commit memory, BUS, dual-write
v
@@ -120,9 +119,10 @@ In order:
schema the model sees and the authority the driver enforces cannot drift.
5. The session calls `OpenHumanSessionDriver::execute` with the full
history and the tool snapshot. The driver builds this turn's tiered
- `ChatModel` set from `TurnModelSource`, resolves the context window, and
- calls `run_chat_turn_graph`, which calls
- `TurnSpec::run_hosted`.
+ `ChatModel` set from `TurnModelSource`, resolves the context window, maps
+ the request-scoped tool, context and run-queue controls into one `TurnSpec`,
+ and calls `TurnSpec::run_hosted` directly. The same boxed future covers
+ hosted-authority validation, cancellation and accepted-round recovery.
6. `TurnDriver::prepare` plans the turn ([`tinyagents/turn_plan.rs`](./tinyagents/turn_plan.rs)) and `install_turn_middleware` ([`tinyagents/turn_middleware.rs`](./tinyagents/turn_middleware.rs)) registers the
models, the tools (through `CanonicalSharedToolAdapter`) and the
middleware stack: approval and security gating, tool policy, cost
@@ -411,7 +411,7 @@ What lives elsewhere:
`Unknown` and the approval gate fails closed. Recursive execution passes
`OpenHumanRunContext` explicitly for this reason.
- The tool surface is all or nothing. An empty visible-tool set is deny-all,
- not "every tool"; `run_chat_turn_graph` deliberately keeps `Some(empty)`.
+ not "every tool"; `OpenHumanSessionDriver` deliberately keeps `Some(empty)`.
- A resumed thread's prompt and tools are frozen. Testing a prompt change
needs a new thread.
- `agent.run_turn` must be registered before channels dispatch.
diff --git a/crates/openhuman-core/src/agent/session_host/driver.rs b/crates/openhuman-core/src/agent/session_host/driver.rs
index bf221e97be..aaf0548a73 100644
--- a/crates/openhuman-core/src/agent/session_host/driver.rs
+++ b/crates/openhuman-core/src/agent/session_host/driver.rs
@@ -8,17 +8,17 @@ mod grounded_close;
use std::{collections::HashSet, sync::Arc, time::Instant};
+use crate::agent::tinyagents::TurnSpec;
use async_trait::async_trait;
use tinyagents_runtime::{
DriverFailure, DriverOutcome, DriverRequest, RuntimeError, SessionDriver, TranscriptPartial,
};
-use crate::agent::tinyagents::TurnSpec;
use tinyagents_session::transcript::TranscriptMessage;
use tinyinference_llm::message::Message;
use tinytools_agent::dialect::ToolDialect;
-use crate::agent::{
- tinyagents::{host::OpenHumanHostBase, host::OpenHumanRunContext, TurnModelSource},
+use crate::agent::tinyagents::{
+ host::OpenHumanHostBase, host::OpenHumanRunContext, TurnModelSource,
};
/// Immutable host composition consumed by [`OpenHumanSessionDriver`].