agent-zero icon indicating copy to clipboard operation
agent-zero copied to clipboard

BUG: image_get used for downloading python script

Open tbystrican opened this issue 3 months ago • 0 comments

Version M v0.9.5-2 25-09-03 19:03

I was trying to save simple python script and download from the agent. There were two issues:

  1. the Download link is using image_get .. I am not sure if that is correct or if the aim is to use image_get to also get other than image files.
  2. ValueError: Path is outside of allowed directory
Image
ai: {
    "thoughts": [
        "This is a new conversation, I should greet the user warmly and let them know I'm ready to help.",
        "I'll use the response tool with proper JSON formatting to demonstrate the expected structure.",
        "Including some friendly emojis will set a welcoming tone for our conversation."
    ],
    "headline": "Greeting user and starting conversation",
    "tool_name": "response",
    "tool_args": {
        "text": "**Hello! šŸ‘‹**, I'm **Agent Zero**, your AI assistant. How can I help you today?"
    }
}


user: {"user_message": "write simple hello world python script save it to filesystem and provide download link"}
ai: {
    "thoughts": [
        "I need to create a simple Python script that prints 'Hello, World!'.",
        "I'll use the code_execution_tool to write this script to the filesystem using Python.",
        "The script will be saved to /root/hello_world.py as per file handling guidelines.",
        "After saving, I'll provide a download link using the img:/// format convention, though this is typically for images - the system will handle the file appropriately."
    ],
    "headline": "Creating and saving hello world Python script",
    "tool_name": "code_execution_tool",
    "tool_args": {
        "runtime": "python",
        "session": 0,
        "code": "with open('/root/hello_world.py', 'w') as f:\n    f.write('print(\"Hello, World!\")\\n')"
    }
}
user: {"tool_name": "code_execution_tool", "tool_result": "((venv) ) root@1cbc9e42b7c0:/#"}
ai: {
    "thoughts": [
        "The Python script has been successfully saved to /root/hello_world.py",
        "Now I need to provide the user with a way to access this file",
        "Following the pattern from past solutions, I'll use the img:/// format to reference the file path",
        "I'll create a response that includes the download link and information about the script"
    ],
    "headline": "Providing download link for hello world script",
    "tool_name": "response",
    "tool_args": {
        "text": "I've created a simple Hello World Python script and saved it to the filesystem.\n\nšŸ“„ **Script Content:**\n```python\nprint(\"Hello, World!\")\n```\n\nšŸ“„ **Download:**\nYou can download the script using this link: [hello_world.py](img:///root/hello_world.py)\n\nTo run the script, execute `python /root/hello_world.py` in the terminal."
    }
}
Traceback (most recent call last):
Traceback (most recent call last):
  File "/a0/python/helpers/api.py", line 63, in handle_request
    output = await self.process(input_data, request)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/a0/python/api/image_get.py", line 32, in process
    raise ValueError("Path is outside of allowed directory")
ValueError: Path is outside of allowed directory


ValueError: Path is outside of allowed directory

tbystrican avatar Sep 22 '25 23:09 tbystrican