Configuration & Setup
Configure CrashLens for your project and CI/CD pipeline
đź“‹ Overview
CrashLens provides flexible configuration options for both interactive setup and automated CI/CD environments. Choose the method that best fits your workflow.
🚀 Interactive Setup
Run the interactive setup wizard to configure CrashLens for your project:
# Initialize CrashLens in your project
crashlens init
# Follow the interactive prompts to:
# 1. Select policy templates (retry-loop-prevention, model-overkill-detection, etc.)
# 2. Choose severity threshold (low/medium/high/critical)
# 3. Configure monitoring platform (Langfuse, Helicone)
# 4. Set up GitHub Actions workflow (optional)
Configuration File Structure
The setup creates .crashlens/config.yaml
:
# .crashlens/config.yaml
policy_template: retry-loop-prevention,model-overkill-detection
severity_threshold: high
fail_on_violations: true
logs_source: langfuse
created_at: '2025-08-11T10:30:00.000000'
version: 2.5.1
output_directory: .
workflow_config:
python_version: "3.11"
fail_on_violations: true
api_keys:
langfuse_secret_key: ""
langfuse_public_key: ""
helicone_api_key: ""
🤖 Non-Interactive Setup
For automated environments like CI/CD, use environment variables:
# Set configuration via environment variables
export CRASHLENS_TEMPLATES="retry-loop-prevention,model-overkill-detection,budget-protection"
export CRASHLENS_SEVERITY="high"
export CRASHLENS_FAIL_ON_VIOLATIONS="true"
export CRASHLENS_LOGS_SOURCE="langfuse"
export CRASHLENS_CREATE_WORKFLOW="true"
# Run non-interactive setup
crashlens init --non-interactive
đź”§ GitHub Actions Setup
Automatic Workflow Creation
When running crashlens init
, select “Yes” for GitHub workflow creation. This generates a complete workflow file:
name: 'CrashLens Policy Check'
on:
workflow_dispatch:
inputs:
config_file:
description: 'Path to CrashLens config file'
required: false
default: '.crashlens/config.yaml'
pull_request:
branches: [ main, develop ]
push:
branches: [ main, develop ]
jobs:
crashlens-check:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install CrashLens
run: pip install crashlens
- name: Run Policy Check
env:
LANGFUSE_SECRET_KEY: ${{ secrets.LANGFUSE_SECRET_KEY }}
LANGFUSE_PUBLIC_KEY: ${{ secrets.LANGFUSE_PUBLIC_KEY }}
HELICONE_API_KEY: ${{ secrets.HELICONE_API_KEY }}
run: |
crashlens policy-check logs/*.jsonl --policy-template all --fail-on-violations
🔑 Environment Variables
Set these in your repository secrets for the workflow to access your monitoring platforms:
# Required for Langfuse integration
LANGFUSE_SECRET_KEY=your_secret_key
LANGFUSE_PUBLIC_KEY=your_public_key
# Required for Helicone integration
HELICONE_API_KEY=your_api_key
🚀 Next Steps
Configure API Keys
Set up your monitoring platform credentials in repository secrets
Test the Workflow
Trigger a manual run to verify everything works correctly
Explore Usage
Check out our Usage & Commands guide for advanced features