← Back to Blog

⬢ The Intern’s Best Friend: A Guide to Fearless Development

Welcome to the team! You want to move fast, but you also don’t want to be the reason everyone’s pager goes off at 3:00 AM. hexarch-guardrails 0.4.6b1 is your personal safety net that sits between your experimental code and the real world.

1. Why You Need This

In a shared development environment, a simple mistake can have big consequences:

  • The Accidental Wipe: A cleanup script deletes too much data.
  • The “Infinite” Loop: An AI prompt loop costs hundreds of dollars in minutes.
  • The Off‑Hours Alert: Test emails sent to 10,000 real customers at 3:00 AM.

2. Setting Up Your Personal Safety Net

Wrap sensitive functions with a guardian decorator:

from hexarch_guardrails import Guardian

guardian = Guardian()

@guardian.check("api_budget")
def my_experimental_ai_function(prompt):
    # Go ahead and experiment!
    # Hexarch will stop you if you exceed the $10 budget.
    pass

3. How to Use Guardrails Safely

  • Don’t Ignore the PolicyViolation: When blocked, treat it as a signal to double‑check intent.
  • Use the confirm Flag for Big Changes: Make destructive actions require explicit confirmation.
  • Check Your Logs: The audit system tells you exactly why something was blocked.

4. Pro‑Tip: Safe Experimentation Mode

Define your own rules in hexarch.yaml to keep experiments safe:

  • Ultra‑low budgets for personal API keys.
  • Restrict destructive operations to specific hours.
  • Add warnings at 50% of limits so you get early notice.

Python and Virtual Environment

Part 1: How to Install Python from Scratch

Step 1: Download Python

  1. Visit the official Python Downloads page.
  2. The site should automatically suggest the best version for your operating system (e.g., Python 3.12.x). Click the Download Python button.

Step 2: Run the Installer

  • For Windows (Crucial): Open the installer and ensure you check the box that says “Add Python 3.x to PATH” before clicking Install Now. This allows you to run Python from any command prompt.
  • For macOS: Open the .pkg file and follow the standard installation prompts.

Step 3: Verify Installation

  1. Open your Terminal (macOS) or Command Prompt/PowerShell (Windows).
  2. Type python --version and press Enter. If it displays “Python 3.x.x,” you’ve successfully installed it.

Part 2: Setting Up a Virtual Environment

A virtual environment is a self‑contained folder that contains its own Python installation and unique set of libraries. This ensures that the tools you install for one project don’t break another.

1. Create Your Project Folder

Open your terminal and create a new directory for your work:

mkdir my-safe-project
cd my-safe-project

2. Create the Virtual Environment

Run the following command to create a folder named venv that will hold your environment:

python -m venv venv

3. Activate the Environment

You must “activate” the environment so your terminal knows to use it:

  • Windows: venv\Scripts\activate
  • macOS/Linux: source venv/bin/activate

Once activated, you will usually see (venv) appear at the start of your command prompt line.


Part 3: Installing Hexarch Guardrails

Now that your environment is active, you can safely install the library and its optional extras:

# Basic installation
pip install hexarch-guardrails==0.4.6b1

# Recommended: Install with CLI and Postgres support for full auditing
pip install "hexarch-guardrails[cli,postgres]==0.4.6b1"

Intern Safety Mode: Your hexarch.yaml

As discussed, place this hexarch.yaml file in your my-safe-project folder to enable your “safety net”:

# Intern Safety Mode - Strict Local Limits
policies:
    - id: "api_budget"
        description: "Ultra-strict budget for learning"
        rules:
            - resource: "openai"
                monthly_budget: 5           # Hard limit of $5/month
                action: "block"
            - resource: "openai"
                warn_at_percent: 50         # Warning at $2.50
                action: "warn"

    - id: "safe_delete"
        description: "Never delete without a double-check"
        rules:
            - operation: "delete"
                action: "require_confirmation"

Move fast, but keep the guardrails on. It’s better to see a “Blocked” entry in your audit log than a “Critical” page in Slack.