An "Agentic" serverless solution powered by Amazon Bedrock that autonomously diagnoses, remediates, and verifies sellability issues in e-commerce systems.
In large-scale e-commerce, synchronization between upstream systems (Inventory Service, Pricing Engine, PIM Service) and the web database (DynamoDB) often fails due to transient race conditions or data inconsistencies. This project implements a self-healing diagnostic agent that business users can query in natural language to repair product data discrepancies automatically.
- ⛓️ Agentic Chain-of-Thought: The agent uses an autonomous reasoning loop (Diagnose → Investigate → Remediate → Verify) instead of simple scripts.
- 🛠️ Self-Healing Auto-Remediation: Automatically detects transient "Database Lock" errors (race conditions) in the Dead Letter Queue (DLQ) and triggers a manual override sync.
- 📚 Agentic RAG (Mock Knowledge Base): Features a
queryTroubleshootingGuidetool that allows the agent to "research" technical error codes manually before deciding on a resolution. - ✅ Closed-Loop Verification: After performing a fix, the agent proactively re-checks the web state to ensure the product is truly "Sellable" before notifying the user.
graph TD
User([Business User]) -->|Natural Language| Agent[Amazon Bedrock Agent]
Agent -->|Reasoning Loop| Executor[AWS Lambda Executor]
subgraph "Diagnostic Tools"
Executor -->|Check Web DB| Dynamo[(Web DynamoDB)]
Executor -->|Check Upstream| INV[(Inventory Service)]
Executor -->|Check Upstream| PRCE[(Pricing Engine)]
Executor -->|Check Metadata| PIM[(PIM Service)]
Executor -->|Check Queue| SQS[SQS/DLQ Health]
end
subgraph "Remediation & RAG"
Executor -->|Trigger Sync| SyncAPI[Sync API]
Executor -->|Consult Guide| RAG[Troubleshooting Guide]
end
- AI Orchestration: Amazon Bedrock Agents (Claude 3 Sonnet)
- Compute: AWS Lambda (TypeScript / Node.js 18.x)
- Infrastructure: Serverless Framework (Infrastructure as Code)
- Security: IAM Roles & Action Group Permissions
src/handlers/executor.ts: The core "Action Group" executor where the diagnostic and remediation logic lives.serverless.yml: Defines the Bedrock Agent, Action Groups, and Lambda permissions.src/handlers/chat.ts: A helper function for programmatically interacting with the agent.
New in Project 1: Test the agent logic directly from your terminal!
- Copy
.env.exampleto.envand fill in yourAGENT_IDandAGENT_ALIAS_ID. - Install & Chat:
npm install npm run chat
Project 1 now includes a built-in evaluation suite to measure agent accuracy:
- Ensure your agent is deployed (
sls deploy) and yourAGENT_IDis set in.env. - Run the suite:
npm run eval
Note: This suite tests your live Bedrock Agent deployment to verify its multi-step diagnostic logic.
- Active AWS Account with Amazon Bedrock Model Access (Claude 3 Sonnet).
- Serverless Framework installed (
npm install -g serverless). - AWS CLI configured with necessary permissions.
- Clone the repository:
git clone [your-repo-url] cd bedrock-full-reconciliation - Install dependencies:
npm install
- Deploy to AWS:
sls deploy --stage dev
User: "Why is product prod_9982 not showing up on the site?"
- Diagnosis: Agent calls
checkWebDatabase(Result: Status isNOT_SELLABLEdue to 0 inventory). - Comparison: Agent calls
checkInventoryService(Result: Core system has 150 units in stock). - Root Cause Analysis: Sensing a discrepancy, the agent calls
checkDeadLetterQueueand finds aConsumerDatabaseTimeoutException(Race Condition). - Research: Agent calls
queryTroubleshootingGuideand learns that an autonomoussyncSystemoverride will resolve this lock contention. - Remediation: Agent calls
syncSystem(system="inventory")to force-refresh the web database. - Verification: Agent re-runs
checkWebDatabaseand confirms the site is nowSELLABLE. - Resolution: Agent informs the user the diagnostic and repair are complete!
Palamkunnel Sujith - AI & Serverless Architect
- LinkedIn: [https://www.linkedin.com/in/sujithpvarghese/]
Distributed under the MIT License.