> Markdown version of [/videos/1511-how-we-built-an-ai-powered-code-reviewer-in-80-hours](https://www.wearedevelopers.com/videos/1511-how-we-built-an-ai-powered-code-reviewer-in-80-hours). Every page supports `.md` or `Accept: text/markdown`. Links point to the HTML versions so they work for humans too. Agent guide: [/agents.md](https://www.wearedevelopers.com/agents.md). --- # How we built an AI-powered code reviewer in 80 hours Integrating AI is only 10% of building a production-ready code reviewer. Discover how defensive AWS serverless architecture actually tames context limits, rate caps, and expensive hallucinations. - **Speakers:** [Yan Cui](https://www.wearedevelopers.com/@yan-cui) - **Event:** World Congress 2025 - **Published:** August 20, 2025 - **Duration:** 28:07 - **URL:** https://www.wearedevelopers.com/videos/1511-how-we-built-an-ai-powered-code-reviewer-in-80-hours ## Summary Building a production-ready AI code reviewer involves far more than just parsing prompts; in fact, integrating the AI itself only accounts for 10% of the development work, while architectural glue and operational engineering dictate the rest. Leveraging AWS Serverless, Lambda, EventBridge, and Amazon Bedrock, this application analyzes GitHub webhooks to flag security risks and performance antipatterns in user pull requests. Bedrock was specifically selected for its strict data privacy guarantees, ensuring proprietary customer source code is never stored or used for model training—a crucial advantage over direct API setups with providers like DeepSeek or OpenAI. Significant architectural challenges emerged around managing real-world large language model constraints rather than simply chasing benchmark scores. Notably, marketed million-token context windows often fail at complex reasoning past 30,000 tokens. To combat this limitation, the application processes pull requests iteratively by limiting inputs to one prompt per file. Additionally, LLMs introduce staggering API rate limits—such as 50 requests per minute—and lengthy response latencies. By implementing fallback mechanisms to alternate models and direct Anthropic APIs, the system degrades gracefully during Bedrock outages and avoids exhausting availability caps. Operating a consumer AI tool demands extreme cost control and resilient serverless execution patterns. Because models process tokens expensively, the application strictly analyzes specific code diffs rather than entire files, heavily slashing costs while preventing irrelevant comments on untouched code. To handle AWS Lambda timeout risks during massive pull requests, a lightweight durable execution system utilizes idempotency checkpoints in DynamoDB, ensuring step-function-like retries never duplicate expensive LLM calls. The system even runs local static analysis concurrently to maximize CPU usage during the 20-second waits for Bedrock responses. Ultimately, mitigating AI hallucinations—ranging from broken JSON strings to imaginary GitHub line numbers—proves that sustainable unit economics and defensive architecture are the real hurdles of modern AI product development. **Keywords:** amazon bedrock, aws serverless architecture, ai code review, github webhooks, aws lambda timeouts, dynamodb idempotency, serverless durable execution, llm context window limits, api rate limit management, ai cost optimization, b2c ai unit economics, anthropic api fallback, generative ai data privacy, llm hallucinations, static code analysis tools ## Chapters 1. **Overview of the AI-powered serverless code reviewer** (00:05) — A demonstration of how the tool scans pull requests to identify security risks and anti-patterns. 1. **High-level architecture for serverless event processing** (02:33) — How GitHub webhooks, EventBridge, Lambda, and AppSync coordinate to handle pull request analysis. 1. **Securing customer source code with Amazon Bedrock** (05:12) — Why privacy guarantees and serverless token-based pricing drove the choice of Bedrock over direct model APIs. 1. **Managing timeouts and limits with async invocations** (09:18) — How handling large pull requests requires durable retries and strict concurrency limits to avoid Lambda timeouts. 1. **Context window limitations in large language models** (12:03) — Why large context windows excel at recall but fail at complex reasoning beyond limited token counts. 1. **Working around API rate limits and model outages** (14:29) — Strategies for maximizing throughput using cross-region inference and managing reliability via fallback provider APIs. 1. **Controlling the high infrastructural costs of AI code analysis** (17:17) — How exclusively scanning changed code lines enables a financially sustainable model for customer AI usage. 1. **Implementing durable execution with local checkpoints** (20:12) — Using a DynamoDB-based idempotency pattern instead of Step Functions while running static analysis parallel to LLM calls. 1. **Handling hallucinations in formatted JSON and code structures** (23:53) — Why LLMs generate imaginary line numbers or outdated fixes and how retrieval constraints impact reliability. ## Related Moments - [Shifting developer workloads and realistic AI productivity gains](https://www.wearedevelopers.com/videos/1830-wearedevelopers-live-speculaitions) (from "WeAreDevelopers LIVE - SpeculAItions") - [Reviewing recent technology and AI tool headlines](https://www.wearedevelopers.com/videos/1897-agents-version-control-and-bunnies-daniel-siegl-david-payr) (from "Agents, Version Control and Bunnies - Daniel Siegl & David Payr") - [Analyzing cloud-based AI code completion architectures](https://www.wearedevelopers.com/videos/961-beyond-autocomplete-local-ai-code-completion-demystified) (from "Beyond Autocomplete: Local AI Code Completion Demystified") - [Security integration and AI skepticism in developer tooling](https://www.wearedevelopers.com/videos/1830-wearedevelopers-live-speculaitions) (from "WeAreDevelopers LIVE - SpeculAItions") - [Managing overwhelming artificial intelligence pull requests in open source](https://www.wearedevelopers.com/videos/1753-wearedevelopers-live-spicy-vanilla-web-css-magic-more) (from "WeAreDevelopers LIVE – Spicy Vanilla Web, CSS Magic & More") - [Filtering AI code generations and automating pull request reviews](https://www.wearedevelopers.com/videos/1545-real-world-security-for-busy-developers) (from "Real-World Security for Busy Developers") ## Related Articles - [Dev Digest 137 - AI'm not sure about this](https://www.wearedevelopers.com/magazine/485-dev-digest-137-ai-m-not-sure-about-this) - [MLOps And AI Driven Development](https://www.wearedevelopers.com/magazine/82-mlops-and-ai-driven-development) - [Dev Digest 132 - Binging WADFlix?](https://www.wearedevelopers.com/magazine/473-dev-digest-132-binging-wadflix) - [Dev Digest 112 - The True Crime of AI Development](https://www.wearedevelopers.com/magazine/421-dev-digest-112-the-true-crime-of-ai-development) ## Related Jobs - [Staff Software Engineer, Copilot Experiences](https://www.wearedevelopers.com/jobs/ext/164361-staff-software-engineer-copilot-experiences) at **GitHub** - [Senior Engineer, Infrastructure Platform](https://www.wearedevelopers.com/jobs/ext/328836-senior-engineer-infrastructure-platform) at **Intercom, Inc.** - [Principal Software Engineer, Enterprise AI Platform](https://www.wearedevelopers.com/jobs/ext/1467292-principal-software-engineer-enterprise-ai-platform) at **GitHub** - [AI Software Engineer (Germany)](https://www.wearedevelopers.com/jobs/48317-ai-software-engineer-germany) at **Sunhat** - [Staff Developer Advocate, GitHub Security Lab](https://www.wearedevelopers.com/jobs/ext/1921051-staff-developer-advocate-github-security-lab) at **GitHub** - [Senior Software Engineer, Enterprise Products](https://www.wearedevelopers.com/jobs/ext/1841248-senior-software-engineer-enterprise-products) at **GitHub**