File System Access in Docker Environment

Im experiencing difficulties with file system access when using the Code Tool connected to an AI Agent in our n8n deployment. I would appreciate clarification on the recommended approach for my use case. I need the AI Agent to execute Python code that can read and write files on the local file system (mounted Docker volume).
Current Setup:

n8n running in Docker container
Volume mounted to the container for file storage
AI Agent workflow with Code Tool for Python execution

Issues Encountered:

  1. Regular Execution Mode (EXECUTIONS_MODE=regular):

Python code executed by the Code Tool runs in an isolated environment
No access to the mounted volume/local file system
Cannot read or write files despite volume being mounted to the container

  1. Queue Mode with Runners (EXECUTIONS_MODE=queue N8N_RUNNERS_ENABLED=true):

Even more restrictive execution environment
Unable to execute basic operations (e.g., os.getuser())
Error: “Security rules violated”

Questions:

Is it possible to configure the Code Tool to access mounted volumes in either execution mode?
Are there specific security settings or environment variables we need to configure to allow file system access?
What is the recommended architecture for our use case where an AI Agent needs to process local files through Python code execution?

Environment Details:

n8n version: 1.116.2
Deployment: Docker Compose
Execution modes tested: regular, queue with runners

Thank you for your assistance!