# Environment Variables Required for Each LLM Provider in interviewstreet/hiring-agent

> Discover essential environment variables for LLM providers in interviewstreet/hiring-agent. Learn about DEFAULT_MODEL, LLM_PROVIDER, and GEMINI_API_KEY for seamless integration.

- Repository: [HackerRank/hiring-agent](https://github.com/interviewstreet/hiring-agent)
- Tags: how-to-guide
- Published: 2026-07-14

---

**The interviewstreet/hiring-agent repository requires three specific environment variables—`DEFAULT_MODEL`, `LLM_PROVIDER`, and `GEMINI_API_KEY`—to configure Large Language Model providers, with only `GEMINI_API_KEY` being mandatory when using Google Gemini models.**

The `interviewstreet/hiring-agent` open-source project centralizes its LLM configuration through environment-based settings read at runtime. Understanding what environment variables are required for each LLM provider ensures proper authentication and model routing without unexpected fallbacks.

## Core Configuration Variables

The application reads all LLM settings in **[`prompt.py`](https://github.com/interviewstreet/hiring-agent/blob/main/prompt.py)** using Python's `os.getenv` method. These variables determine which model executes your prompts and whether API credentials are needed.

### DEFAULT_MODEL

The **`DEFAULT_MODEL`** variable specifies which model name the agent invokes during inference. It maps directly to provider-specific model identifiers.

- **Environment Variable**: `DEFAULT_MODEL`
- **Default Value**: `"gemma3:4b"` (defined as `DEFAULT_MODEL_NAME` in the source)
- **Provider Impact**: Used by both Ollama and Gemini providers to identify the specific model weights

### LLM_PROVIDER

The **`LLM_PROVIDER`** variable identifies which backend serves the requests. This determines the code path taken and which authentication checks run.

- **Environment Variable**: `LLM_PROVIDER`
- **Default Value**: `"ollama"` (derived from `ModelProvider.OLLAMA.value`)
- **Valid Options**: Values must match the `ModelProvider` enum defined in **[`models.py`](https://github.com/interviewstreet/hiring-agent/blob/main/models.py)** (e.g., `"ollama"`, `"gemini"`)

### GEMINI_API_KEY

The **`GEMINI_API_KEY`** variable stores your Google API credential. This is the only secret required among the environment variables, and it is mandatory exclusively for Gemini deployments.

- **Environment Variable**: `GEMINI_API_KEY`
- **Default Value**: Empty string `""`
- **When Required**: Only when `LLM_PROVIDER` is set to `"gemini"`

## How Configuration Loading Works in prompt.py

The central configuration logic resides in **[`prompt.py`](https://github.com/interviewstreet/hiring-agent/blob/main/prompt.py)**, where the application validates provider selections and applies defaults:

```python

# prompt.py (excerpt)

DEFAULT_MODEL = os.getenv("DEFAULT_MODEL", DEFAULT_MODEL_NAME)
PROVIDER = os.getenv("LLM_PROVIDER", DEFAULT_PROVIDER.value)

# Validate provider

if PROVIDER not in [p.value for p in ModelProvider]:
    PROVIDER = DEFAULT_PROVIDER.value

# API key for Gemini

GEMINI_API_KEY = os.getenv("GEMINI_API_KEY", "")

```

The code first attempts to read each variable from the environment, falling back to hard-coded defaults when variables are missing. It then validates the provider string against the **`ModelProvider`** enum imported from **[`models.py`](https://github.com/interviewstreet/hiring-agent/blob/main/models.py)**, reverting to `"ollama"` if an invalid value is supplied.

## Practical Configuration Examples

Below are concrete implementations showing how to set these environment variables for different deployment scenarios.

### Configuring for Gemini

When using Google's Gemini models, you must export all three variables:

```bash

# .env file

DEFAULT_MODEL=gemini-2.5-pro
LLM_PROVIDER=gemini
GEMINI_API_KEY=sk-xxxxxxxxxxxxxxxxxxxx

```

```python

# Python validation

import os
from prompt import DEFAULT_MODEL, PROVIDER, GEMINI_API_KEY

print(f"Using model: {DEFAULT_MODEL}")
print(f"Provider: {PROVIDER}")

if PROVIDER == "gemini":
    assert GEMINI_API_KEY, "GEMINI_API_KEY must be set for Gemini models"
    # Initialize Gemini client...

```

### Running with Default Ollama Setup

If you omit environment variables entirely, the agent defaults to a local Ollama instance:

```bash
$ python main.py

# Executes with DEFAULT_MODEL="gemma3:4b" and LLM_PROVIDER="ollama"

```

No API keys are required for this configuration.

## Summary

- **`DEFAULT_MODEL`** controls which model weights load, defaulting to `"gemma3:4b"`
- **`LLM_PROVIDER`** selects the backend implementation, defaulting to `"ollama"` and validated against the `ModelProvider` enum in **[`models.py`](https://github.com/interviewstreet/hiring-agent/blob/main/models.py)**
- **`GEMINI_API_KEY`** is the only mandatory secret, required exclusively when `LLM_PROVIDER=gemini`
- All configuration logic is centralized in **[`prompt.py`](https://github.com/interviewstreet/hiring-agent/blob/main/prompt.py)** using standard `os.getenv` calls

## Frequently Asked Questions

### What happens if I don't set any environment variables?

The application runs using bundled defaults defined in **[`prompt.py`](https://github.com/interviewstreet/hiring-agent/blob/main/prompt.py)**: `DEFAULT_MODEL` becomes `"gemma3:4b"` and `LLM_PROVIDER` becomes `"ollama"`. No API keys are required for this local-only configuration.

### Is GEMINI_API_KEY required for Ollama models?

No. The **`GEMINI_API_KEY`** variable is only evaluated when **`LLM_PROVIDER`** resolves to `"gemini"`. When using Ollama (the default), the code ignores this variable entirely, allowing the application to run without any API credentials.

### Where are the provider values validated?

Provider strings are validated against the **`ModelProvider`** enum in **[`models.py`](https://github.com/interviewstreet/hiring-agent/blob/main/models.py)**. If the `LLM_PROVIDER` environment variable contains an invalid value not present in the enum, **[`prompt.py`](https://github.com/interviewstreet/hiring-agent/blob/main/prompt.py)** automatically falls back to `"ollama"` as a safety measure.

### Where can I find a template for these variables?

The repository includes an **`.env.example`** file at the root level that documents the expected variable names and example values for both Ollama and Gemini configurations. This serves as the authoritative reference for environment setup.