Principle:Guardrails ai Guardrails CLI Configuration
| Knowledge Sources | |
|---|---|
| Domains | Configuration, CLI |
| Last Updated | 2026-02-14 00:00 GMT |
Overview
A configuration management principle that establishes local credentials and preferences for interacting with the Guardrails Hub ecosystem.
Description
CLI Configuration is the initialization step that sets up a local environment for using Guardrails validators. It manages the creation and persistence of a configuration file (~/.guardrailsrc) that stores authentication tokens for the Guardrails Hub, metric collection preferences, and remote inference settings. Without configuration, validators cannot authenticate with the Hub for installation or remote execution.
The configuration principle follows a credential-file pattern common in CLI tools (similar to ~/.npmrc or ~/.pypirc), where sensitive tokens and preferences are stored locally and loaded automatically by the framework's settings singleton on startup.
Usage
Apply this principle when initializing a new development environment for Guardrails, when rotating API keys, or when changing between local and remote inference modes. This is always the first step before installing validators from the Hub.
Theoretical Basis
The configuration pattern follows a layered settings architecture:
- User provides credentials via CLI prompts or command-line flags
- Framework persists credentials to a well-known file path (~/.guardrailsrc)
- Settings singleton loads credentials on framework initialization
- Downstream components (Hub client, validators, telemetry) read from the singleton
This separation ensures that sensitive credentials are never hardcoded and can be rotated independently of application code.