Shell

ShellTools enable an Agent to interact with the shell to run commands.

Example

The following agent will run a shell command and show contents of the current directory.

Note

Mention your OS to the agent to make sure it runs the correct command.

1from kern.agent import Agent
2from kern.tools.shell import ShellTools
3
4agent = Agent(tools=[ShellTools()])
5agent.print_response("Show me the contents of the current directory", markdown=True)

Toolkit Params

ParameterTypeDefaultDescription
base_dir`Pathstr`None
enable_run_shell_commandboolTrueEnables functionality to run shell commands
allboolFalseEnables all functionality when set to True

Toolkit Functions

FunctionDescription
run_shell_commandRuns a shell command and returns the output or error.

Developer Resources