This repository is a "killer demo" for the Lár Engine — an open-source, "glass box" framework for building auditable, multi-agent AI systems.
This demo showcases a Self-Correction Loop. It's not a chatbot; it's an autonomous engineer that fixes broken code.
You will see the agent:
- Read broken Python code.
- Run unit tests (which fail).
- Debug the failure using an LLM.
- Patch the code.
- Loop until the tests pass.
The "magic" of AI agents isn't magic at all—it's just a graph. Other frameworks try to sell you a "magic" AgentExecutor that does everything at once. It's a "black box," and when it breaks, it's impossible to fix.
Lár is the opposite. It's a simple, "dumb" GraphExecutor loop. It runs one node, stops, and logs what happened.
This is the "glass box" advantage: the "intelligence" doesn't live in the engine; it lives in your nodes. This makes your agents 100% auditable and deterministic.
This agent uses a Cyclic Graph. It doesn't just go A -> B -> C. It goes A -> B -> C -> A until success.
- Tester (
ToolNode): Runspytest. If it passes, we exit. If it fails, we continue. - Router (
RouterNode): Checks the test result.PASS-> Success Node.FAIL-> Debugger Node. - Debugger (
LLMNode): Reads the failure log and the source code. Generates a fix. - Patcher (
ToolNode): Writes the fix to disk. - Loop: The graph points back to Tester.
| Other Frameworks (“Black Box”) | Lár (“Glass Box”) |
|---|---|
| "Hidden Loops". You hope the agent decides to retry. | "Explicit Loops". You define the next_node pointing back to start. |
| "Magic" Output. The agent simply says "I fixed it". | "Auditable Proof". The GraphState shows every failed test, every patch, and every retry. |
| Flaky. Tends to get stuck in loops without exit conditions. | Controlled. You can insert RouterNodes to break loops after N retries. |
This demo includes a broken math library (src/math_lib.py) and a test suite (tests/test_math_lib.py).
repair_agent.py— Defines the graph logic.run_demo.py— Runs the agent and prints the loop.
- Python 3.11+
- Poetry
- Google Gemini API Key (or OpenAI)
- macOS/Linux/WSL/Windows
git clone https://github.com/snath-ai/code-repair-demo.git
cd code-repair-demo
# Install dependencies
poetry installCreate a .env file:
GOOGLE_API_KEY="YOUR_API_KEY_HERE"poetry run python run_demo.pyYou will see output like this:
[Step 1] Node: ToolNode (Tester)
Test Result: FAIL
[Step 2] Node: RouterNode
Routing to Debugger...
[Step 3] Node: LLMNode (Debugger)
Agent is rewriting the code...
[Step 4] Node: ToolNode (Patcher)
Patch applied.
[Step 5] Node: ToolNode (Tester)
Test Result: PASS
graph TD
A[Start] --> B(ToolNode<br/>'Read Code');
B --> C(ToolNode<br/>'Run Tests');
C --> D{RouterNode<br/>'Pass or Fail?'};
D -- "PASS" --> E[AddValueNode<br/>'Success'];
D -- "FAIL" --> F(LLMNode<br/>'Debugger');
F --> G(ToolNode<br/>'Patcher');
G --> H(ClearErrorNode<br/>'Janitor');
H -.-> C
We have built three "killer demos" that prove this "glass box" model. You can clone, build, and run them today.
- snath-ai/customer-support-demo: A Multi-Agent Swarm (Triage, Tech, Billing) on an assembly line.
- snath-ai/rag-demo: A Self-Correcting Research Agent using local vectors.
- snath-ai/code-repair-demo: (This Repo) A Self-Healing CI/CD Agent.
Lár is designed for Agentic IDEs (Cursor, Windsurf, Antigravity) and strict code generation.
We provide a 3-Step Workflow to make your IDE an expert Lár Architect.
Instead of pasting massive prompts, simply reference the master files in the lar/ directory (or download them from the main repo).
- Context (The Brain): In your IDE chat, reference
@lar/IDE_MASTER_PROMPT.md. This loads the strict typing rules and "Code-as-Graph" philosophy. - Integrations (The Hands): Reference
@lar/IDE_INTEGRATION_PROMPT.mdto generate production-ready API wrappers in seconds. - Scaffold (The Ask): Open
@lar/IDE_PROMPT_TEMPLATE.md, fill in your agent's goal, and ask the IDE to "Implement this."
Example Prompt to Cursor/Windsurf: "Using the rules in @lar/IDE_MASTER_PROMPT.md, implement the agent described in @lar/IDE_PROMPT_TEMPLATE.md."
Lár is an open-source agent framework built to be clear, debuggable, and developer-friendly. If this project helps you, consider supporting its development through GitHub Sponsors.
Become a sponsor → Sponsor on GitHub
- Lár Engine by Aadithya Vishnu Sajeev — glass-box agent framework
This Project is licensed under the Apache License 2.0
This means:
- You are free to use Làr in personal, academic, or commercial projects.
- You may modify and distribute the code.
- You MUST retain the
LICENSEand theNOTICEfile. - If you distribute a modified version, you must document what you changed.
Apache 2.0 protects the original author (Aadithya Vishnu Sajeev)
while encouraging broad adoption and community collaboration.
For developers building on Làr:
Please ensure that the LICENSE and NOTICE files remain intact
to preserve full legal compatibility with the Apache 2.0 terms.