
Weekend Annoying Task Challenge: AgentGuard.ai
AgentGuard.ai is a pre-execution cost guardrail for AI agent developers — it estimates an agent's tool-call token cost before execution and uses Amazon Bedrock to suggest a cheaper CLI alternative, instead of showing you the bill after the damage is done. Built with AWS Lambda, API Gateway, DynamoDB, and SAM. Hit a real payment-verification wall mid-build as a student with no card access — the full backend is deployment-ready in the repo, frontend live on Netlify with an honest demo-mode fallback.
Weekend Annoying Task Challenge: AgentGuard.ai
Vision & What the App Does
Every developer working with AI agents has felt this pain: you kick off what feels like a simple task, and somehow your Bedrock or LLM bill spikes because the agent chained together a dozen expensive tool calls to do something a single CLI command could have done in seconds. I've felt this myself — as an AWS Student Builder Campus Leader working with hackathon teams, I've watched teammates burn through their entire weekend's worth of AI credits on what should have been a five-minute task.
AgentGuard.ai is a pre-execution cost guardrail for AI agent developers. Instead of showing you a bill after the damage is done — like every dashboard on the market does — it sits in front of your agent's tool calls, estimates the token cost before execution, flags anything risky, and uses Amazon Bedrock to suggest a cheaper CLI or script alternative that does the same job. Think of it as a smart, slightly frugal friend standing between your agent and its worst instincts — the milk-delivery-vs-private-jet problem, solved before the private jet ever takes off.
The core loop is simple: paste a tool-call payload, get an instant risk read (low/medium/high), see a cheaper alternative if one exists, and watch your cumulative savings tick up on a live dashboard.


How I Built It
I went in with a clear architecture from day one — API Gateway, Lambda, Amazon Bedrock (Nova Micro), and DynamoDB, scaffolded through Kiro's spec-driven workflow (requirements → design → tasks) so nothing got built out of order. The plan was disciplined: get the core
/v1/analyze-log flow working end-to-end first, treat everything else — rules persistence, the proxy/intercept endpoint, property-based test suites — as stretch goals that could slip without sinking the submission.The build itself was a genuine grind, and I'm not going to pretend otherwise. I spent hours just getting my Windows machine ready: setting up MFA on a fresh AWS account, installing the AWS CLI, then AWS SAM CLI, then Python 3.12 — and hitting PATH issues at every single step, because installers kept defaulting to a full C: drive and silent installs kept skipping the PATH registration. I must have opened a dozen new terminal windows chasing a
'command' is not recognized error before realizing the fix each time. None of that is glamorous, but it's the real texture of building solo, without a senior engineer sitting next to you.Then, right as the backend was finally ready to deploy, I hit the wall a lot of student builders hit: AWS wouldn't let CloudFormation provision any resources without a verified payment method on the account, and I genuinely didn't have access to a card — not a credit card, not a debit card, nothing. I spent time exploring every option I could think of before accepting that, this weekend, that door was closed to me.
Rather than let that kill the submission, I pivoted. The full backend — Lambda handlers, the SAM template, the Bedrock prompt for generating cheaper alternatives, the DynamoDB schema — is complete, tested locally, and sitting in the GitHub repo, ready to deploy the moment a payment method is available. For the live demo, I shipped the React/Tailwind dashboard to Netlify with a safety-net "demo mode": if the live backend isn't reachable, the frontend falls back to realistic sample data and clearly labels itself as such, so the experience is honest and never pretends to be something it isn't.



AWS Services Used / Architecture Overview
AWS Services :
Service | Role |
|---|---|
Amazon API Gateway | Entry point for 4 REST endpoint |
AWS Lambda (Python 3.12) | Interception, cost estimation, rules logic |
Amazon Bedrock (Nova Micro) | Generates cheaper CLI/script alternative |
Amazon DynamoDB | AgentRules + InterceptLogs tables |
AWS SSM Parameter Store | SHA-256 hashed API key storage |
The designed architecture, fully implemented in code:
- Amazon API Gateway — entry point for the four REST endpoints (
/v1/proxy/intercept,/v1/analyze-log,/v1/metrics/dashboard,/v1/rules)
- AWS Lambda (Python 3.12) — four handlers doing the actual interception, cost estimation, and rules logic
- Amazon Bedrock (Nova Micro) — called only when a tool call crosses a developer's cost threshold, generating a cheaper CLI/script alternative
- Amazon DynamoDB — two tables,
AgentRules(per-developer budget settings) andInterceptLogs(append-only savings log, with zero raw-payload retention by design)
- AWS Systems Manager Parameter Store — SHA-256-hashed API key storage, no raw keys anywhere in the system
- Infrastructure as Code — the entire backend is defined in a single
template.yaml, deployable with onesam build && sam deployonce billing is unblocked
The agent flow is triggered synchronously: a developer's tool-call payload hits
/v1/analyze-log , Lambda estimates tokens via a lightweight heuristic, checks the cost against the developer's stored threshold in DynamoDB, and — only if needed — calls Bedrock for a rerouting suggestion before logging the result and responding.




What I Learned
Technically, I learned more about the gap between "architecture on paper" and "architecture that survives a real Windows machine" than anything else this weekend — PATH variables, installer defaults, and terminal session quirks turned out to be a bigger time sink than writing any of the actual Lambda code. I also learned to use Kiro's spec-driven flow to keep priorities straight under time pressure, which meant the core feature was always protected even as the stretch goals fell away one by one.
Beyond the technical side, I learned something about building honestly under real constraints. Not having access to a payment method isn't a hypothetical edge case for a lot of student builders — it's a real wall, and I'd rather show up with a fully-built, deployment-ready system and an honest explanation than fake a live AWS deployment that isn't there. The code works. The architecture is sound. The moment that door opens, this ships in minutes, not hours.
Link to App or Repo
- Live demo (Netlify, frontend with demo-mode fallback): https://agent-6a6e83a48a2a1eac--radiant-lebkuchen-0217e7.netlify.app/
- GitHub repo (full source, including the complete AWS SAM backend): https://github.com/saad-aids/agent-guard.ai
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article