Skip to content

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

refactor(tools): extract dialogue tool registration into agent module

Steven Enamakeld7068c2bd464
diff --git a/crates/openhuman-core/src/agent/mod.rs b/crates/openhuman-core/src/agent/mod.rs
index 6acb781b57..521e6ea054 100644
--- a/crates/openhuman-core/src/agent/mod.rs
+++ b/crates/openhuman-core/src/agent/mod.rs
@@ -61,6 +61,7 @@ pub(crate) mod progress_tracing;
pub mod prompts;
/// Host-owned payload carried through TinyAgents run queues.
pub mod queued_turn;
+pub(crate) mod registration;
pub mod registry;
mod schemas;
pub mod session_db;
diff --git a/crates/openhuman-core/src/agent/registration.rs b/crates/openhuman-core/src/agent/registration.rs
new file mode 100644
index 0000000000..9f67007fb0
--- /dev/null
+++ b/crates/openhuman-core/src/agent/registration.rs
@@ -0,0 +1,73 @@
+//! Registration of agent dialogue and delegation tools.
+
+use super::orchestration::tools::{
+ CloseSubagentTool, ContinueSubagentTool, DelegateGraphTool, ListSubagentsTool,
+ SpawnAsyncSubagentTool, SpawnParallelAgentsTool, SpawnSubagentTool, SteerSubagentTool,
+ WaitSubagentTool,
+};
+#[cfg(feature = "skills")]
+use super::tools::{AwaitWorkflowTool, RunWorkflowTool};
+use super::tools::{PlanExitTool, TodoTool};
+use crate::config::Config;
+use std::path::Path;
+use tinyagents_harness::tools as harness_tools;
+use tinytools::Tool;
+use tinytools_std::filesystem::WorkspaceStateTool;
+
+/// Build the dialogue tool family in its persisted catalogue order.
+pub(crate) fn dialogue_tools(action_dir: &Path, root_config: &Config) -> Vec<Box<dyn Tool>> {
+ vec![
+ // Sub-agent dispatch — lets the parent agent delegate focused
+ // sub-tasks (research, code execution, API specialists, …) by
+ // calling `spawn_subagent { agent_id, prompt, … }`. The runner
+ // builds a narrow Agent from an `AgentDefinition` lookup and
+ // returns a single text result. See
+ // `agent::subagent_host` for the dispatch path.
+ Box::new(SpawnSubagentTool::new()),
+ Box::new(SpawnAsyncSubagentTool::new()),
+ // Interactive clarification early-exit. Sub-agents pause on this tool
+ // (checkpoint → `AwaitingUser`, see `subagent_host`) and
+ // the orchestrator resumes them via `continue_subagent` (#4291).
+ // Several agent scopes (orchestrator, crypto, markets, scheduler,
+ // desktop control) name it, so it must exist in the base
+ // registry or none of them can actually ask the user anything.
+ Box::new(harness_tools::AskClarificationTool::new()),
+ // Read-only project overview (git status, recent commits, top-level
+ // tree) rooted at the agent action dir. Named by the orchestrator and
+ // planner scopes.
+ Box::new(WorkspaceStateTool::new(action_dir.to_path_buf())),
+ // Steer/list/close reusable async sub-agents and collect results by
+ // durable `subagent_session_id` (preferred) or transient `task_id`.
+ Box::new(ListSubagentsTool::new()),
+ Box::new(SteerSubagentTool::new()),
+ Box::new(harness_tools::WaitTool::new()),
+ Box::new(harness_tools::WaitLoopTool::new()),
+ Box::new(WaitSubagentTool::new()),
+ Box::new(CloseSubagentTool::new()),
+ Box::new(ContinueSubagentTool::new()),
+ Box::new(SpawnParallelAgentsTool::new()),
+ // Multi-stage durable delegation (issue #4249, Phase 3): runs the chosen
+ // sub-agent through the tinyagents plan→execute→review→finalize graph,
+ // checkpointed to the session DB. Heavier than spawn_subagent; for
+ // sub-tasks that benefit from a self-review/revision loop.
+ Box::new(DelegateGraphTool::new()),
+ // The session todo list (Claude/Codex style): one whole-list write per
+ // call, scoped to the conversation thread. `plan_exit` is the marker
+ // that hands a plan-mode pass off to a build-mode pass.
+ Box::new(TodoTool::new(root_config.workspace_dir.clone())),
+ // Interactive plan-review gate: parks the live turn on a thread-scoped
+ // plan the user must approve before execution (Codex/Claude plan mode).
+ Box::new(crate::agent::plan_review::RequestPlanReviewTool::new()),
+ Box::new(PlanExitTool::new()),
+ // Workflow composition: `run_workflow` runs another workflow as a
+ // subagent and (by default) waits on its result like a function call;
+ // `await_workflow` re-attaches to a run that outlived its inline wait.
+ // Both wrap `skill_runtime::spawn_workflow_run_background` +
+ // `await_run_outcome` — the same spawn path `openhuman.skills_run`
+ // JSON-RPC uses, so RPC and tool callers stay in sync.
+ #[cfg(feature = "skills")]
+ Box::new(RunWorkflowTool::new()),
+ #[cfg(feature = "skills")]
+ Box::new(AwaitWorkflowTool::new()),
+ ]
+}
diff --git a/crates/openhuman-core/src/tools/mod.rs b/crates/openhuman-core/src/tools/mod.rs
index d5c8c07da4..25d02c4d8d 100644
--- a/crates/openhuman-core/src/tools/mod.rs
+++ b/crates/openhuman-core/src/tools/mod.rs
@@ -16,12 +16,6 @@ pub(crate) mod user_filter;
#[path = "impl/mod.rs"]
pub(crate) mod implementations;
-pub use crate::agent::orchestration::tools::*;
-pub use crate::agent::tools::*;
-pub use crate::integrations::composio::tools::*;
-pub use crate::memory::tools::{MemoryTool, MEMORY_TOOL_NAME};
-#[cfg(feature = "modules")]
-pub use crate::search::TinySearchTool;
pub use implementations::*;
pub use schemas::{
all_controller_schemas as all_tools_controller_schemas,
diff --git a/crates/openhuman-core/src/tools/ops.rs b/crates/openhuman-core/src/tools/ops.rs
index 33a22e50eb..d359fa795f 100644
--- a/crates/openhuman-core/src/tools/ops.rs
+++ b/crates/openhuman-core/src/tools/ops.rs
@@ -1,16 +1,16 @@
use super::*;
use crate::agent::host_runtime::{NativeRuntime, RuntimeAdapter};
+use crate::agent::tools::DelegateTool;
use crate::config::{Config, DelegateAgentConfig};
use crate::security::{AuditLogger, SecurityPolicy};
use std::collections::HashMap;
use std::sync::Arc;
-use tinyagents_harness::tools::{self as harness_tools, CurrentTimeTool, ResolveTimeTool};
+use tinyagents_harness::tools::{CurrentTimeTool, ResolveTimeTool};
use tinytools::Tool;
use tinytools_std::detect_tools::DetectToolsTool;
use tinytools_std::filesystem::{
ApplyPatchTool, CsvExportTool, EditFileTool, FileReadTool, FileWriteTool, GitOperationsTool,
GlobTool, GrepTool, ImageInfoTool, ListFilesTool, ReadDiffTool, RunLinterTool, RunTestsTool,
- WorkspaceStateTool,
};
use tinytools_std::network::{CurlTool, PushoverTool};
@@ -105,58 +105,12 @@ pub fn all_tools_with_runtime(
Box::new(EditFileTool::new(security.clone())),
Box::new(ApplyPatchTool::new(security.clone())),
Box::new(CsvExportTool::new(security.clone())),
- // Sub-agent dispatch — lets the parent agent delegate focused
- // sub-tasks (research, code execution, API specialists, …) by
- // calling `spawn_subagent { agent_id, prompt, … }`. The runner
- // builds a narrow Agent from an `AgentDefinition` lookup and
- // returns a single text result. See
- // `agent::subagent_host` for the dispatch path.
- Box::new(SpawnSubagentTool::new()),
- Box::new(SpawnAsyncSubagentTool::new()),
- // Interactive clarification early-exit. Sub-agents pause on this tool
- // (checkpoint → `AwaitingUser`, see `subagent_host`) and
- // the orchestrator resumes them via `continue_subagent` (#4291).
- // Several agent scopes (orchestrator, crypto, markets, scheduler,
- // desktop control) name it, so it must exist in the base
- // registry or none of them can actually ask the user anything.
- Box::new(harness_tools::AskClarificationTool::new()),
- // Read-only project overview (git status, recent commits, top-level
- // tree) rooted at the agent action dir. Named by the orchestrator and
- // planner scopes.
- Box::new(WorkspaceStateTool::new(action_dir.to_path_buf())),
- // Steer/list/close reusable async sub-agents and collect results by
- // durable `subagent_session_id` (preferred) or transient `task_id`.
- Box::new(ListSubagentsTool::new()),
- Box::new(SteerSubagentTool::new()),
- Box::new(harness_tools::WaitTool::new()),
- Box::new(harness_tools::WaitLoopTool::new()),
- Box::new(WaitSubagentTool::new()),
- Box::new(CloseSubagentTool::new()),
- Box::new(ContinueSubagentTool::new()),
- Box::new(SpawnParallelAgentsTool::new()),
- // Multi-stage durable delegation (issue #4249, Phase 3): runs the chosen
- // sub-agent through the tinyagents plan→execute→review→finalize graph,
- // checkpointed to the session DB. Heavier than spawn_subagent; for
- // sub-tasks that benefit from a self-review/revision loop.
- Box::new(DelegateGraphTool::new()),
- // The session todo list (Claude/Codex style): one whole-list write per
- // call, scoped to the conversation thread. `plan_exit` is the marker
- // that hands a plan-mode pass off to a build-mode pass.
- Box::new(TodoTool::new(root_config.workspace_dir.clone())),
- // Interactive plan-review gate: parks the live turn on a thread-scoped
- // plan the user must approve before execution (Codex/Claude plan mode).
- Box::new(crate::agent::plan_review::RequestPlanReviewTool::new()),
- Box::new(PlanExitTool::new()),
- // Workflow composition: `run_workflow` runs another workflow as a
- // subagent and (by default) waits on its result like a function call;
- // `await_workflow` re-attaches to a run that outlived its inline wait.
- // Both wrap `skill_runtime::spawn_workflow_run_background` +
- // `await_run_outcome` — the same spawn path `openhuman.skills_run`
- // JSON-RPC uses, so RPC and tool callers stay in sync.
- #[cfg(feature = "skills")]
- Box::new(RunWorkflowTool::new()),
- #[cfg(feature = "skills")]
- Box::new(AwaitWorkflowTool::new()),
+ ];
+ tools.extend(crate::agent::registration::dialogue_tools(
+ action_dir,
+ root_config,
+ ));
+ tools.extend(vec![
Box::new(CurrentTimeTool::new()),
// Reversibility for native tool-output compaction (Stage 1a): when a
// large result is compacted with a `retrieve_tool_output("<hash>")`
@@ -175,7 +129,7 @@ pub fn all_tools_with_runtime(
Box::new(ResolveTimeTool::new()),
Box::new(DetectToolsTool::new()),
Box::new(InstallToolTool::new(security.clone())),
- ];
+ ]);
tools.extend(crate::cron::tools::tools(config.clone(), security));
#[cfg(feature = "flows")]
tools.extend(crate::flows::registration::tools(config.clone(), security));