The CLICommandTool is a meta-tool that enables BDI agents to execute the system's top-level CLI commands through a standardized interface. It acts as a bridge between agent planning and system-level operations, providing controlled access to critical mindX management functions.
File: tools/cli_command_tool.py
Class: CLICommandTool
Version: 1.0.0
Status: ✅ Active
class CLICommandTool(BaseTool):
- mastermind: MastermindAgent reference
- coordinator: CoordinatorAgent reference
- command_map: Dict[str, Callable] - Maps command names to handlers
evolvemastermind.manage_mindx_evolution{"command_name": "evolve", "args": {...}}deploymastermind.manage_agent_deployment{"command_name": "deploy", "args": {...}}agent_createcoordinator.create_and_register_agent{"command_name": "agent_create", "args": {"agent_type": "...", ...}}agent_deletecoordinator.deregister_and_shutdown_agent{"command_name": "agent_delete", "args": {"agent_id": "..."}}agent_evolvecoordinator.handle_user_input (adapted){"command_name": "agent_evolve", "args": {"id": "...", "directive": "..."}}from tools.cli_command_tool import CLICommandTool
from orchestration.mastermind_agent import MastermindAgent
from orchestration.coordinator_agent import CoordinatorAgent
Initialize tool
tool = CLICommandTool(
mastermind=mastermind_agent,
coordinator=coordinator_agent
)
Execute command
result = await tool.execute(
command_name="evolve",
args={"directive": "Improve system performance"}
)
# Success
{
"status": "SUCCESS",
"result": {...} # Command-specific result
}
Error
{
"status": "ERROR",
"message": "Error description"
}
The tool is designed to be used by BDI agents in their planning and execution phases:
# In agent plan
plan = [
{
"action": "execute_cli_command",
"command": "agent_create",
"args": {"agent_type": "analysis_agent"}
}
]
The tool requires active MastermindAgent and CoordinatorAgent instances, making it suitable for high-level orchestration tasks.
agent_evolve command uses a simplified Interaction object constructioncore.bdi_agent.BaseTool - Base tool classorchestration.mastermind_agent.MastermindAgent - Mastermind agentorchestration.coordinator_agent.CoordinatorAgent - Coordinator agentAll errors are caught and returned as structured error responses:
try:
result = await handler(**args)
return {"status": "SUCCESS", "result": result}
except Exception as e:
logger.error(f"Error executing CLI command '{command_name}': {e}")
return {"status": "ERROR", "message": str(e)}
result = await tool.execute(
command_name="agent_create",
args={
"agent_type": "analysis_agent",
"agent_id": "analysis_001",
"config": {...}
}
)
result = await tool.execute(
command_name="evolve",
args={
"directive": "Improve memory management efficiency",
"focus_areas": ["memory", "performance"]
}
)