惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

The Hacker News
The Hacker News
GbyAI
GbyAI
雷峰网
雷峰网
罗磊的独立博客
WordPress大学
WordPress大学
博客园_首页
Hugging Face - Blog
Hugging Face - Blog
The Cloudflare Blog
云风的 BLOG
云风的 BLOG
F
Full Disclosure
Google DeepMind News
Google DeepMind News
C
Cyber Attacks, Cyber Crime and Cyber Security
NISL@THU
NISL@THU
S
Schneier on Security
T
Tor Project blog
C
Cybersecurity and Infrastructure Security Agency CISA
Recent Announcements
Recent Announcements
酷 壳 – CoolShell
酷 壳 – CoolShell
C
Check Point Blog
P
Palo Alto Networks Blog
C
CERT Recently Published Vulnerability Notes
S
Secure Thoughts
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Last Week in AI
Last Week in AI
T
Threatpost
I
Intezer
Y
Y Combinator Blog
G
GRAHAM CLULEY
MyScale Blog
MyScale Blog
阮一峰的网络日志
阮一峰的网络日志
T
The Exploit Database - CXSecurity.com
Scott Helme
Scott Helme
A
Arctic Wolf
Martin Fowler
Martin Fowler
Hacker News: Ask HN
Hacker News: Ask HN
V
V2EX
B
Blog RSS Feed
The Last Watchdog
The Last Watchdog
博客园 - 司徒正美
Simon Willison's Weblog
Simon Willison's Weblog
V
Vulnerabilities – Threatpost
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
N
News and Events Feed by Topic
www.infosecurity-magazine.com
www.infosecurity-magazine.com
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
P
Proofpoint News Feed
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
AI
AI
C
Cisco Blogs
T
The Blog of Author Tim Ferriss

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
I Built a Cyberpunk Cat RPG to Teach Production AI Architecture
Joanne Skiles · 2026-06-15 · via DEV Community

The screen loads. You pick your character class (TabbyWarrior, SiameseMage, MaineCoonPaladin, SphinxRogue) and the game begins:

Neo-Pawsburg, 2087. The neon flickers above the Neon Scratch Lounge as Madame
Fluffington slides a data chip across the bar. RoombaCore drones have taken
over Chrome Alley. The resistance needs someone with claws.

What do you do?

You type: I slip into Chrome Alley and scout for a weak point in the patrol.

And while you do all of this, the panel on the right side of the screen
lights up: a Step Functions workflow trace stepping through each stage in
real time, Lambda invocation records streaming underneath it, token counts
ticking up, a d20 rolling. Your SphinxRogue, high on AGI and STL, vanishes
into the shadows.

The Dungeon Master is Claude running on Amazon Bedrock. The dice are Lambda functions. The campaign state is DynamoDB. The whole thing is a real distributed system, and you're watching it execute while you play.


I built The Neon Scratch Lounge as a live demo for AWS Summit LA last month. The goal wasn't to ship a game. It was to make five reliability patterns for AI agent systems feel concrete instead of abstract (and also a little bit for fun, because who wants to see another chatbot demo).

But the more I built it, the more it became a genuine exercise in the question I actually care about: what does it actually take to go from a working AI prototype to something you'd trust in production? (i.e. my day job)

So let's dig into it.


The prototype everyone builds first

The first version of any AI-powered feature looks something like this:

User → Lambda → Bedrock → User

It works. It's impressive (someone may have even applauded - I don't know I just heard). You show it to stakeholders, and they want to ship it tomorrow.

Then you try to actually ship it, and:

  • A malformed model response kills the whole request with no retry
  • Two concurrent users hit a race condition you never thought about
  • You can't tell whether a failure was a Bedrock timeout or bad input
  • The model confidently invents facts that aren't in your data
  • Session two of a conversation has no memory of session one

None of this is because AI is uniquely broken. It's because an AI agent is a distributed system: it makes network calls, holds state, executes side effects, and fails in all the ways distributed systems fail. Treating it like a clever fetch() wrapper is what bites you.


What the production version looks like

Here's the full architecture for the game. Each piece maps to a real reliability problem it solves.

Player action
  → API Gateway
  → dungeon-controller Lambda
      ├── DynamoDB  (read/write campaign state)
      ├── EventBridge  (fire-and-forget audit event)
      └── Step Functions Express Workflow
            ├── retrieve-lore
            ├── invoke-dungeon-master  (Bedrock)
            ├── validate-and-route
            ├── execute-tools  (Map state, parallel)
            ├── persist-campaign
            └── format-response

CloudWatch Logs + Metrics + Alarms (across everything)

This is:

  • Seven Lambda functions
  • Three DynamoDB tables
  • One Step Functions state machine
  • One API Gateway
  • One EventBridge bus for audit events
  • One SQS dead letter queue.

