Environment and Configuration
The Svantic CLI resolves configuration from three sources in order of precedence: CLI flags, environment variables, and built-in defaults.Precedence
Environment Variables
Place variables in a
.env file in the working directory. The CLI loads it automatically.
CLI Flags
Configuration File
The CLI reads configuration from~/.svantic/config.json:
Authentication
Chat Commands
Interactive and headless modes require mesh credentials. The auth flow:- CLI reads
client_idandclient_secretfrom flags or environment variables. - Calls
MeshAuth.get_token()on the Mesh API, passing credentials. - Mesh returns a JWT with tenant context.
- CLI calls
POST /sessions/initon the gateway with the JWT. - Gateway returns a
session_idfor subsequent messages.
MeshConnector.connect().
Admin Commands
Admin commands (status, tenants, agents, sessions, config) require a JWT token:
~/.svantic/config.json.
Token Refresh
If a session expires while idle, the terminal automatically:- Re-authenticates to get a fresh JWT.
- Creates a new session via the gateway.
- Retries the message transparently.
Forge Mode
Forge commands (svantic forge tool, svantic forge agent) run locally and do not require mesh credentials.
The only relevant environment variable is:
GOOGLE_API_KEY— required when using--promptfor AI-powered tool generation.
Setting Up a .env File
Create a .env file in your working directory:
Troubleshooting
”Mesh credentials required”
SVANTIC_CLIENT_ID and SVANTIC_CLIENT_SECRET in your .env file or pass them as flags.
”Auth error: HTTP 401”
SVANTIC_CLIENT_ID and SVANTIC_CLIENT_SECRET are correct. Check that the credentials have not expired or been revoked.
”Connection error”
SVANTIC_URL (default: https://api.svantic.com). Check network connectivity.
”Session expired”
The terminal printsSession expired (reaped); re-initializing... and retries automatically. If re-initialization fails, check that your credentials are still valid and the gateway is reachable.
”Could not reach gateway”
SVANTIC_URL is correct. Check network connectivity. Ensure the Svantic platform is reachable.