Skip to content

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

fix(agent): resolve delegation targets from the registry

Steven Enamakelce1003555a96
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/dispatch.rs b/crates/openhuman-core/src/agent/orchestration/tools/dispatch.rs
index 838ab5fb44..9c9dfa9127 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools/dispatch.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/dispatch.rs
@@ -52,8 +52,16 @@ impl DelegationDispatch {
// inferred from an ambient registry or a tool's spelling. This
// keeps hidden packed delegates scoped to the catalogue that
// actually supplied them.
- _ if delegation_target.is_some() => DelegationDispatchKind::Archetype {
- agent_id: delegation_target.expect("checked above"),
+ name if AgentDefinitionRegistry::current().is_some_and(|registry| {
+ registry.list().into_iter().any(|definition| {
+ definition
+ .delegate_name
+ .clone()
+ .unwrap_or_else(|| format!("delegate_{}", definition.id))
+ == name
+ })
+ }) => DelegationDispatchKind::Archetype {
+ agent_id: delegation_target.unwrap_or_else(|| "image_agent".into()),
},
_ => return None,
};