Skip to content

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

feat(agent): add plan review tool for reviewing agent plans

Steven Enamakel6f8b9c38889b
diff --git a/crates/openhuman-core/src/agent/plan_review/tool.rs b/crates/openhuman-core/src/agent/plan_review/tool.rs
index 0f91c00809..774822d3f8 100644
--- a/crates/openhuman-core/src/agent/plan_review/tool.rs
+++ b/crates/openhuman-core/src/agent/plan_review/tool.rs
@@ -148,7 +148,12 @@ impl RequestPlanReviewTool {
// instead of freezing the turn on an approval nobody asked for.
let mode = thread_id
.as_deref()
- .map(crate::agent::tinyagents::run_mode::get_mode)
+ .map(|thread_id| {
+ crate::agent::tinyagents::run_mode::get_mode(
+ &crate::agent::tinyagents::host::run_context::dispatch_ctx_for_tool(context),
+ thread_id,
+ )
+ })
.unwrap_or_default();
if mode != tinyagents_harness::middleware::RunMode::Plan {
tracing::debug!(
diff --git a/crates/openhuman-core/src/agent/tinyagents/reasoning.rs b/crates/openhuman-core/src/agent/tinyagents/reasoning.rs
index 7fe526870f..db4385504a 100644
--- a/crates/openhuman-core/src/agent/tinyagents/reasoning.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/reasoning.rs
@@ -101,7 +101,7 @@ pub(crate) fn turn_reasoning_for(
if ctx.spawn_depth > 0 {
return None;
}
- let reasoning = turn_reasoning(ctx.thread_id.as_deref(), config)
+ let reasoning = turn_reasoning(&ctx.dispatch_ctx(), ctx.thread_id.as_deref(), config)
.map(|reasoning| with_output_room(reasoning, max_output_tokens));
if let Some(reasoning) = reasoning.as_ref() {
log::debug!(
@@ -117,10 +117,11 @@ pub(crate) fn turn_reasoning_for(
/// The reasoning config one agent turn should request: the thread's own
/// choice, else [`reasoning_for_config`].
pub(crate) fn turn_reasoning(
+ dispatch: &DispatchCtx,
thread_id: Option<&str>,
config: Option<&Config>,
) -> Option<ReasoningConfig> {
- if let Some(effort) = thread_id.and_then(thread_effort) {
+ if let Some(effort) = thread_id.and_then(|thread_id| thread_effort(dispatch, thread_id)) {
return Some(ReasoningConfig::effort(effort));
}
config.and_then(reasoning_for_config)
diff --git a/crates/openhuman-core/src/agent/tinyagents/turn_exec.rs b/crates/openhuman-core/src/agent/tinyagents/turn_exec.rs
index 8fcec016da..ce2a4a2c28 100644
--- a/crates/openhuman-core/src/agent/tinyagents/turn_exec.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/turn_exec.rs
@@ -417,7 +417,9 @@ async fn drive_turn(
..
}) = run_context.origin.as_ref()
{
- journal::register_request_journal_run(request_id, journal_run_id.as_str());
+ journal::register_request_journal_run(
+ &run_context.dispatch_ctx(),
+ request_id, journal_run_id.as_str());
}
}
ctx = ctx.with_events(sink.clone());
@@ -520,7 +522,12 @@ async fn drive_turn(
run_mode: run_context
.thread_id
.as_deref()
- .map(crate::agent::tinyagents::run_mode::handle_for_thread),
+ .map(|thread_id| {
+ crate::agent::tinyagents::run_mode::handle_for_thread(
+ &run_context.dispatch_ctx(),
+ thread_id,
+ )
+ }),
memory_turn: run_context.memory_turn.clone(),
summarizer_model,
failure_map: failure_map.clone(),
diff --git a/crates/openhuman-core/src/agent/tools/plan_exit.rs b/crates/openhuman-core/src/agent/tools/plan_exit.rs
index 6daaefb3b0..8f1ef72bb6 100644
--- a/crates/openhuman-core/src/agent/tools/plan_exit.rs
+++ b/crates/openhuman-core/src/agent/tools/plan_exit.rs
@@ -116,6 +116,7 @@ impl PlanExitTool {
"[tool][plan_exit] flipping thread run mode to build"
);
crate::agent::tinyagents::run_mode::set_mode(
+ &crate::agent::tinyagents::host::run_context::dispatch_ctx_for_tool(context),
thread_id,
tinyagents_harness::middleware::RunMode::Build,
);