BashTool provides agents with the ability to interact with terminal applications that require back-and-forth communication, such as Pythonβs interactive mode, ipython, database CLIs, and other REPL environments. This enables agents to execute commands within these interactive sessions, receive output, and send follow-up commands based on the results.
This example is available on GitHub: examples/01_standalone_sdk/06_interactive_terminal_w_reasoning.py
examples/01_standalone_sdk/06_interactive_terminal_w_reasoning.py
Running the Example
How It Works
BashTool is configured with a no_change_timeout_seconds parameter that determines how long to wait for terminal updates before sending the output back to the agent.
In the example above, the agent should:
- Enters Pythonβs interactive mode by running
python3 - Executes Python code to get the current time
- Exits the Python interpreter
BashTool maintains the session state throughout these interactions, allowing the agent to send multiple commands within the same terminal session. Review the BashTool and terminal source code to better understand how the interactive session is configured and managed.
Next Steps
- Custom Tools - Create your own tools for specific use cases

