Skip to content

About

Resources

Stars

2 stars

Watchers

1 watching

Forks

Repository files navigation

πŸ›οΈ Project Olympus

Autonomous SRE Engine β€” Self-Healing Code Repair at Scale

Clone a repo. Find the bug. Patch it. Verify it. Open a PR. Automatically.

Live Demo API Backend

FastAPI Next.js LangGraph ChromaDB Docker Semgrep Python License: MIT


What is Project Olympus?

Project Olympus is a fully autonomous Site Reliability Engineering (SRE) agent that detects, patches, validates, and deploys code fixes β€” without human intervention. Point it at any GitHub repository, and it will:

  1. Clone the repository into an isolated workspace
  2. Localize the failing file autonomously via pytest traceback analysis
  3. Generate a patch using a cascading multi-LLM fallback chain (Groq β†’ OpenRouter β†’ Gemini)
  4. Gate the patch through a static security scanner (Semgrep) before touching any real file
  5. Validate the fix by running the full test suite inside a clean Docker sandbox
  6. Learn from each failure β€” past bad patches are stored in a vector memory to prevent oscillation
  7. Commit the verified patch to a new branch with a Sigstore cryptographic attestation
  8. Open a GitHub Pull Request with a full summary β€” automatically

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              Next.js Frontend  (:3000)                              β”‚
β”‚   Control Terminal Β· Live Log Console Β· Pipeline Graph Β· Diff View  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                        β”‚ HTTP / SSE                   β”‚ GitHub Webhook
                        β–Ό                              β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                FastAPI Backend  (:8000)                              β”‚
β”‚    /api/v1/trigger  Β·  /api/v1/stream/{run_id}  Β·  /github-webhook  β”‚
β”‚    Workspace Manager  Β·  Fault Localizer  Β·  Run Logger (SSE bus)   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                β”‚ invoke(initial_state)
                                β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              LangGraph StateGraph Agent Engine                       β”‚
β”‚                                                                      β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   patch     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”             β”‚
β”‚  β”‚   Patch Agent    β”‚ ──────────► β”‚ Validation Agent β”‚             β”‚
β”‚  β”‚                  β”‚             β”‚                  β”‚             β”‚
β”‚  β”‚  Β· RAG retrieval β”‚ ◄── retry ──│  Β· Docker pytest β”‚             β”‚
β”‚  β”‚  Β· LLM fallback  β”‚             β”‚  Β· Root-cause    β”‚             β”‚
β”‚  β”‚  Β· SAST gate     β”‚             β”‚    isolation     β”‚             β”‚
β”‚  β”‚  Β· Git commit    β”‚             β”‚  Β· Memory write  β”‚             β”‚
β”‚  β”‚  Β· Sigstore sign β”‚             β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜             β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                      β”‚                       β”‚
β”‚                                     PASS ──┼──► GitHub PR          β”‚
β”‚                                   max att ─┴──► Human Gate         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚                β”‚                 β”‚
         β–Ό                β–Ό                 β–Ό
    ChromaDB           SQLite          Artifacts
  (RAG + Memory)   (patch_logs)    (.diff + .sigstore)

Key Features

Feature Description
πŸ€– Autonomous Fault Localization Runs pytest, parses tracebacks, and pinpoints the failing source file automatically
🧠 Dual RAG System Tree-sitter AST-chunked code + ChromaDB for semantic code retrieval
πŸ” Anti-Oscillation Memory Past failed patches are vectorized and injected as "don't repeat" lessons
⚑ Multi-LLM Fallback Groq β†’ OpenRouter β†’ Gemini β€” never blocked by a single rate limit
πŸ›‘οΈ SAST Hard Gate Semgrep scans proposed code in a temp file; bad patches never touch real files
🐳 Docker Sandboxed Validation Tests run in a clean python:3.11-slim container β€” no host contamination
πŸ” Sigstore Attestation Every committed patch is cryptographically signed with keyless Sigstore OIDC
πŸ“‘ Real-Time SSE Streaming Live log output streamed from agent nodes to the browser as the pipeline runs
πŸ”— GitHub PR Automation Verified patches are automatically pushed and opened as pull requests
🌐 Webhook Integration Listens for GitHub events to trigger autonomous repair pipelines

Tech Stack