All are defined in CDK.


Grounding the model: RAG before every call

The Dungeon Master can't be trusted to remember that SphinxRogues have a SandstormVanish ability, or that Chrome Alley is controlled by RoombaCore drones, or that the night market sells CreditChips. If you don't tell it, it will invent plausible-sounding alternatives, confidently and helpfully wrong.

The retrieve-lore Lambda runs before Bedrock is ever called. It scores 16KB of structured lore JSON (locations, enemies, items, classes) against the player's action using keyword overlap, pulls the top chunks, and injects them into the system prompt. The model's current location is always injected regardless of score.

// lambda/workflow/retrieve-lore.ts
const scored = loreChunks.map(chunk => ({
  chunk,
  score: scoreKeywordOverlap(playerAction, chunk.keywords)
}));

const context = scored
  .sort((a, b) => b.score - a.score)
  .slice(0, 5)
  .map(r => r.chunk.content)
  .join('\n\n');

For a larger knowledge base you'd swap this for Bedrock Knowledge Bases with OpenSearch Serverless for semantic vector search. The project supports both with a single flag in cdk.json. For a game world that fits in 16KB, keyword scoring is fast, free, and good enough.

RAG grounds the model in facts. But even with good context, the model can still return malformed JSON. So after every Bedrock call, a validation step checks the output schema. If it fails, Step Functions retries with a typed error. No custom retry scaffolding needed in Lambda code.


A brief detour: "serverless" does not always mean "scales to zero"

I want to tell you about the week I added Amazon OpenSearch Serverless to this project.

Sounds budget-friendly, right? It's serverless. I assumed (and you know what they say about assuming) that serverless meant free when idle. It does not.

OpenSearch Serverless always provisions a minimum of 4 OCUs (OpenSearch Compute Units), and at $0.24/hr per OCU, that's a fixed floor whether you have zero requests or five thousand:

4 OCUs × $0.24/hr × 730 hrs = $700.80/month. Every month. No matter what.

This is how the project ended up with a toggle in cdk.json:

"useBedrockKnowledgeBase": false

The bundled JSON keyword scoring isn't as semantically rich as vector search, but it runs in-memory inside Lambda and costs nothing at idle. For a conference demo with a 16KB lore file, it's the right call. I'd benchmark both before deciding for a real production system, but I'd check the pricing page first.

