In the implementation of the class BashTool , when __call__ is executed with an optional pre-configured bash session, the session is never started (since self.session is not None) so when the agent tries to use the bash tool, it gets
Request:
Method: tools/call
Tool: bash
Arguments: {
"command": "find /build -type f -name \"*.c\" -o -name \"*.h\" | head -20"
}
Response:
Error calling tool 'bash': Session has not started. [192ms]
Also, when the session is restarted, the new session defaults to the base class _BashSession instead of the pre-configured one. For example, if we created a subclass to have the bash commands executed as a specific user
class AgentBashSession(_BashSession):
command: str = "sudo -u agent /bin/bash"
it would mean that if the agent restarts the bash tool, it would be able to execute the commands as root.