Backend

  • FastAPI + Uvicorn β€” async REST API & SSE streaming
  • LangGraph β€” typed StateGraph agent orchestration
  • LangChain β€” LLM integration (Groq, OpenRouter, Gemini)
  • ChromaDB β€” local persistent vector store
  • Tree-sitter β€” AST-level code chunking & symbol extraction
  • Semgrep β€” static application security testing
  • Sigstore β€” keyless cryptographic patch attestation
  • PyGithub β€” GitHub PR automation
  • GitPython β€” local git operations
  • OpenTelemetry β€” distributed trace spans
  • SQLite β€” lightweight relational audit log

Frontend

Infrastructure

  • Docker β€” isolated olympus-sandbox test container

Getting Started

Prerequisites

Requirement Version Notes
Python 3.11+ Backend runtime
Node.js 18+ Frontend runtime
Docker Latest Required for sandbox validation
Git Any Repo cloning & patch management
Semgrep Latest Optional β€” SAST gate gracefully degrades

1. Clone the Repository

git clone https://github.com/Aviral445/Olympus-Agent.git
cd Olympus-Agent/olympus-agent

2. Configure Environment Variables

Create a .env file in the olympus-agent/ directory:

# LLM Providers (at least one required β€” Groq is recommended as primary)
GROQ_API_KEY=your_groq_api_key_here
OPENROUTER_API_KEY=your_openrouter_api_key_here
GEMINI_API_KEY=your_gemini_api_key_here

# GitHub Integration (required for PR automation)
GITHUB_TOKEN=your_github_personal_access_token
GITHUB_REPO=owner/repo-name

Get your API keys:

3. Build the Docker Sandbox

cd backend
docker build -t olympus-sandbox .

4. Set Up & Run the Backend

cd olympus-agent/backend

# Create and activate virtual environment (optional but recommended)
python -m venv venv

# Windows (PowerShell):
.\venv\Scripts\Activate.ps1
# macOS / Linux:
source venv/bin/activate

# Install all backend Python dependencies
pip install -r requirements.txt

# Start the FastAPI backend server
python src/server.py
# Backend server runs at http://localhost:8000

5. Set Up & Run the Frontend

cd olympus-agent/frontend

# Create local environment config
cp .env.local.example .env.local

# Add your GitHub OAuth app credentials to .env.local:
# GITHUB_CLIENT_ID=your_id
# GITHUB_CLIENT_SECRET=your_secret

# Install Node dependencies
npm install

# Start Next.js development server
npm run dev
# Frontend UI available at http://localhost:3000

6. Open the Dashboard

Navigate to http://localhost:3000 and you will see the Olympus Control Terminal.


Usage

Option A β€” Via the Web UI

  1. Enter a GitHub repository URL (e.g. https://github.com/username/repo)
  2. Optionally specify a target file β€” leave blank for autonomous fault detection
  3. Set max repair attempts (slider, 1–200)
  4. Click "Clone & Trigger Autonomous Fix"
  5. Watch the Live Log Console and Pipeline Graph update in real time
  6. On success, view the Diff Viewer and click the auto-generated PR link

Option B β€” Via the REST API

# Trigger a repair pipeline
curl -X POST http://localhost:8000/api/v1/trigger \
  -H "Content-Type: application/json" \
  -d '{
    "repo_url": "https://github.com/username/your-repo",
    "target_file": "src/app.py",
    "max_attempts": 10
  }'

# Stream logs via SSE
curl -N http://localhost:8000/api/v1/stream/<run_id>

Option C β€” GitHub Webhook

Configure a GitHub repository webhook:

  • Payload URL: http://your-server:8000/api/v1/github-webhook
  • Content type: application/json
  • Events: Push, Issues, or any event you would like to trigger repairs

API Reference

POST /api/v1/trigger

Field Type Required Description
repo_url string No Full GitHub repo URL to clone
repo_name string No owner/repo format
target_file string No Relative path to buggy file. Leave blank to auto-detect
max_attempts int No Max repair loop iterations (default: 5, max: 200)
bug_description string No Human-readable context

Response: { "status": "initiated", "run_id": "uuid", "message": "..." }

GET /api/v1/stream/{run_id}

SSE stream. Emits two event types:

  • { "type": "log", "message": "..." } β€” per-action log line
  • { "type": "complete", "result": "PASS|FAIL", "diff": "..." } β€” final result

