The Terminal Toolkit provides a secure and powerful way for CAMEL agents to interact with a terminal. It allows agents to execute shell commands, manage files, and even ask for human help, all within a controlled, sandboxed environment.
Secure Sandboxed Execution
All file-writing and execution commands are restricted to a designated
working_directory
to prevent unintended system modifications. Dangerous commands are blocked by default.Multi-Session Management
Run multiple, independent terminal sessions concurrently. Each session maintains its own state and history, allowing for complex, parallel workflows.
Virtual Environment Management
Automatically create and manage isolated Python virtual environments, ensuring that package installations and script executions donβt conflict with your system setup.
Human-in-the-Loop
When an agent gets stuck, it can pause its execution and request human assistance. A human can then take over the terminal session to resolve the issue before handing control back.
Initialization
To get started, initialize theTerminalToolkit
. You can configure its behavior, such as the working directory and environment settings.
- Default
- Custom Workspace
- Cloned Environment
Usage Examples
Executing Commands
Theshell_exec
function is the primary way to execute commands. Each command is run within a session, identified by a unique id
.
- Listing Files
- Running a Python Script
Interacting with Processes
You can manage long-running or interactive processes.- Writing to a Process
- Killing a Process
You can write to a processβs standard input using
shell_write_to_process
. This is useful for interactive command-line tools.Safe Mode
Whensafe_mode
is enabled (default), the toolkit blocks commands that could be harmful to your system.
Example of a Blocked Command
Human-in-the-Loop
When an agent gets stuck, it can useask_user_for_help
to request human intervention.