ShellTools enable an Assistant to interact with the shell.

Example

The following assistant will run a shell command and show contents of the current directory. Note: Mention your OS to the assistant to make sure it runs the correct command.

cookbook/tools/shell_tools.py
from phi.assistant import Assistant
from phi.tools.shell import ShellTools

assistant = Assistant(tools=[ShellTools()], show_tool_calls=True)
assistant.print_response("Show me the contents of the current directory", markdown=True)

Functions in Toolkit

run_shell_command

Runs a shell command and returns the output or error.