Skip to content

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

feat(agent): add registry ops and rpc for agent defaults

Steven Enamakelda27ea62d7c1
diff --git a/crates/openhuman-core/src/agent/registry/defaults.rs b/crates/openhuman-core/src/agent/registry/defaults.rs
index 02b8a7b2c3..a8c5dce3f2 100644
--- a/crates/openhuman-core/src/agent/registry/defaults.rs
+++ b/crates/openhuman-core/src/agent/registry/defaults.rs
@@ -36,6 +36,7 @@ fn default_entry_from_definition(def: AgentDefinition) -> AgentRegistryEntry {
system_prompt: None,
tool_allowlist: tools_to_allowlist(&def.tools, &def.extra_tools),
tool_denylist: def.disallowed_tools,
+ tool_rules: def.tool_rules,
subagents: AgentSubagentPolicy::from_allowlist(
def.subagents
.into_iter()
@@ -94,6 +95,7 @@ pub fn definition_from_registry_entry(entry: &AgentRegistryEntry) -> AgentDefini
skill_filter: None,
extra_tools: Vec::new(),
deferred_tools: Vec::new(),
+ tool_rules: entry.tool_rules.clone(),
max_iterations: 8,
iteration_policy: IterationPolicy::Strict,
max_result_chars: None,
diff --git a/crates/openhuman-core/src/agent/registry/ops.rs b/crates/openhuman-core/src/agent/registry/ops.rs
index 70fcff7912..4733d19faa 100644
--- a/crates/openhuman-core/src/agent/registry/ops.rs
+++ b/crates/openhuman-core/src/agent/registry/ops.rs
@@ -253,6 +253,10 @@ fn apply_patch(entry: &mut AgentRegistryEntry, patch: AgentRegistryPatch) {
if let Some(tool_denylist) = patch.tool_denylist {
entry.tool_denylist = tool_denylist;
}
+ if let Some(tool_rules) = patch.tool_rules {
+ // An empty rule set clears the field rather than storing a no-op.
+ entry.tool_rules = (!tool_rules.is_permissive()).then_some(tool_rules);
+ }
if let Some(subagents) = patch.subagents {
entry.subagents = subagents;
}
diff --git a/crates/openhuman-core/src/agent/registry/rpc.rs b/crates/openhuman-core/src/agent/registry/rpc.rs
index 17d7aa1859..439949a060 100644
--- a/crates/openhuman-core/src/agent/registry/rpc.rs
+++ b/crates/openhuman-core/src/agent/registry/rpc.rs
@@ -84,6 +84,8 @@ pub struct CreateCustomRequest {
#[serde(default)]
pub tool_denylist: Vec<String>,
#[serde(default)]
+ pub tool_rules: Option<tinytools::ToolRules>,
+ #[serde(default)]
pub subagents: AgentSubagentPolicy,
#[serde(default)]
pub tags: Vec<String>,
diff --git a/crates/openhuman-core/src/agent/registry/types.rs b/crates/openhuman-core/src/agent/registry/types.rs
index a6eba69a67..14623f8af1 100644
--- a/crates/openhuman-core/src/agent/registry/types.rs
+++ b/crates/openhuman-core/src/agent/registry/types.rs
@@ -77,6 +77,11 @@ pub struct AgentRegistryEntry {
/// Tool names that must be hidden even if they match the allowlist.
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub tool_denylist: Vec<String>,
+ /// Pattern rules narrowing this agent's tools on every surface (see
+ /// `tinytools::ToolRules`), on top of the allowlist and denylist.
+ #[serde(default, skip_serializing_if = "Option::is_none")]
+ #[schemars(with = "Option<Value>")]
+ pub tool_rules: Option<tinytools::ToolRules>,
/// Subagent delegation policy. Only ids in `allowlist` may be spawned.
#[serde(default, skip_serializing_if = "AgentSubagentPolicy::is_empty")]
pub subagents: AgentSubagentPolicy,
@@ -158,6 +163,8 @@ pub struct AgentRegistryPatch {
#[serde(default)]
pub tool_denylist: Option<Vec<String>>,
#[serde(default)]
+ pub tool_rules: Option<tinytools::ToolRules>,
+ #[serde(default)]
pub subagents: Option<AgentSubagentPolicy>,
#[serde(default)]
pub tags: Option<Vec<String>>,