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
| Variable | Description | Default | Required |
|---|---|---|---|
SVANTIC_CLIENT_ID | Client ID for mesh authentication | (none) | Yes (chat modes) |
SVANTIC_CLIENT_SECRET | Client secret for mesh authentication | (none) | Yes (chat modes) |
SVANTIC_URL | Svantic platform URL. The edge routes everything (session init, registration, agent dispatch) to the right internal service. | https://api.svantic.com | No |
SVANTIC_TOKEN | JWT token for admin commands | (none) | Yes (admin) |
GOOGLE_API_KEY | Google API key for AI-powered forge generation | (none) | Only for forge --prompt |
.env file in the working directory. The CLI loads it automatically.
CLI Flags
| Flag | Description | Env var override |
|---|---|---|
--svantic-url <url> | Svantic platform URL | SVANTIC_URL |
--model <name> | LLM model name (e.g., gemini-2.5-pro) | (none) |
--session <id> | Reuse an existing session ID | (none) |
--client-id <id> | Client ID for mesh auth | SVANTIC_CLIENT_ID |
--client-secret <sec> | Client secret for mesh auth | SVANTIC_CLIENT_SECRET |
--headless | Run in headless mode (no interactive UI) | (none) |
--message <text> | Message to send in headless mode | (none) |
--verbose | Show full tool call/result JSON | (none) |
--help, -h | Show help and exit | (none) |
Configuration File
The CLI reads configuration from~/.svantic/config.json:
| Key | Description |
|---|---|
svantic_url | Svantic platform URL (used by admin commands) |
token | JWT token for admin commands |
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.