Skip to content
retrAI logo

retrAI

A self-solving AI agent loop. Point it at any project, give it a goal, watch it fix itself.

pytest pyright perf-check sql-benchmark shell-goal ai-eval ml-optimize cargo-test bun-test go-test

What is retrAI?

retrAI is an autonomous AI agent that runs a plan → act → evaluate → repeat loop powered by LangGraph and LiteLLM. Give it a goal — failing tests, a slow query, a type error — and it will iteratively fix your code until the goal is achieved.

graph LR
    A[START] --> B[Plan]
    B --> C[Act]
    C --> D[Evaluate]
    D -->|"✅ Goal achieved"| E[END]
    D -->|"🔄 Continue"| B
    D -->|"🛑 Max iterations"| E

Install

pip install retrai          # or: uv add retrai

Use

retrai run pytest           # fix all failing tests
retrai run pyright          # fix type errors
retrai run perf-check       # optimise until benchmarks pass
retrai run sql-benchmark    # tune a query until it's fast
retrai run ai-eval          # describe a goal in English, agent writes tests + code
retrai serve                # web dashboard on :8000
retrai tui pytest           # rich terminal UI

Key Features

Feature Description
12 goal types pytest, pyright, bun-test, npm-test, cargo-test, go-test, make-test, shell-goal, perf-check, sql-benchmark, ai-eval, ml-optimize
Multi-model Claude, GPT-4o, Gemini, Ollama, DeepSeek — anything LiteLLM supports
Auto-detection Scans project files to pick the right goal automatically
Web dashboard Vue 3 + WebSocket real-time graph visualization
TUI Rich Textual terminal with live sparklines, tool tree, and event log
HITL Optional human-in-the-loop approval gates before each iteration
Agent memory Persists learned strategies across runs
Pipeline mode Chain multiple goals in sequence
Benchmarks Compare models side-by-side on the same task
AI eval Describe a goal in English — agent generates the test harness, then implements the solution