Back to articles
Technology Insight

Building Enterprise AI Guardrails: Deploying OpenWebUI Pipelines for Content Moderation on a VPS

June 3, 2026

Introduction: The Necessity of AI Guardrails in the Enterprise Landscape

As generative Artificial Intelligence (AI) and Large Language Models (LLMs) transition from experimental novelties to core enterprise assets, security and compliance have taken center stage. While LLMs offer unprecedented productivity gains, they also introduce significant risks: data leaks (IP and PII), toxic or inappropriate outputs, and hallucinations that could compromise corporate liability.

For enterprises deploying self-hosted AI solutions to maintain absolute data sovereignty, relying on third-party cloud moderation APIs is often a non-starter. This is where OpenWebUI Pipelines comes into play. By leveraging an open-source, modular framework deployed on a Virtual Private Server (VPS), businesses can implement a robust, localized content filtering system—commonly known as Guardrails. This technical guide explores how to architecture, deploy, and configure OpenWebUI Pipelines to serve as an intelligent firewall for your enterprise LLM ecosystem.

Understanding OpenWebUI Pipelines as an AI Middleware

OpenWebUI has established itself as one of the premier user interfaces for managing local and remote LLMs. However, its true enterprise potential is unlocked through Pipelines, a plugin architecture that allows developers to intercept, modify, and filter data streams moving between the user and the AI model.

Functioning effectively as a specialized middleware, a pipeline can execute code at two critical junctures:

  • Inlet (Pre-processing): Intercepts the user's prompt before it reaches the LLM. This is where we scan for Personally Identifiable Information (PII), corporate secrets, or malicious prompt injections.
  • Outlet (Post-processing): Intercepts the LLM's response before it is displayed to the user. This stage filters out hallucinations, profanity, competitor mentions, or non-compliant language.

By hosting this architecture on an independent VPS, enterprises ensure low-latency processing, total environment isolation, and complete control over the underlying data pipelines without recurring external API costs.

Architecting the Infrastructure on a VPS

To run a resilient guardrail system, your VPS requires an optimized stack. Since OpenWebUI Pipelines runs as a stateless Python microservice, it does not require heavy GPU infrastructure unless you choose to run localized embedding models for moderation. A standard CPU-optimized VPS is typically sufficient.

Recommended VPS Specifications

  • CPU: 4 vCPUs (Compute-optimized)
  • RAM: 8 GB RAM minimum
  • Storage: 50 GB NVMe SSD
  • OS: Ubuntu 22.04 LTS / 24.04 LTS

The Conceptual Architecture

In a standard enterprise deployment, the architecture follows a structured sequence. The user interacts with the OpenWebUI Frontend, which communicates with the Pipelines Container. The pipeline executes the compliance logic, passes the sanitized prompt to the Ollama/vLLM backend, and evaluates the generated answer before delivering it back to the client application.

Step-by-Step Deployment Guide

1. Environment Preparation

First, update your system packages and install the fundamental containerization tools, Docker and Docker Compose:

sudo apt update && sudo apt upgrade -y
sudo apt install docker.io docker-compose -y
sudo systemctl enable --now docker

2. Configuring OpenWebUI and Pipelines via Docker Compose

Create a dedicated directory and define a docker-compose.yml file to orchestrate the services seamlessly. This setup links OpenWebUI directly with the Pipelines container over an isolated internal network.

version: '3.8'

services:
  openwebui:
    image: ghcr.io/open-webui/open-webui:main
    container_name: openwebui
    ports:
      - "3000:8080"
    volumes:
      - openwebui_data:/app/backend/data
    environment:
      - 'OPENAI_API_BASE_URLS=http://pipelines:9099'
      - 'OPENAI_API_KEYS=enterprise_secure_key'
    restart: always
    networks:
      - ai-network

  pipelines:
    image: ghcr.io/open-webui/pipelines:main
    container_name: pipelines
    ports:
      - "9099:9099"
    volumes:
      - pipelines_data:/app/pipelines
    restart: always
    networks:
      - ai-network

