---
title: "Deploy n8n Assistant Sandbox"
description: "Makes n8n's AI Assistant work on Railway: code sandbox and web search."
category: "Automation"
url: https://railway.com/deploy/n8n-assistant-sandbox
---

# Deploy n8n Assistant Sandbox

Makes n8n's AI Assistant work on Railway: code sandbox and web search.

**[Deploy n8n Assistant Sandbox on Railway](https://railway.com/template/n8n-assistant-sandbox)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/n8n-assistant-sandbox/manifest.json

- **Creator:** AvgSoft
- **Category:** Automation

## Template content

### Sandbox https://cdn.jsdelivr.net/gh/mikedepo/railway-template-assets@f95ab043c4509d98d39d4594702ed23b76d5c740/service-icons/n8n-assistant-sandbox.svg

- **Image:** ghcr.io/mikedepo/n8n-assistant-sandbox:0.1.0
- **Health check:** /healthz

### SearXNG https://cdn.jsdelivr.net/gh/mikedepo/railway-template-assets@97f1a9a9aff615a39ad26a0afa0a3c8226bd820f/service-icons/searxng.svg

- **Image:** ghcr.io/searxng/searxng:2026.10.29-cff884f98
- **Start command:** `sh -c "mkdir -p /etc/searxng && echo dXNlX2RlZmF1bHRfc2V0dGluZ3M6IHRydWUKc2VhcmNoOgogIGZvcm1hdHM6CiAgICAtIGh0bWwKICAgIC0ganNvbgo= | base64 -d > /etc/searxng/settings.yml && exec /usr/local/searxng/entrypoint.sh"`
- **Health check:** /healthz

## Documentation

# Deploy and Host n8n Assistant Sandbox on Railway

n8n's AI Assistant builds and fixes workflows from a chat, but it needs a code sandbox that Railway can't normally run. Add this template to your n8n's project and the Assistant works, with web search included.

![Your n8n connected to n8n Assistant Sandbox and web search](https://cdn.jsdelivr.net/gh/mikedepo/railway-template-assets@382afb870e2e4bf9f9982ba0249cd56bc010a0f4/n8n-assistant-sandbox/banner.png)

## About Hosting n8n Assistant Sandbox

Needs n8n 2.44 or later and the Hobby plan: the Sandbox uses up to 0.9 GB while the Assistant builds a workflow.

### Connect it to your n8n

1. In your n8n's project, click **Add**, then **Template**, pick **n8n Assistant Sandbox** and click **Deploy Template**.
2. Open your n8n service and look at its **Variables** tab. If `N8N_ENCRYPTION_KEY` isn't listed, go to its **Console** tab, type `cat ~/.n8n/config`, press Enter and copy the `encryptionKey` value. Without it, the redeploy below locks n8n out of its own data.
3. Back in the **Variables** tab, click **Raw Editor**. If you copied a key, add `N8N_ENCRYPTION_KEY=the-key-you-copied` on a new line. Paste this block below it, then click **Update Variables**:

```
N8N_INSTANCE_AI_SANDBOX_ENABLED=true
N8N_INSTANCE_AI_SANDBOX_PROVIDER=n8n-sandbox
N8N_INSTANCE_AI_SANDBOX_API_URL=http://${{Sandbox.RAILWAY_PRIVATE_DOMAIN}}:8080
N8N_SANDBOX_SERVICE_URL=http://${{Sandbox.RAILWAY_PRIVATE_DOMAIN}}:8080
N8N_SANDBOX_SERVICE_API_KEY=${{Sandbox.SANDBOX_API_KEYS}}
N8N_INSTANCE_AI_SEARXNG_URL=http://${{SearXNG.RAILWAY_PRIVATE_DOMAIN}}:8080
```

4. Click **Deploy** on the bar that lists your changes, and wait for n8n to restart.
5. In n8n, open **Assistant** and click **Get started**. The sandbox and web search are already set up: choose your AI provider and paste its API key (how to get an OpenAI key is below).

![Add the template to your n8n's project and paste the block](https://cdn.jsdelivr.net/gh/mikedepo/railway-template-assets@382afb870e2e4bf9f9982ba0249cd56bc010a0f4/n8n-assistant-sandbox/connect-to-n8n.png)

![Create an OpenAI key and paste it into n8n's Assistant](https://cdn.jsdelivr.net/gh/mikedepo/railway-template-assets@382afb870e2e4bf9f9982ba0249cd56bc010a0f4/n8n-assistant/connect-openai.png)

## Common Use Cases

- Build workflows from a chat
- Debug failed executions
- Search API docs

## Dependencies for n8n Assistant Sandbox Hosting

- Sandbox
- SearXNG

### Deployment Dependencies

- [Set up n8n Assistant](https://docs.n8n.io/deploy/host-n8n/configure-n8n/set-up-n8n-assistant)

### Implementation Details

![n8n Assistant Sandbox architecture](https://cdn.jsdelivr.net/gh/mikedepo/railway-template-assets@382afb870e2e4bf9f9982ba0249cd56bc010a0f4/n8n-assistant-sandbox/architecture.png)

Sandboxes share one service. A Railway project token in its `RAILWAY_TOKEN` variable gives each conversation its own Railway Sandbox VM instead.

## Why Deploy n8n Assistant Sandbox on Railway?

Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying n8n Assistant Sandbox on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.

**Updated 2026-10-29:** First release.


## Similar templates

- [N8N Main + Worker](https://railway.com/deploy/n8n-main-worker) — Deploy and Host N8N with Inactive worker.
- [Evolution API with n8n](https://railway.com/deploy/evolution-api-with-n8n) — Automate WhatsApp workflows with Evolution API, n8n, and Postgres.
- [Postgres Backup](https://railway.com/deploy/postgres-s3-backups) — Cron-based PostgreSQL backup to bucket storage

Open this page in a browser: https://railway.com/deploy/n8n-assistant-sandbox
