# Purpose of config.py in the Hiring-Agent Repository: Development Mode Configuration

> Understand the purpose of config.py in the hiring-agent repository. Learn how the DEVELOPMENT_MODE flag controls caching and logging for development.

- Repository: [HackerRank/hiring-agent](https://github.com/interviewstreet/hiring-agent)
- Tags: internals
- Published: 2026-07-04

---

**The [`config.py`](https://github.com/interviewstreet/hiring-agent/blob/main/config.py) file in the interviewstreet/hiring-agent repository defines a single global `DEVELOPMENT_MODE` flag that toggles development-time behaviors including API response caching and verbose logging across the application.**

The [`config.py`](https://github.com/interviewstreet/hiring-agent/blob/main/config.py) module serves as the central configuration hub for the Hiring Agent application, providing a single source of truth for environment-wide settings. Located in the root of the interviewstreet/hiring-agent repository, this lightweight module enables consistent runtime behavior without cluttering business logic with duplicated constants.

## What is config.py in the Hiring-Agent Repository?

[`config.py`](https://github.com/interviewstreet/hiring-agent/blob/main/config.py) is a minimal but essential configuration module that establishes a clean separation between runtime configuration and business logic. According to the interviewstreet/hiring-agent source code, the file exports a single boolean constant `DEVELOPMENT_MODE` that other components import to determine whether to execute development-specific behaviors.

This pattern eliminates the need for multiple modules to define their own environment detection logic. Instead, any file in the codebase can simply import the flag and react consistently to the current environment state.

## How DEVELOPMENT_MODE Controls Runtime Behavior

The `DEVELOPMENT_MODE` flag drives three primary categories of behavior throughout the Hiring Agent codebase.

### Caching API Responses to Disk

When `DEVELOPMENT_MODE` evaluates to `True`, the application checks for and writes cached files on disk to avoid unnecessary network requests. In [`score.py`](https://github.com/interviewstreet/hiring-agent/blob/main/score.py), the code uses this flag to determine whether to read evaluation scores from a local cache or fetch fresh data. Similarly, [`github.py`](https://github.com/interviewstreet/hiring-agent/blob/main/github.py) relies on the flag to decide whether to store GitHub API responses locally between runs.

### Verbose Logging and Debug Output

The flag controls the verbosity of console output and exception handling. When enabled, modules emit extra debug information and raise detailed exceptions that aid in troubleshooting. This conditional logging prevents production environments from leaking sensitive debugging data while giving developers full visibility during local development.

### Future Feature Toggles

The centralized nature of [`config.py`](https://github.com/interviewstreet/hiring-agent/blob/main/config.py) provides a ready extension point for additional environment-wide switches. New configuration values can be added to this module, ensuring that all runtime adjustments remain located in a single, discoverable location rather than scattered across multiple files.

## Implementation Pattern in the Codebase

The Hiring Agent repository follows a consistent import pattern when accessing configuration values. Here is how modules typically consume the `DEVELOPMENT_MODE` flag:

```python
from config import DEVELOPMENT_MODE

def fetch_data(url):
    # In development we try to reuse a cached response

    if DEVELOPMENT_MODE and os.path.exists("cache.json"):
        with open("cache.json") as f:
            return json.load(f)

    # Normal network request for production

    response = requests.get(url)
    response.raise_for_status()
    return response.json()

```

This pattern appears throughout the repository, with [`score.py`](https://github.com/interviewstreet/hiring-agent/blob/main/score.py) and [`github.py`](https://github.com/interviewstreet/hiring-agent/blob/main/github.py) implementing similar conditional logic to handle caching and debug output based on the global flag.

## Key Files That Depend on config.py

The following modules in the interviewstreet/hiring-agent repository import from [`config.py`](https://github.com/interviewstreet/hiring-agent/blob/main/config.py) to drive environment-specific behavior:

- **[`score.py`](https://github.com/interviewstreet/hiring-agent/blob/main/score.py)** – Uses `DEVELOPMENT_MODE` to control caching of evaluation scores and candidate assessments
- **[`github.py`](https://github.com/interviewstreet/hiring-agent/blob/main/github.py)** – Applies the flag for GitHub API response caching and conditional debug information emission
- **[`config.py`](https://github.com/interviewstreet/hiring-agent/blob/main/config.py)** – Defines the `DEVELOPMENT_MODE` constant and serves as the single source of truth for global settings

## Summary

- **[`config.py`](https://github.com/interviewstreet/hiring-agent/blob/main/config.py) defines `DEVELOPMENT_MODE`**, a global boolean flag that controls development-time behaviors across the Hiring Agent application.
- **Caching logic** in [`score.py`](https://github.com/interviewstreet/hiring-agent/blob/main/score.py) and [`github.py`](https://github.com/interviewstreet/hiring-agent/blob/main/github.py) checks this flag before reading from or writing to local disk caches.
- **Verbose logging and debug output** are conditionally enabled based on the configuration value imported from this module.
- **Centralized configuration** prevents duplication of constants and provides a single location for environment-wide settings.

## Frequently Asked Questions

### What is the purpose of config.py in the hiring-agent repository?

[`config.py`](https://github.com/interviewstreet/hiring-agent/blob/main/config.py) provides a centralized location for global configuration constants, specifically exporting a `DEVELOPMENT_MODE` flag that the entire codebase imports to toggle behaviors like API caching and debug logging. This ensures consistency across modules without duplicating environment detection logic.

### How does DEVELOPMENT_MODE affect API caching in the codebase?

When `DEVELOPMENT_MODE` is `True`, modules like [`score.py`](https://github.com/interviewstreet/hiring-agent/blob/main/score.py) and [`github.py`](https://github.com/interviewstreet/hiring-agent/blob/main/github.py) check for existing cache files on disk before making network requests, and they write responses to disk for reuse. In production mode, these caching shortcuts are bypassed to ensure fresh data.

### Why is config.py separated from other modules in the repository?

Separating configuration into a dedicated module creates a clean architectural boundary between runtime settings and business logic. This allows any component to import configuration values without creating circular dependencies or scattering magic constants throughout the codebase.

### Which modules import from config.py in the hiring-agent repository?

The primary consumers are [`score.py`](https://github.com/interviewstreet/hiring-agent/blob/main/score.py), which handles evaluation score caching, and [`github.py`](https://github.com/interviewstreet/hiring-agent/blob/main/github.py), which manages GitHub API interactions and debugging output. Both modules import `DEVELOPMENT_MODE` directly from `config` to determine their runtime behavior.