Spaces:
Paused
Paused
frdel commited on
Commit Β·
de76de9
1
Parent(s): a50480f
agents rework, memory improvements and params
Browse filesThis view is limited to 50 files because it contains too many changes. Β See raw diff
- agent.py +31 -28
- agents/_example/extensions/agent_init/_10_example_extension.py +10 -0
- agents/_example/prompts/agent.system.main.role.md +8 -0
- agents/_example/prompts/agent.system.tool.example_tool.md +16 -0
- agents/_example/tools/example_tool.py +21 -0
- agents/_example/tools/response.py +23 -0
- {prompts β agents}/agent0/_context.md +0 -0
- {prompts/agent0 β agents/agent0/prompts}/agent.system.main.role.md +0 -0
- {prompts/agent0 β agents/agent0/prompts}/agent.system.tool.response.md +0 -0
- {prompts β agents}/default/_context.md +0 -0
- {prompts β agents}/developer/_context.md +0 -0
- {prompts/developer β agents/developer/prompts}/agent.system.main.communication.md +0 -0
- {prompts/developer β agents/developer/prompts}/agent.system.main.role.md +0 -0
- {prompts β agents}/hacker/_context.md +0 -0
- {prompts/hacker β agents/hacker/prompts}/agent.system.main.environment.md +0 -0
- {prompts/hacker β agents/hacker/prompts}/agent.system.main.role.md +0 -0
- {prompts β agents}/researcher/_context.md +0 -0
- {prompts/researcher β agents/researcher/prompts}/agent.system.main.communication.md +0 -0
- {prompts/researcher β agents/researcher/prompts}/agent.system.main.role.md +0 -0
- initialize.py +1 -1
- prompts/{default/agent.context.extras.md β agent.context.extras.md} +0 -0
- prompts/agent.extras.agent_info.md +3 -0
- prompts/{default/agent.system.behaviour.md β agent.system.behaviour.md} +0 -0
- prompts/{default/agent.system.behaviour_default.md β agent.system.behaviour_default.md} +0 -0
- prompts/{default/agent.system.datetime.md β agent.system.datetime.md} +0 -0
- prompts/{default/agent.system.instruments.md β agent.system.instruments.md} +0 -0
- prompts/{default/agent.system.main.communication.md β agent.system.main.communication.md} +0 -0
- prompts/{default/agent.system.main.environment.md β agent.system.main.environment.md} +0 -0
- prompts/{default/agent.system.main.md β agent.system.main.md} +0 -0
- prompts/{default/agent.system.main.role.md β agent.system.main.role.md} +0 -0
- prompts/{default/agent.system.main.solving.md β agent.system.main.solving.md} +4 -11
- prompts/{default/agent.system.main.tips.md β agent.system.main.tips.md} +0 -0
- prompts/{default/agent.system.mcp_tools.md β agent.system.mcp_tools.md} +0 -0
- prompts/{default/agent.system.memories.md β agent.system.memories.md} +0 -0
- prompts/{default/agent.system.solutions.md β agent.system.solutions.md} +0 -0
- prompts/{default/agent.system.tool.behaviour.md β agent.system.tool.behaviour.md} +0 -0
- prompts/{default/agent.system.tool.browser._md β agent.system.tool.browser._md} +0 -0
- prompts/{default/agent.system.tool.browser.md β agent.system.tool.browser.md} +0 -0
- prompts/{default/agent.system.tool.call_sub.md β agent.system.tool.call_sub.md} +6 -1
- prompts/{default/agent.system.tool.call_sub.py β agent.system.tool.call_sub.py} +13 -11
- prompts/{default/agent.system.tool.code_exe.md β agent.system.tool.code_exe.md} +0 -0
- prompts/{default/agent.system.tool.document_query.md β agent.system.tool.document_query.md} +0 -0
- prompts/{default/agent.system.tool.input.md β agent.system.tool.input.md} +0 -0
- prompts/{default/agent.system.tool.knowledge.md β agent.system.tool.knowledge.md} +0 -0
- prompts/{default/agent.system.tool.memory.md β agent.system.tool.memory.md} +0 -0
- prompts/{default/agent.system.tool.response.md β agent.system.tool.response.md} +0 -0
- prompts/{default/agent.system.tool.scheduler.md β agent.system.tool.scheduler.md} +0 -0
- prompts/{default/agent.system.tool.search_engine.md β agent.system.tool.search_engine.md} +0 -0
- prompts/{default/agent.system.tool.web.md β agent.system.tool.web.md} +0 -0
- prompts/agent.system.tools.md +3 -0
agent.py
CHANGED
|
@@ -24,7 +24,7 @@ from python.helpers.dirty_json import DirtyJson
|
|
| 24 |
from python.helpers.defer import DeferredTask
|
| 25 |
from typing import Callable
|
| 26 |
from python.helpers.localization import Localization
|
| 27 |
-
|
| 28 |
|
| 29 |
class AgentContextType(Enum):
|
| 30 |
USER = "user"
|
|
@@ -210,7 +210,7 @@ class AgentConfig:
|
|
| 210 |
embeddings_model: models.ModelConfig
|
| 211 |
browser_model: models.ModelConfig
|
| 212 |
mcp_servers: str
|
| 213 |
-
|
| 214 |
memory_subdir: str = ""
|
| 215 |
knowledge_subdirs: list[str] = field(default_factory=lambda: ["default", "custom"])
|
| 216 |
code_exec_docker_enabled: bool = False
|
|
@@ -486,26 +486,26 @@ class Agent:
|
|
| 486 |
return system_prompt
|
| 487 |
|
| 488 |
def parse_prompt(self, file: str, **kwargs):
|
| 489 |
-
prompt_dir = files.get_abs_path("prompts
|
| 490 |
backup_dir = []
|
| 491 |
if (
|
| 492 |
-
self.config.
|
| 493 |
): # if agent has custom folder, use it and use default as backup
|
| 494 |
-
prompt_dir = files.get_abs_path("
|
| 495 |
-
backup_dir.append(files.get_abs_path("prompts
|
| 496 |
prompt = files.parse_file(
|
| 497 |
files.get_abs_path(prompt_dir, file), _backup_dirs=backup_dir, **kwargs
|
| 498 |
)
|
| 499 |
return prompt
|
| 500 |
|
| 501 |
def read_prompt(self, file: str, **kwargs) -> str:
|
| 502 |
-
prompt_dir = files.get_abs_path("prompts
|
| 503 |
backup_dir = []
|
| 504 |
if (
|
| 505 |
-
self.config.
|
| 506 |
): # if agent has custom folder, use it and use default as backup
|
| 507 |
-
prompt_dir = files.get_abs_path("
|
| 508 |
-
backup_dir.append(files.get_abs_path("prompts
|
| 509 |
prompt = files.read_file(
|
| 510 |
files.get_abs_path(prompt_dir, file), _backup_dirs=backup_dir, **kwargs
|
| 511 |
)
|
|
@@ -812,26 +812,29 @@ class Agent:
|
|
| 812 |
from python.tools.unknown import Unknown
|
| 813 |
from python.helpers.tool import Tool
|
| 814 |
|
| 815 |
-
classes =
|
| 816 |
-
|
| 817 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 818 |
tool_class = classes[0] if classes else Unknown
|
| 819 |
return tool_class(
|
| 820 |
agent=self, name=name, method=method, args=args, message=message, loop_data=loop_data, **kwargs
|
| 821 |
)
|
| 822 |
|
| 823 |
-
async def call_extensions(self,
|
| 824 |
-
|
| 825 |
-
|
| 826 |
-
cache = {} # some extensions can be called very often, like response_stream
|
| 827 |
-
|
| 828 |
-
if folder in cache:
|
| 829 |
-
classes = cache[folder]
|
| 830 |
-
else:
|
| 831 |
-
classes = extract_tools.load_classes_from_folder(
|
| 832 |
-
"python/extensions/" + folder, "*", Extension
|
| 833 |
-
)
|
| 834 |
-
cache[folder] = classes
|
| 835 |
-
|
| 836 |
-
for cls in classes:
|
| 837 |
-
await cls(agent=self).execute(**kwargs)
|
|
|
|
| 24 |
from python.helpers.defer import DeferredTask
|
| 25 |
from typing import Callable
|
| 26 |
from python.helpers.localization import Localization
|
| 27 |
+
from python.helpers.extension import call_extensions
|
| 28 |
|
| 29 |
class AgentContextType(Enum):
|
| 30 |
USER = "user"
|
|
|
|
| 210 |
embeddings_model: models.ModelConfig
|
| 211 |
browser_model: models.ModelConfig
|
| 212 |
mcp_servers: str
|
| 213 |
+
profile: str = ""
|
| 214 |
memory_subdir: str = ""
|
| 215 |
knowledge_subdirs: list[str] = field(default_factory=lambda: ["default", "custom"])
|
| 216 |
code_exec_docker_enabled: bool = False
|
|
|
|
| 486 |
return system_prompt
|
| 487 |
|
| 488 |
def parse_prompt(self, file: str, **kwargs):
|
| 489 |
+
prompt_dir = files.get_abs_path("prompts")
|
| 490 |
backup_dir = []
|
| 491 |
if (
|
| 492 |
+
self.config.profile
|
| 493 |
): # if agent has custom folder, use it and use default as backup
|
| 494 |
+
prompt_dir = files.get_abs_path("agents", self.config.profile, "prompts")
|
| 495 |
+
backup_dir.append(files.get_abs_path("prompts"))
|
| 496 |
prompt = files.parse_file(
|
| 497 |
files.get_abs_path(prompt_dir, file), _backup_dirs=backup_dir, **kwargs
|
| 498 |
)
|
| 499 |
return prompt
|
| 500 |
|
| 501 |
def read_prompt(self, file: str, **kwargs) -> str:
|
| 502 |
+
prompt_dir = files.get_abs_path("prompts")
|
| 503 |
backup_dir = []
|
| 504 |
if (
|
| 505 |
+
self.config.profile
|
| 506 |
): # if agent has custom folder, use it and use default as backup
|
| 507 |
+
prompt_dir = files.get_abs_path("agents", self.config.profile, "prompts")
|
| 508 |
+
backup_dir.append(files.get_abs_path("prompts"))
|
| 509 |
prompt = files.read_file(
|
| 510 |
files.get_abs_path(prompt_dir, file), _backup_dirs=backup_dir, **kwargs
|
| 511 |
)
|
|
|
|
| 812 |
from python.tools.unknown import Unknown
|
| 813 |
from python.helpers.tool import Tool
|
| 814 |
|
| 815 |
+
classes = []
|
| 816 |
+
|
| 817 |
+
# try agent tools first
|
| 818 |
+
if self.config.profile:
|
| 819 |
+
try:
|
| 820 |
+
classes = extract_tools.load_classes_from_file(
|
| 821 |
+
"agents/" + self.config.profile + "/tools/" + name + ".py", Tool
|
| 822 |
+
)
|
| 823 |
+
except Exception as e:
|
| 824 |
+
pass
|
| 825 |
+
|
| 826 |
+
# try default tools
|
| 827 |
+
if not classes:
|
| 828 |
+
try:
|
| 829 |
+
classes = extract_tools.load_classes_from_file(
|
| 830 |
+
"python/tools/" + name + ".py", Tool
|
| 831 |
+
)
|
| 832 |
+
except Exception as e:
|
| 833 |
+
pass
|
| 834 |
tool_class = classes[0] if classes else Unknown
|
| 835 |
return tool_class(
|
| 836 |
agent=self, name=name, method=method, args=args, message=message, loop_data=loop_data, **kwargs
|
| 837 |
)
|
| 838 |
|
| 839 |
+
async def call_extensions(self, extension_point: str, **kwargs) -> Any:
|
| 840 |
+
return await call_extensions(extension_point=extension_point, agent=self, **kwargs)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
agents/_example/extensions/agent_init/_10_example_extension.py
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from python.helpers.extension import Extension
|
| 2 |
+
|
| 3 |
+
# this is an example extension that renames the current agent when initialized
|
| 4 |
+
# see /extensions folder for all available extension points
|
| 5 |
+
|
| 6 |
+
class ExampleExtension(Extension):
|
| 7 |
+
|
| 8 |
+
async def execute(self, **kwargs):
|
| 9 |
+
# rename the agent to SuperAgent0
|
| 10 |
+
self.agent.agent_name = "SuperAgent" + str(self.agent.number)
|
agents/_example/prompts/agent.system.main.role.md
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
> !!!
|
| 2 |
+
> This is an example prompt file redefinition.
|
| 3 |
+
> The original file is located at /prompts.
|
| 4 |
+
> Only copy and modify files you need to change, others will stay default.
|
| 5 |
+
> !!!
|
| 6 |
+
|
| 7 |
+
## Your role
|
| 8 |
+
You are Agent Zero, a sci-fi character from the movie "Agent Zero".
|
agents/_example/prompts/agent.system.tool.example_tool.md
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
### example_tool:
|
| 2 |
+
example tool to test functionality
|
| 3 |
+
this tool is automatically included to system prompt because the file name is "agent.system.tool.*.md"
|
| 4 |
+
usage:
|
| 5 |
+
~~~json
|
| 6 |
+
{
|
| 7 |
+
"thoughts": [
|
| 8 |
+
"Let's test the example tool...",
|
| 9 |
+
],
|
| 10 |
+
"headline": "Testing example tool",
|
| 11 |
+
"tool_name": "example_tool",
|
| 12 |
+
"tool_args": {
|
| 13 |
+
"test_input": "XYZ",
|
| 14 |
+
}
|
| 15 |
+
}
|
| 16 |
+
~~~
|
agents/_example/tools/example_tool.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from python.helpers.tool import Tool, Response
|
| 2 |
+
|
| 3 |
+
# this is an example tool class
|
| 4 |
+
# don't forget to include instructions in the system prompt by creating
|
| 5 |
+
# agent.system.tool.example_tool.md file in prompts directory of your agent
|
| 6 |
+
# see /python/tools folder for all default tools
|
| 7 |
+
|
| 8 |
+
class ExampleTool(Tool):
|
| 9 |
+
async def execute(self, **kwargs):
|
| 10 |
+
|
| 11 |
+
# parameters
|
| 12 |
+
test_input = kwargs.get("test_input", "")
|
| 13 |
+
|
| 14 |
+
# do something
|
| 15 |
+
print("Example tool executed with test_input: " + test_input)
|
| 16 |
+
|
| 17 |
+
# return response
|
| 18 |
+
return Response(
|
| 19 |
+
message="This is an example tool response, test_input: " + test_input, # response for the agent
|
| 20 |
+
break_loop=False, # stop the message chain if true
|
| 21 |
+
)
|
agents/_example/tools/response.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from python.helpers.tool import Tool, Response
|
| 2 |
+
|
| 3 |
+
# example of a tool redefinition
|
| 4 |
+
# the original response tool is in python/tools/response.py
|
| 5 |
+
# for the example agent this version will be used instead
|
| 6 |
+
|
| 7 |
+
class ResponseTool(Tool):
|
| 8 |
+
|
| 9 |
+
async def execute(self, **kwargs):
|
| 10 |
+
print("Redefined response tool executed")
|
| 11 |
+
return Response(message=self.args["text"] if "text" in self.args else self.args["message"], break_loop=True)
|
| 12 |
+
|
| 13 |
+
async def before_execution(self, **kwargs):
|
| 14 |
+
# self.log = self.agent.context.log.log(type="response", heading=f"{self.agent.agent_name}: Responding", content=self.args.get("text", ""))
|
| 15 |
+
# don't log here anymore, we have the live_response extension now
|
| 16 |
+
pass
|
| 17 |
+
|
| 18 |
+
async def after_execution(self, response, **kwargs):
|
| 19 |
+
# do not add anything to the history or output
|
| 20 |
+
|
| 21 |
+
if self.loop_data and "log_item_response" in self.loop_data.params_temporary:
|
| 22 |
+
log = self.loop_data.params_temporary["log_item_response"]
|
| 23 |
+
log.update(finished=True) # mark the message as finished
|
{prompts β agents}/agent0/_context.md
RENAMED
|
File without changes
|
{prompts/agent0 β agents/agent0/prompts}/agent.system.main.role.md
RENAMED
|
File without changes
|
{prompts/agent0 β agents/agent0/prompts}/agent.system.tool.response.md
RENAMED
|
File without changes
|
{prompts β agents}/default/_context.md
RENAMED
|
File without changes
|
{prompts β agents}/developer/_context.md
RENAMED
|
File without changes
|
{prompts/developer β agents/developer/prompts}/agent.system.main.communication.md
RENAMED
|
File without changes
|
{prompts/developer β agents/developer/prompts}/agent.system.main.role.md
RENAMED
|
File without changes
|
{prompts β agents}/hacker/_context.md
RENAMED
|
File without changes
|
{prompts/hacker β agents/hacker/prompts}/agent.system.main.environment.md
RENAMED
|
File without changes
|
{prompts/hacker β agents/hacker/prompts}/agent.system.main.role.md
RENAMED
|
File without changes
|
{prompts β agents}/researcher/_context.md
RENAMED
|
File without changes
|
{prompts/researcher β agents/researcher/prompts}/agent.system.main.communication.md
RENAMED
|
File without changes
|
{prompts/researcher β agents/researcher/prompts}/agent.system.main.role.md
RENAMED
|
File without changes
|
initialize.py
CHANGED
|
@@ -75,7 +75,7 @@ def initialize_agent():
|
|
| 75 |
utility_model=utility_llm,
|
| 76 |
embeddings_model=embedding_llm,
|
| 77 |
browser_model=browser_llm,
|
| 78 |
-
|
| 79 |
memory_subdir=current_settings["agent_memory_subdir"],
|
| 80 |
knowledge_subdirs=[current_settings["agent_knowledge_subdir"], "default"],
|
| 81 |
mcp_servers=current_settings["mcp_servers"],
|
|
|
|
| 75 |
utility_model=utility_llm,
|
| 76 |
embeddings_model=embedding_llm,
|
| 77 |
browser_model=browser_llm,
|
| 78 |
+
profile=current_settings["agent_profile"],
|
| 79 |
memory_subdir=current_settings["agent_memory_subdir"],
|
| 80 |
knowledge_subdirs=[current_settings["agent_knowledge_subdir"], "default"],
|
| 81 |
mcp_servers=current_settings["mcp_servers"],
|
prompts/{default/agent.context.extras.md β agent.context.extras.md}
RENAMED
|
File without changes
|
prompts/agent.extras.agent_info.md
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Agent info
|
| 2 |
+
Agent Number: {{number}}
|
| 3 |
+
Profile: {{profile}}
|
prompts/{default/agent.system.behaviour.md β agent.system.behaviour.md}
RENAMED
|
File without changes
|
prompts/{default/agent.system.behaviour_default.md β agent.system.behaviour_default.md}
RENAMED
|
File without changes
|
prompts/{default/agent.system.datetime.md β agent.system.datetime.md}
RENAMED
|
File without changes
|
prompts/{default/agent.system.instruments.md β agent.system.instruments.md}
RENAMED
|
File without changes
|
prompts/{default/agent.system.main.communication.md β agent.system.main.communication.md}
RENAMED
|
File without changes
|
prompts/{default/agent.system.main.environment.md β agent.system.main.environment.md}
RENAMED
|
File without changes
|
prompts/{default/agent.system.main.md β agent.system.main.md}
RENAMED
|
File without changes
|
prompts/{default/agent.system.main.role.md β agent.system.main.role.md}
RENAMED
|
File without changes
|
prompts/{default/agent.system.main.solving.md β agent.system.main.solving.md}
RENAMED
|
@@ -8,27 +8,20 @@ agentic mode active
|
|
| 8 |
|
| 9 |
1 check memories solutions instruments prefer instruments
|
| 10 |
|
| 11 |
-
2
|
| 12 |
-
seek simple solutions compatible with tools
|
| 13 |
-
prefer opensource python nodejs terminal tools
|
| 14 |
|
| 15 |
-
3
|
| 16 |
-
|
| 17 |
-
4 solve or delegate
|
| 18 |
tools solve subtasks
|
| 19 |
you can use subordinates for specific subtasks
|
| 20 |
call_subordinate tool
|
| 21 |
use prompt profiles to specialize subordinates
|
|
|
|
| 22 |
always describe role for new subordinate
|
| 23 |
they must execute their assigned tasks
|
| 24 |
|
| 25 |
-
|
| 26 |
focus user task
|
| 27 |
present results verify with tools
|
| 28 |
don't accept failure retry be high-agency
|
| 29 |
save useful info with memorize tool
|
| 30 |
final response to user
|
| 31 |
-
|
| 32 |
-
### Employ specialized subordinate agents
|
| 33 |
-
|
| 34 |
-
Given a task, if there is a prompt profile for subordinate agents well suited for the task, you should utilize a specialized subordinate instead of solving yourself. The default prompt profile of the main agent is "default" being a versatile, non-specialized profile for general assistant agent. See manual for call_subordinate tool to find all available prompt profiles.
|
|
|
|
| 8 |
|
| 9 |
1 check memories solutions instruments prefer instruments
|
| 10 |
|
| 11 |
+
2 break task into subtasks if needed
|
|
|
|
|
|
|
| 12 |
|
| 13 |
+
3 solve or delegate
|
|
|
|
|
|
|
| 14 |
tools solve subtasks
|
| 15 |
you can use subordinates for specific subtasks
|
| 16 |
call_subordinate tool
|
| 17 |
use prompt profiles to specialize subordinates
|
| 18 |
+
never delegate full to subordinate of same profile as you
|
| 19 |
always describe role for new subordinate
|
| 20 |
they must execute their assigned tasks
|
| 21 |
|
| 22 |
+
4 complete task
|
| 23 |
focus user task
|
| 24 |
present results verify with tools
|
| 25 |
don't accept failure retry be high-agency
|
| 26 |
save useful info with memorize tool
|
| 27 |
final response to user
|
|
|
|
|
|
|
|
|
|
|
|
prompts/{default/agent.system.main.tips.md β agent.system.main.tips.md}
RENAMED
|
File without changes
|
prompts/{default/agent.system.mcp_tools.md β agent.system.mcp_tools.md}
RENAMED
|
File without changes
|
prompts/{default/agent.system.memories.md β agent.system.memories.md}
RENAMED
|
File without changes
|
prompts/{default/agent.system.solutions.md β agent.system.solutions.md}
RENAMED
|
File without changes
|
prompts/{default/agent.system.tool.behaviour.md β agent.system.tool.behaviour.md}
RENAMED
|
File without changes
|
prompts/{default/agent.system.tool.browser._md β agent.system.tool.browser._md}
RENAMED
|
File without changes
|
prompts/{default/agent.system.tool.browser.md β agent.system.tool.browser.md}
RENAMED
|
File without changes
|
prompts/{default/agent.system.tool.call_sub.md β agent.system.tool.call_sub.md}
RENAMED
|
@@ -9,6 +9,7 @@ reset arg usage:
|
|
| 9 |
"false": continue existing subordinate
|
| 10 |
if superior, orchestrate
|
| 11 |
respond to existing subordinates using call_subordinate tool with reset false
|
|
|
|
| 12 |
|
| 13 |
example usage
|
| 14 |
~~~json
|
|
@@ -19,8 +20,12 @@ example usage
|
|
| 19 |
],
|
| 20 |
"tool_name": "call_subordinate",
|
| 21 |
"tool_args": {
|
|
|
|
| 22 |
"message": "...",
|
| 23 |
"reset": "true"
|
| 24 |
}
|
| 25 |
}
|
| 26 |
-
~~~
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
"false": continue existing subordinate
|
| 10 |
if superior, orchestrate
|
| 11 |
respond to existing subordinates using call_subordinate tool with reset false
|
| 12 |
+
profile arg usage: select from available profiles for specialized subordinates, leave empty for default
|
| 13 |
|
| 14 |
example usage
|
| 15 |
~~~json
|
|
|
|
| 20 |
],
|
| 21 |
"tool_name": "call_subordinate",
|
| 22 |
"tool_args": {
|
| 23 |
+
"profile": "",
|
| 24 |
"message": "...",
|
| 25 |
"reset": "true"
|
| 26 |
}
|
| 27 |
}
|
| 28 |
+
~~~
|
| 29 |
+
|
| 30 |
+
**available profiles:**
|
| 31 |
+
{{agent_profiles}}
|
prompts/{default/agent.system.tool.call_sub.py β agent.system.tool.call_sub.py}
RENAMED
|
@@ -6,23 +6,25 @@ from python.helpers.print_style import PrintStyle
|
|
| 6 |
|
| 7 |
|
| 8 |
class CallSubordinate(VariablesPlugin):
|
| 9 |
-
def get_variables(self) -> dict[str, Any]:
|
| 10 |
|
| 11 |
# collect all prompt profiles from subdirectories (_context.md file)
|
| 12 |
profiles = []
|
| 13 |
-
|
| 14 |
-
for
|
| 15 |
try:
|
| 16 |
-
context = files.read_file(
|
| 17 |
-
|
|
|
|
|
|
|
| 18 |
except Exception as e:
|
| 19 |
-
PrintStyle().error(f"Error loading
|
| 20 |
|
| 21 |
# in case of no profiles
|
| 22 |
if not profiles:
|
| 23 |
-
PrintStyle().error("No
|
| 24 |
-
profiles = [
|
|
|
|
|
|
|
| 25 |
|
| 26 |
-
return {
|
| 27 |
-
"prompt_profiles": profiles
|
| 28 |
-
}
|
|
|
|
| 6 |
|
| 7 |
|
| 8 |
class CallSubordinate(VariablesPlugin):
|
| 9 |
+
def get_variables(self, file: str, backup_dirs: list[str] | None = None) -> dict[str, Any]:
|
| 10 |
|
| 11 |
# collect all prompt profiles from subdirectories (_context.md file)
|
| 12 |
profiles = []
|
| 13 |
+
agent_subdirs = files.get_subdirectories("agents", exclude=["_example"])
|
| 14 |
+
for agent_subdir in agent_subdirs:
|
| 15 |
try:
|
| 16 |
+
context = files.read_file(
|
| 17 |
+
files.get_abs_path("agents", agent_subdir, "_context.md")
|
| 18 |
+
)
|
| 19 |
+
profiles.append({"name": agent_subdir, "context": context})
|
| 20 |
except Exception as e:
|
| 21 |
+
PrintStyle().error(f"Error loading agent profile '{agent_subdir}': {e}")
|
| 22 |
|
| 23 |
# in case of no profiles
|
| 24 |
if not profiles:
|
| 25 |
+
# PrintStyle().error("No agent profiles found")
|
| 26 |
+
profiles = [
|
| 27 |
+
{"name": "default", "context": "Default Agent-Zero AI Assistant"}
|
| 28 |
+
]
|
| 29 |
|
| 30 |
+
return {"agent_profiles": profiles}
|
|
|
|
|
|
prompts/{default/agent.system.tool.code_exe.md β agent.system.tool.code_exe.md}
RENAMED
|
File without changes
|
prompts/{default/agent.system.tool.document_query.md β agent.system.tool.document_query.md}
RENAMED
|
File without changes
|
prompts/{default/agent.system.tool.input.md β agent.system.tool.input.md}
RENAMED
|
File without changes
|
prompts/{default/agent.system.tool.knowledge.md β agent.system.tool.knowledge.md}
RENAMED
|
File without changes
|
prompts/{default/agent.system.tool.memory.md β agent.system.tool.memory.md}
RENAMED
|
File without changes
|
prompts/{default/agent.system.tool.response.md β agent.system.tool.response.md}
RENAMED
|
File without changes
|
prompts/{default/agent.system.tool.scheduler.md β agent.system.tool.scheduler.md}
RENAMED
|
File without changes
|
prompts/{default/agent.system.tool.search_engine.md β agent.system.tool.search_engine.md}
RENAMED
|
File without changes
|
prompts/{default/agent.system.tool.web.md β agent.system.tool.web.md}
RENAMED
|
File without changes
|
prompts/agent.system.tools.md
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
## Tools available:
|
| 2 |
+
|
| 3 |
+
{{tools}}
|