
Weekend Agent Challenge: ArchVektor
Exhausted by tedious infrastructure code reviews? Discover how I merged AWS Serverless tools with Gemini AI to engineer a 24/7 autonomous agent that automatically secures and optimizes your cloud architecture.
Vision & What the Agent Does
In the fast-paced world of cloud engineering, infrastructure is often deployed with a "make it work first" mindset, inadvertently sacrificing security, performance, or cost optimization. Manual code reviews for Infrastructure-as-Code (IaC) are tedious and heavily rely on the availability of senior engineers.
This is where ArchVektor steps in, an autonomous, always-on agent that takes on the role of a relentless Cloud Architect for your AWS infrastructure.
How it works autonomously:
- The Trigger: Every night at 2:00 AM, an Amazon EventBridge cron job gently wakes ArchVektor up.
- The Investigation: ArchVektor independently connects to the target GitHub repository and scans for any commits pushed in the last 24 hours. If there are no new commits, the agent goes back to sleep (saving costs).
- The Analysis: If new infrastructure changes are detected, ArchVektor pulls the exact code differences (Git Diff) and passes them to a Generative AI model with a strict system prompt based on the AWS Well-Architected Framework.
- The Report: By the time you wake up and grab your morning coffee, a beautifully formatted email report is waiting in your inbox via Amazon SES, detailing the current state, security recommendations, pros & cons, and cost constraints of your recent commits.
Final Email Report:

How You Built It
I wanted to build an agent that was incredibly lightweight and highly resilient. My core constraint was to maintain a Zero-Dependency Architecture. Instead of packaging bulky Lambda Layers with
requests or third-party SDKs, I built the entire communication layer using pure, built-in Python 3.12 libraries like urllib.request .Here is the step-by-step breakdown of my development process:
- Securing Credentials with AWS Secrets Manager: Security is paramount. I stored my GitHub Personal Access Token and the AI API key as pure
Plaintextsecrets in AWS Secrets Manager. This ensures the Lambda function can fetch credentials dynamically without hardcoding them into the codebase.
- Core Agent Logic in AWS Lambda : I wrote a Python 3.12 Lambda function that acts as the orchestrator. It uses
boto3to retrieve the secrets,urllib.requestto fetch the Git diffs via the GitHub API, and then sends the context to the AI model for architectural evaluation.
- The Plot Twist (Challenges Encountered & Overcome) : Initially, I integrated the agent with Amazon Bedrock. It worked perfectly in my local tests. However, once deployed to the cloud, I hit a massive roadblock: a
ThrottlingException (Too many tokens per day). Because I was operating on a fresh AWS account with strict Free Tier limits for Bedrock, the AI refused to answer. Waiting days for an AWS Support quota increase was not an option for a 48-hour Weekend Challenge! I immediately executed a "pivot." I rewrote the AI invocation logic to detach from AWS Bedrock and reach out to the Gemini 3.1 Flash Lite API directly via HTTP POST requests. Because I kept my architecture zero-dependency, switching the API endpoint in myurllibcode took less than 5 minutes. ArchVektor remained highly secure, fully serverless, and successfully generated insightful reviews!
- Setting the Autonomous Schedule : To make it "Always-On", I configured an Amazon EventBridge rule with a Cron expression cron(0 19 * * ? *) to trigger the Lambda function automatically every single night.
AWS Services Used / Architecture Overview
ArchVektor relies entirely on a Serverless Event-Driven architecture, meaning the idle cost is absolutely $0.
- Amazon EventBridge: Acts as the pacemaker, triggering the workflow via a cron schedule.
- AWS Lambda: The "brain" of the agent orchestrating the logic in Python 3.12.
- AWS Secrets Manager: Securely stores the GitHub and Gemini credentials.
- Amazon SES: Formats the Markdown review from the AI into a readable HTML email.
- Amazon CloudWatch: Handles execution logging.

What You Learned
This challenge was an incredible proving ground. I learned two major lessons:
- Architecting for Resilience: Cloud development is unpredictable. Building an agent isn't just about sending prompts; it's about handling edge cases. Writing fallback mechanisms for empty Git commits, massive diff truncations (to avoid context window limits), and API throttling taught me the true meaning of fault-tolerant design.
- The Power of Standard Libraries: It's easy to rely on heavy third-party packages. Forcing myself to build complex REST API integrations using only
urllib.requestgave me a deeper appreciation for Python's standard library and the performance benefits of zero-layer Lambda deployments.
Link to App or Repo
You can explore the complete, zero-dependency source code of ArchVektor here: https://github.com/karasu126/ArchVektor
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article