Server Modes
The NeMo Guardrails server supports two modes:Multi-Config Mode
In multi-config mode, the server can serve multiple guardrails configurations:Single-Config Mode
In single-config mode, the server serves a single configuration:Server Options
Command-Line Options
integer
default:"8000"
The port that the server should listen on.
path
Path to a directory containing configuration sub-folders (multi-config mode) or a single configuration directory (single-config mode).
string
The default configuration to use when no config is specified in requests.
boolean
default:"false"
Enable verbose logging including prompts and LLM calls.
boolean
default:"false"
Disable the built-in chat UI.
boolean
default:"false"
Enable automatic reloading when configuration files change.
string
default:""
A prefix that should be added to all server paths (must start with ’/’).
Environment Variables
CORS Configuration
string
default:"false"
Enable Cross-Origin Resource Sharing (CORS).
string
default:"*"
Comma-separated list of allowed origins. Use ”*” to allow all origins.
Model Configuration
string
default:"openai"
The default LLM provider when model is specified in request.
string
Base URL for the LLM provider API.
string
Default configuration ID to use.
Server Configuration File
You can create aconfig.py file in your configs directory to customize server behavior:
config.py
API Endpoints
GET /v1/rails/configs
List available guardrails configurations.GET /v1/models
List available LLM models from the configured provider.POST /v1/chat/completions
See Chat Completions API for details.Thread Management
The server supports conversation threads for maintaining state across requests.Using Threads
Custom Datastore
By default, threads are stored in memory. You can configure a custom datastore:config.py
Auto-Reload
Enable auto-reload to automatically reload configurations when files change:watchdog package:
Chat UI
The server includes a built-in chat UI accessible athttp://localhost:8000.
To disable the chat UI:
Production Deployment
Using Gunicorn
Using Docker
Dockerfile