Principle:Guardrails ai Guardrails API Server Installation
| Knowledge Sources | |
|---|---|
| Domains | Deployment, Installation |
| Last Updated | 2026-02-14 00:00 GMT |
Overview
An installation principle for adding server-mode capabilities to a Guardrails installation through optional dependency extras.
Description
API Server Installation extends the base Guardrails package with server capabilities by installing the guardrails-api optional extra. The base package provides the Guard class and validators for in-process use, while the [api] extra adds the HTTP server infrastructure (FastAPI/Flask application, REST endpoints, health checks) needed for deploying Guards as a standalone service.
This follows the optional extras pattern common in Python packaging, keeping the base package lightweight while supporting advanced deployment modes.
Usage
Install with pip install "guardrails-ai[api]" when you plan to deploy Guards as an HTTP service. Not needed for in-process validation.
Theoretical Basis
The optional extras pattern provides:
- Minimal base: Core Guard and Validator functionality without server dependencies
- Opt-in server: [api] extra adds guardrails-api which provides FastAPI/Flask server
- Auto-install fallback: The guardrails start CLI command auto-installs the API extra if missing