(Side note: if you're using AOSS for dev/test, you can disable redundancy to drop to 2 OCUs instead of 4, which cuts the floor to ~$350/month. Still not free, but worth knowing.)

The day after I made this decision and committed to the keyword approach, AWS announced that OpenSearch Serverless now supports scaling to zero.

Simpsons Old Man Yells At Cloud (AWS)

The demo was already written. I wasn't going back. But if you're starting fresh today, that changes the math significantly. Always check the pricing page. A quick read now saves a very awkward conversation with finance later.


Retries, idempotency, and the dead letter queue

The execute-tools stage is where game state actually mutates: damage is applied, XP is awarded, inventory changes. These are Lambda invocations, and Lambda invocations fail.

Step Functions handles the retry strategy entirely in the state machine definition:

"Retry": [{
  "ErrorEquals": ["States.ALL"],
  "IntervalSeconds": 2,
  "MaxAttempts": 3,
  "BackoffRate": 2,
  "JitterStrategy": "FULL"
}]

Full jitter is deliberate. Without it, multiple concurrent workflows retrying the same error pile onto Bedrock in sync. Full jitter staggers them.

But retries create a second problem: if apply-damage succeeds and the response gets lost, a retry would apply that damage again. The fix is idempotency: cache the tool result in DynamoDB and return the cached version on retry instead of re-executing:

// lambda/shared/idempotency.ts
const key = `${campaignId}:${turnId}:${toolName}:${purpose}`;

const cached = await dynamo.get({ Key: { pk: key } });
if (cached.Item) return cached.Item.result;

const result = await executeTool(args);
await dynamo.put({ Item: { pk: key, result, ttl: now + 3600 } });
return result;

The key is scoped to turnId. The same tool called in two different turns should produce different outcomes (dice are random), so the cache can't be global.

Executions that exhaust all retries route to an SQS dead letter queue. The player gets a safe fallback narrative. Nothing crashes. The DLQ depth metric fires a CloudWatch alarm. No data is lost and the failure is isolated to one turn.


The system controls execution, not the model

When the LLM controls its own tool invocation loop (decides which tool, calls it, reads the result, decides what to do next) you get infinite loops, runaway API costs, and failure states that are nearly impossible to debug. Letting the model govern its own execution is like letting your database write its own SQL.

In this system, the model reasons. Step Functions and Lambda execute. Those are different jobs.

After Bedrock returns a narrative and a list of tool calls, the validate-and-route Lambda filters them against an explicit allowlist before anything runs:

// lambda/workflow/validate-and-route.ts
const ALLOWED_TOOLS = new Set([
  'roll-dice', 'apply-damage', 'update-inventory', 'award-xp',
  'update-location', 'apply-effect', 'use-special-ability', 'update-quest-log'
]);

const validated = dmOutput.toolCalls.filter(call => {
  if (!ALLOWED_TOOLS.has(call.name)) {
    logger.warn({ toolName: call.name, reason: 'not in allowlist' });
    return false;
  }
  return true;
});

The model cannot invoke a tool that isn't on the list. Business logic never lives inside a prompt; it lives in typed Lambda functions with unit tests.


Structured observability from day one

Traditional debugging doesn't translate to AI systems. A stack trace doesn't tell you whether the model misread the lore context, whether the tool arguments were semantically wrong, or whether a retry loop doubled a game effect.

Every Lambda in this system emits exactly one log line per invocation: one structured JSON object, queryable in CloudWatch Logs Insights without any parsing overhead:

console.log(JSON.stringify({
  timestamp: new Date().toISOString(),
  requestId,
  campaignId,
  toolName,
  inputTokens: usage.inputTokens,
  outputTokens: usage.outputTokens,
  latencyMs: Date.now() - start,
  retryCount,
  success: true
}));

CloudWatch metric filters extract fields from those log lines into custom metrics in the NeonScratch namespace: dice roll totals, Bedrock token usage, monsters defeated per hour, DLQ depth. No code change needed to add a dashboard widget for a new field you're already logging.

The alarms are defined in CDK, not clicked in the console:

new cloudwatch.Alarm(this, 'ControllerLatency', {
  metric: controllerFn.metricDuration({
    statistic: 'p99',
    period: Duration.minutes(5),
  }),
  threshold: 10_000,
  evaluationPeriods: 2,
});

The game's mechanics panel shows these log lines live for the current campaign, each Lambda invocation appearing in order as the turn executes. For the Summit demo, I added a failure-injection shortcut, Ctrl+Shift+F in the browser, that forces the tool-execution Lambda to fail, so the audience could watch the retry animation in the workflow trace and see the DLQ alarm flip red in real time.


State lives in DynamoDB, not in the prompt

A stateless AI agent is a frustrating one. Without memory of the previous turn, the Dungeon Master doesn't know your HP, what's in your inventory, where you are, which enemies are still alive, or what quests you've accepted.

Campaign state (character stats, inventory, location, quest log, active effects, conversation history) lives in DynamoDB. Every turn reads it before invoking Bedrock and writes it back after tool execution:

// lambda/workflow/persist-campaign.ts
await dynamo.update({
  Key: { campaignId },
  UpdateExpression: `
    SET character.hp = :hp,
        character.inventory = :inventory,
        currentLocation = :location,
        conversationHistory = :history
  `,
  ExpressionAttributeValues: {
    ':hp': state.hp,
    ':inventory': state.inventory,
    ':location': state.location,
    ':history': trimmedHistory,
  }
});

Bedrock charges per token, and conversation history grows without bound. After 20 turns, persist-campaign calls Bedrock to summarize the narrative so far, stores the summary, and trims the raw turn history. The next turn assembles: system context + summary + last N turns + current action. Continuity survives the context window.


What I'd add before calling it truly production-ready

The game is a demo, not a product, and I want to be honest about what's missing:

  • Authentication: there's none (honestly, this wasn't a demo around auth - so wasn't going to pull my hair for it). Any request to the API can start or mutate a campaign
  • Rate limiting: API Gateway has basic throttling configured, but there are no per-user limits (because again, not the point of the demo)
  • Request signing: the frontend calls the API directly with no auth header (again, NO AUTH implemented)
  • Encryption at rest: DynamoDB tables don't have customer-managed KMS keys
  • Multi-region failover: single region only

For a real application, I'd add Cognito or a JWT check at the API Gateway layer first. Everything else is addressable without changing the core architecture.

What's production-worthy:

  • Retry strategy
  • Idempotency pattern
  • Structured logging discipline
  • Alarm definitions
  • CDK infrastructure
  • Separation between model reasoning and system execution

Those patterns transfer directly to any AI agent system, game, or otherwise.


The source

The full project is on GitHub at github.com/chaotictoejam/neon-scratch-lounge. Deploy it with cdk deploy --all from the infra/ directory, point VITE_API_GATEWAY_URL at the output URL, and you have a working skeleton.

The lore JSON files in lore/ are the easiest place to adapt it. Swap out Neo-Pawsburg for your own domain, and the DM will narrate your world instead. The five core patterns stay exactly the same.


Find me at linkedin.com/in/jlskiles or youtube.com/@DrJoanneSkiles