How SberDevices Built an AI‑Agent System for Frontend: Code Review, Log Analysis and Auto‑Fixing
SberDevices built its own AI‑agent system for frontend work using GigaChat-2-Max, performing code review, log analysis and auto‑fixing of builds.
SberDevices could not use off-the-shelf solutions such as GitHub Copilot Code Review or GigaCode Agent — security policy forbids sending code outside. They had to build their own system based on GigaChat-2-Max. In six months it reviewed more than four thousand merge requests across ninety projects, analysed hundreds of failed builds, and, unexpectedly for the authors, the most demanded function turned out not to be code generation but automatic invocation of testers. As SberDevices writes, experience shows: code generation becomes cheaper faster than its verification, so investment should go to verification and stability tools.
Why a Large Company Builds Its Own Solution
External review services require repository access. For a bank and a device manufacturer this is unacceptable. The frontend infrastructure team, led by Aurora, chose a local deployment: the GigaChat-2-Max model is used out-of-the-box without fine-tuning, while logic control stays in TypeScript and NestJS code. This gives control over data and flexibility to adjust to internal standards.
The system architecture is hybrid. There are deterministic workflows where code strictly defines the step sequence, and there are agent loops where the model receives a goal and a set of tools and decides how to act. This approach lets AI handle routine work while keeping critical processes predictable.
How AI Code Review Works and What It Finds
Review starts automatically when a merge request is created in GitLab or when a developer runs a command. The bot receives a webhook, fetches the diff via API, filters out service files — configs, lock files — and classifies the rest: whether deep analysis is needed or a formal approval suffices. Only files with changed logic are sent to the model.
The prompt assigns the role: a frontend developer looking for bugs. A strict requirement is to specify the exact line range so the comment attaches to the problem location. The model’s answer is validated by code; “all clear” (LGTM) responses are discarded, while found remarks are posted in the MR. At the same time the bot writes a brief summary of changes in the request description — the developer does not need to spend time describing what they did.
According to SberDevices data, from January to July potential problems were found in 8% of cases — roughly one MR out of thirteen. This may seem small, but the team already has a habit of submitting code for review after it has been checked by local agents. If the bot finds something, it is usually one or two remarks.
Analysis of comments from 2026 showed that in 90% of cases the bot signals a specific problem rather than giving general advice. Distribution by topic:
- 16% — handling null/undefined and error handling (leader for frontend);
- 14% — architecture and code cleanliness;
- 12% — TypeScript typification;
- 11% — accessibility and semantics;
- 10% — reactivity and state management;
- 8% — working with API and data;
- 6% — style and formatting;
- remaining 23% — performance, UI, asynchronicity, tests, security.
Testing was carried out in an isolated sandbox repository with service examples and test MRs. The bot connected via webhook — after a release the updated version instantly became available to everyone. Review can be disabled at the repository level, but hardly anyone does. Additionally, the bot can summon human reviewers in the corporate messenger — no need to copy links or ask colleagues manually.
All AI comments are recommendations. The quorum for merging is two approvals from people. The MR author decides whether to accept a remark. Model errors are possible, responsibility remains with the person.
Log Analysis and Auto-Fixing of Builds
The second major function is analysing failed CI jobs. The developer posts a link to a failed job in the chat. The bot verifies that it really failed, downloads the full trace and passes it to a custom TypeScript parser.
The parser is key to saving tokens and improving answer quality. It strips GitLab control sequences and ANSI codes, splits the log by shell prompt into blocks of “command — output”, discards after_script and takes the last block — which with high probability is the command that caused the failure. The output is no more than ten thousand characters. If the log is longer, the beginning and end are kept: the start usually holds useful context, the end holds the error, and the middle contains dependency installation. Sensitive data — tokens, addresses, environment variables — are cleared separately.
The model receives the log of the last command plus service context: name, repository, environment. The prompt forces it to answer in a structured way: whose problem — development, infrastructure or unclear — and specific recommendations for each side. The result goes to the same messenger thread. The developer can like or dislike it — the history of prompts and answers is stored in PostgreSQL for quality analysis and version comparison.
If the problem lies on the development side and falls within supported scenarios — application build, Docker build, nginx config — a “Try fix with AI” button appears in the thread. The thread author starts it. Then a classic agent loop runs: the model receives the service sources and a set of tools — reading files, searching, editing, running commands. The number of iterations is not limited by code; the goal is “fix the build”. When the agent considers the task solved, CI rebuilds the project. A successful build creates a separate branch and MR into the default branch. This MR undergoes the same review: AI reviewer plus two humans.
According to the team
Frequently Asked Questions
What is the AI agent system for the frontend?
It is a set of software solutions that use artificial intelligence to automate tasks related to developing and maintaining the frontend of web applications. It includes code review, log analysis, and automatic error correction.
What benefits does implementing AI agents bring to development?
Implementing AI agents reduces the time spent on manual code review and log analysis, minimizes the number of errors, and speeds up the process of fixing builds. This leads to higher overall development efficiency.
On which platform did SberDevices build its system?
SberDevices built its AI agent system on the GigaChat-2-Max language model. This model provides the necessary capabilities for code analysis and generation, as well as for making decisions about error correction.
Web development, digital advertising and marketing expert since 2012. Founder of AIFORSALE.