AgentForge Hackathon SoftServe

AI Code Reviewer

Intelligent quality gate for your GitLab pipelines

AST Context Multi-LLM Auto Style Guide Quality Gate
Team: Yield Agents

Code Review is a Bottleneck

60%
of dev time waiting
for reviews
2-3d
average review
turnaround
40%
of bugs slip
through reviews
1. Inconsistent standards — every reviewer has different opinions
2. Security blind spots — easy to miss under pressure
3. No enforcement — style guides exist but aren't enforced

AI Code Reviewer

Automated, intelligent code review agent inside your CI/CD pipeline

1
Developer pushes
Merge Request
2
Code Quality check
(YAPF + Pylint)
3
AI analyzes diff
with AST context
4
Inline comments
& quality gate
Every MR reviewed in under 60 seconds — consistently, thoroughly, 24/7.

Two-Stage Quality Gate

Catch simple errors cheaply before invoking the LLM

Stage 1: code-quality
YAPF — formatting check
Pylint — error detection

No LLM resources used.
Fails fast on basic issues.
AI review is skipped until this passes.
PASS
Stage 2: review
AI Code Review — LLM analysis
AST context + style guide

Deep semantic analysis.
Inline comments on MR.
Blocks merge if severity threshold hit.
Cost optimization: simple formatting & lint errors are caught without spending LLM tokens. The AI agent only runs when the code is structurally clean.

Pipeline in Action

Three real scenarios from our test project

Stage 1 FAILED
YAPF found formatting errors.
AI review skipped — zero LLM cost.
Stage 2 FAILED
Code quality passed, but AI found
critical security issues.
ALL PASSED
Both stages green.
Ready to merge.

Smart Context via AST

Not just a diff — the AI sees the full picture

Without Context

LLM sees only changed lines. No idea what functions return, what types are used, or what other modules do.

High false-positive rate

With AST Context

LLM receives function signatures, class definitions, imported modules, and type info from across the codebase.

Precise, actionable findings

How: Python ast module parses changed files → extracts function/class definitions → BFS resolves imports up to 5 levels deep → fetches related files via GitLab API → full context to LLM.

Multi-Provider & Auto Style Guide

Cloud AI

Anthropic Claude / OpenAI — maximum reasoning, zero infrastructure.

Self-Hosted

Ollama / vLLM — zero data leakage, code stays under your organization. Ideal for NDA / FinTech.

Switch with one env var: LLM_PROVIDER=anthropic|openai

# Auto-generate style guide from your repo
python scripts/learn_style.py \
  --project-path /your/project \
  --output .project_style.md

# Project Style Guide (auto-generated)
## Naming
- Functions: snake_case
- Classes: PascalCase
- Constants: SCREAMING_SNAKE_CASE
## Error Handling
- Specific exception types only
- Always log, never silently catch
AI learns your conventions and enforces them.

5-Minute Setup

Add to any GitLab project — no SSH keys needed


# .gitlab-ci.yml
stages:
  - code-quality
  - review

python_code_quality:
  stage: code-quality
  image: python:3.12-bullseye
  rules:
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
  cache:
    paths:
      - .venv/
  before_script:
    - python3 -m venv .venv
    - source .venv/bin/activate
    - pip install --quiet yapf pylint
    - git fetch --depth 100 origin $CI_MERGE_REQUEST_TARGET_BRANCH_NAME:$CI_MERGE_REQUEST_TARGET_BRANCH_NAME
    - export PYTHONPATH=$(pwd):$PYTHONPATH
  script:
    - bash ci/code_quality.sh

ai_code_review:
  stage: review
  rules:
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
  variables:
    PROJECT_STYLE_PATH: "$CI_PROJECT_DIR/.project_style.md"

  script:
    - echo "🚀 Starting AI Code Review via SSH..."
    - rm -rf /tmp/reviewer
    - git clone {llm reviewer project} /tmp/reviewer
    - pip install --quiet --break-system-packages -r /tmp/reviewer/requirements.txt || pip install --quiet -r /tmp/reviewer/requirements.txt
    - cd /tmp/reviewer
    - python3 main.py

            

AI Agent Detects Critical Issues

SQL injection vulnerability found — inline comment with severity, impact, and fix suggestion

Critical | Security Pipeline blocked — merge prevented until fixed

AI Agent Detects Critical AST issue

Critical type mismatch is detected by analyzing the Abstract Syntax Tree across the entire codebase, not just the diff

Critical | Security Pipeline blocked — merge prevented until fixed

Clean Code Passes Both Stages

No issues found — summary posted, pipeline green, ready to merge

Pipeline PASSED Overall summary posted — ready to merge

Code Quality Gate (No LLM)

YAPF and Pylint formatters catch basic issues — AI review is skipped, saving LLM resources

Pipeline FAILED at Stage 1 AI review never runs → zero LLM cost for trivial errors

Impact & Scalability

Impact

Instant feedback on every MR — no waiting for human reviewers.
Consistent standards enforced 24/7 across all projects.
Security net — catches vulnerabilities before they reach production.
Cost efficient — trivial errors caught without LLM, AI only for deep analysis.

Scalability

Any GitLab project — 5-minute integration, zero infra changes.
Self-hosted LLMs — scale horizontally with your own GPU fleet.
Team-wide rollout — one reviewer repo serves all projects.

Next Steps

Inline Discussion Mode

Reply to AI comments directly in the MR thread. Discuss the context of a specific finding, ask for clarification, or refine the suggestion — a real conversation with the agent inside GitLab.

One-Click Accept & Commit

Accept an AI suggestion and automatically commit the fix straight from GitLab — no local checkout needed. Review → Accept → Auto-commit → Done.

Multi-Language AST

Extend AST context extraction to JavaScript/TypeScript, Go, and Java. Same deep cross-file analysis across your entire technology stack.

Vision: from reviewer to collaborative AI coding partner — embedded in your workflow, not bolted on.

Q&A

Thank you!

Python AST Claude / OpenAI / Local GitLab CI/CD Quality Gate
Team Yield Agents