Skip to content

Agent Zero AI framework

restore agent.system.tool.call_sub.py dynamic loader

Alessandrof4fd91260d2a
diff --git a/prompts/agent.system.tool.call_sub.py b/prompts/agent.system.tool.call_sub.py
new file mode 100644
index 000000000..964e1c999
--- /dev/null
+++ b/prompts/agent.system.tool.call_sub.py
@@ -0,0 +1,34 @@
+import json
+from typing import Any, TYPE_CHECKING
+from helpers.files import VariablesPlugin
+from helpers import files, projects, subagents
+from helpers.print_style import PrintStyle
+
+if TYPE_CHECKING:
+ from agent import Agent
+
+
+class CallSubordinate(VariablesPlugin):
+ def get_variables(
+ self, file: str, backup_dirs: list[str] | None = None, **kwargs
+ ) -> dict[str, Any]:
+
+ # current agent instance
+ agent: Agent | None = kwargs.get("_agent", None)
+ # current project
+ project = projects.get_context_project_name(agent.context) if agent else None
+ # available agents in project (or global)
+ agents = subagents.get_available_agents_dict(project)
+
+ if agents:
+ profiles = {}
+ for name, subagent in agents.items():
+ profiles[name] = {
+ "title": subagent.title,
+ "description": subagent.description,
+ "context": subagent.context,
+ }
+ return {"agent_profiles": profiles}
+ else:
+ return {"agent_profiles": None}
+