networks:
  ai-network:
    driver: bridge

volumes:
  openwebui_data:
  pipelines_data:

Deploy the stack by running docker-compose up -d. Your core infrastructure is now operational.

Implementing Custom Guardrail Pipelines

The core value of OpenWebUI Pipelines lies in its programmatic flexibility. You can write custom Python scripts to enforce specific business logic. Below, we examine two practical blueprints for enterprise compliance.

Blueprint 1: The PII and Secret Leak Prevention Inlet

This inlet pipeline uses Regular Expressions (Regex) and basic text processing to scan incoming prompts for sensitive information, such as credit card numbers, social security records, or internal code flags, blocking the request if a violation occurs.

Security Tip: For advanced deployments, replace basic regex with a localized spaCy model or Microsoft Presidio container within the same VPS network to perform high-accuracy Named Entity Recognition (NER).

import re
from typing import Dict, Any

class Pipeline:
    def __init__(self):
        self.name = "Enterprise Compliance Guard"
        # Basic regex patterns for PII detection
        self.pii_patterns = [
            r'\b\d{4}[-\s]?\d{4}[-\s]?\d{4}[-\s]?\d{4}\b', # Credit Cards
            r'\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b' # Emails
        ]

    async def inlet(self, body: Dict[str, Any], user: Dict[str, Any]) -> Dict[str, Any]:
        messages = body.get("messages", [])
        if not messages:
            return body
        
        last_user_message = messages[-1]["content"]
        
        for pattern in self.pii_patterns:
            if re.search(pattern, last_user_message):
                raise Exception("Security Violation: Your request contains forbidden PII or sensitive corporate data.")
        
        return body

Blueprint 2: The Toxic Content and Brand Alignment Outlet

The outlet pipeline evaluates the model's output before it reaches the end user. It scans for restricted keywords, profane terms, or phrases that run counter to enterprise brand guidelines.

class Pipeline:
    def __init__(self):
        self.name = "Brand Safety Filter"
        self.restricted_words = ["unreliable", "competitor-alpha", "guaranteed profit"]

    async def outlet(self, body: Dict[str, Any], user: Dict[str, Any]) -> Dict[str, Any]:
        messages = body.get("messages", [])
        if not messages:
            return body
            
        # Analyze the generated response
        assistant_response = messages[-1]["content"]
        
        for word in self.restricted_words:
            if word.lower() in assistant_response.lower():
                messages[-1]["content"] = "[Policy Notice: The generated response was omitted as it violated internal enterprise compliance standards.]"
                break
                
        return body

Best Practices for Enterprise Guardrails Optimization

Deploying guardrails is an iterative process. To maintain system reliability and user satisfaction, observe the following production standards:

  1. Minimize Pipeline Latency: Keep your Python code efficient. Avoid synchronous I/O blocking or heavy API calls inside the loops. Use asyncio where possible.
  2. Implement Comprehensive Logging: Ensure that all intercepted prompts and violations are logged to a secure syslog or SIEM tool for compliance audits, making sure the logs themselves do not store the sensitive PII being filtered.
  3. Enforce Regular Expression Updates: Enterprise guidelines evolve. Maintain your filters and update regex libraries frequently to account for new product names, internal project code words, and updated compliance laws.
  4. Graceful Degradation: Design filters to fail safely. If a pipeline microservice encounters an unhandled exception, it should block the output rather than letting unmonitored content bypass security.

Conclusion

Implementing OpenWebUI Pipelines on a secure VPS grants enterprises complete sovereignty over their AI compliance strategy. By constructing customized inlet and outlet guardrails, businesses can confidently deploy powerful LLM solutions to their workforces while mitigating security, privacy, and brand risks. With a self-hosted architecture, security is no longer an obstacle to innovation; instead, it becomes the foundation upon which scalable, enterprise-grade AI applications are built.

Building Enterprise AI Guardrails: Deploying OpenWebUI Pipelines for Content Moderation on a VPS | DPTCloud