Skip to main content

Overview

Shell tool allows you to execute shell commands from your AI agents. Use with caution!

Installation

pip install "praisonai[tools]"

Quick Start

from praisonai_tools import ShellTool

# Initialize
shell = ShellTool()

# Execute command
result = shell.execute("ls -la")
print(result)

Usage with Agent

from praisonaiagents import Agent
from praisonai_tools import ShellTool

agent = Agent(
    name="SysAdmin",
    instructions="You help with system administration tasks.",
    tools=[ShellTool()]
)

response = agent.chat("List all Python processes")
print(response)

Available Methods

execute(command)

Execute a shell command.
from praisonai_tools import ShellTool

shell = ShellTool()
result = shell.execute("echo 'Hello World'")

Security Warning

⚠️ Use with caution! Shell commands can be dangerous. Consider:
  • Restricting allowed commands
  • Running in sandboxed environments
  • Validating user input

Common Errors

ErrorCauseSolution
Command not foundInvalid commandCheck command exists
Permission deniedInsufficient permissionsCheck file permissions
  • Python - Execute Python code
  • Docker - Container management