GET /health

Returns { "status": "healthy", "service": "Project Olympus SRE Engine" }


How It Works β€” The Repair Loop

Patch Agent                          Validation Agent
──────────────────────────────       ──────────────────────────────
1. Read target file content          1. docker run olympus-sandbox
2. Index codebase (Tree-sitter)         pytest tests/ --tb=short
3. RAG: fetch top-3 code chunks
4. Memory: fetch top-2 failure       2. exit 0 β†’ record PASS
   lessons (anti-oscillation)              β†’ open GitHub PR
5. Build LLM prompt
6. Groq β†’ OpenRouter β†’ Gemini        3. exit 1 β†’ record FAIL
7. Write to .olympus_tmp                   β†’ isolate root-cause file
8. Semgrep SAST scan ←── FAIL: discard    β†’ retry patch agent
9. Atomic os.replace to target file
10. git checkout -B olympus/patch-N
11. git add + commit
12. sigstore sign .diff

Project Structure

olympus-agent/
β”œβ”€β”€ .env                          # API keys and config
β”œβ”€β”€ frontend/                     # Next.js 16 + TypeScript + Tailwind
β”‚   β”œβ”€β”€ app/page.tsx              # Main UI: terminal, logs, graph, diff
β”‚   └── components/
β”‚       β”œβ”€β”€ graph-flow/           # AgentGraph pipeline step visualizer
β”‚       β”œβ”€β”€ diff-viewer/          # Git diff renderer
β”‚       └── telemetry/            # OTel metrics display
└── backend/
    β”œβ”€β”€ Dockerfile                # olympus-sandbox (python:3.11-slim + pytest)
    β”œβ”€β”€ artifacts/                # Signed .diff and .sigstore.json bundles
    β”œβ”€β”€ workspaces/               # Runtime-cloned external repos
    β”œβ”€β”€ database/db.py            # SQLite schema + logging
    β”œβ”€β”€ rag/
    β”‚   β”œβ”€β”€ code_rag.py           # Tree-sitter AST chunking + ChromaDB indexer
    β”‚   └── patch_memory.py       # Failure memory + anti-oscillation
    └── src/
        β”œβ”€β”€ server.py             # FastAPI entrypoint + pipeline runner
        β”œβ”€β”€ agents/core_graph.py  # LangGraph StateGraph
        └── utils/
            β”œβ”€β”€ attestation.py    # Sigstore diff signing
            β”œβ”€β”€ git_manager.py    # Branch, diff, commit
            β”œβ”€β”€ github_pr.py      # PyGithub PR creation
            β”œβ”€β”€ run_logger.py     # Thread-safe SSE log bus
            β”œβ”€β”€ sandbox.py        # Docker subprocess executor
            β”œβ”€β”€ sast_scanner.py   # Semgrep wrapper
            └── telemetry.py      # OpenTelemetry spans

Environment Variables

Variable Required Description
GROQ_API_KEY Recommended Primary LLM (llama-3.3-70b-versatile)
OPENROUTER_API_KEY Optional Tier-2 LLM fallback (openrouter/auto)
GEMINI_API_KEY Optional Tier-3 LLM fallback (gemini-2.0-flash)
GITHUB_TOKEN For PRs PAT with repo scope
GITHUB_REPO Optional Default repo if not in webhook payload

Roadmap

  • Multi-file patch support β€” fix bugs spanning multiple source files
  • Streaming diff preview β€” show incremental diffs as they are generated
  • Replay mode β€” re-run any historical run from the SQLite audit log
  • Plugin LLM providers β€” Anthropic Claude, Mistral, local Ollama
  • Docker Compose setup β€” single-command full-stack launch
  • Web dashboard for run history β€” searchable table with diffs and outcomes
  • Kubernetes Helm chart β€” production SRE deployment manifests

Contributing

Contributions are welcome!

  1. Fork the repository
  2. Create a feature branch: git checkout -b feat/your-feature-name
  3. Make your changes with tests where applicable
  4. Commit with a clear message: git commit -m "feat: add multi-file patch support"
  5. Push and open a Pull Request

Please open an issue first for major feature proposals.


License

This project is licensed under the MIT License. See LICENSE for details.


Built with autonomy and security in mind.

Project Olympus β€” Because bugs should not wait for humans.

About

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages