AWS Builder Center
Building an Explainable Household Coordination Engine with Alexa+, Model Context Protocol (MCP), and AWS Serverless

Building an Explainable Household Coordination Engine with Alexa+, Model Context Protocol (MCP), and AWS Serverless

How we engineered a voice-first, deterministic coordination engine on AWS Lambda, Amazon DynamoDB, and Amazon Bedrock to rebalance invisible household labor without hallucinations.

AWS Community Builder, Test Architect, Multi-Hackathon Winner, Agentic AI Builder

Executive Summary

Family life is full of agreements: “If someone is delayed, don't let dinner turn into chaos,” “Make sure Dad confirms his evening medication,” or “Let’s share household chores fairly.” Yet smart home assistants in 2026 still treat domestic coordination as isolated alarms or static to-do lists. Even worse, purely generative LLM agents hallucinate chore states, prescribe medical advice unsafely, or amplify domestic friction by failing to understand the invisible cognitive burden of managing a home.

In this article, we share the architecture and engineering behind KithWealAI Covenant Engine, an open-source, voice-first household coordination engine built for the Build, Ship, Shape: Amazon Developer Hackathon.

We’ll explore:
  1. Implementing Model Context Protocol (MCP) Streamable HTTP ( 2025-11-25 ) on AWS Lambda and Amazon API Gateway.
  1. A zero-cost DynamoDB Single-Table Architecture featuring idempotent transaction commits and event sourcing.
  1. A Deterministic Agentic RAG pattern where Amazon Bedrock proposes structured intents, but deterministic policy engines enforce formal state machines.
  1. Two novel household AI capabilities: Invisible Labor Equity Auditing and Cross-Generational Caregiver Handoffs.



High-Level Architecture

The architecture balances low-latency voice execution with formal verification and auditable persistence:



Request Lifecycle Flow






1. Zero-Cost Serverless Model Context Protocol (MCP) on AWS Lambda

Model Context Protocol (MCP) standardizes how LLMs interact with external tools and context. While MCP often runs locally over stdio, Alexa+ and cloud-native agents connect to MCP servers over Streamable HTTP with Server-Sent Events (SSE).

Packaging Hono and MCP on AWS Lambda

We used Hono combined with  @modelcontextprotocol/server  to build a lightweight, ESM-bundled microservice running on AWS Lambda with Node.js 20.x:
// packages/mcp-server/src/app.ts
import { McpServer, createMcpHandler } from "@modelcontextprotocol/server";
import { Hono } from "hono";
import { cors } from "hono/cors";
import { alexaToolContracts, type AlexaToolName } from "./tool-contracts.js";
import { runAlexaTool, toMcpToolResult } from "./tool-handlers.js";

export function createMcpApp(dependencies: AlexaToolDependencies) {
const app = new Hono();

app.use(
"*",
cors({
origin: "*",
allowHeaders: ["Content-Type", "Accept", "mcp-protocol-version"],
allowMethods: ["GET", "POST", "OPTIONS"],
exposeHeaders: ["Content-Type", "mcp-protocol-version"],
}),
);

const mcpHandler = createMcpHandler(() => {
const server = new McpServer({
name: "kithwealai-covenant-engine",
version: "0.1.0",
});

for (const name of Object.keys(alexaToolContracts) as AlexaToolName[]) {
const tool = alexaToolContracts[name];
server.registerTool(
name,
{
description: tool.description,
inputSchema: tool.input,
outputSchema: tool.output,
annotations: tool.annotations,
},
async (input: unknown) => {
const result = await runAlexaTool(name, input, dependencies);
return toMcpToolResult(result);
},
);
}
return server;
});

app.post("/mcp", mcpHandler);
app.get("/healthz", (c) => c.json({ status: "ok", mode: "configured" }));
app.get("/readyz", (c) => c.json({ status: "ready" }));
return app;
}

Serverless Lambda Adapter

Using  hono/aws-lambda , the entire HTTP application compiles into a single 288 KB self-contained ESM bundle deployed on AWS Lambda with an Amazon API Gateway HTTP API v2 frontend.
  • Idle Cost: $0.00 / month (100% AWS Free Tier eligible).
  • Cold Start: < 220ms (esbuild minified, zero unused dependencies).
  • Warm Latency: 18ms – 35ms.



2. Deterministic Agentic RAG vs. Pure LLM Hallucinations

Domestic operations have a low tolerance for errors:
  • If a voice agent hallucinates whether an elderly parent took blood pressure medication, the consequence is dangerous.
  • If an agent invents chore assignments without household consensus, it exacerbates domestic resentment.
To eliminate hallucinations, KithWealAI enforces a Deterministic Safety Boundary:
[ Natural Language Input ]
│
▼
[ Amazon Bedrock (Nova / Claude) ] ── Proposes structured JSON schema
│
▼
[ Pure TypeScript Zod Gate ] ────── Rejects missing, conflicting, or out-of-bounds fields
│
▼
[ Formal State Machine ] ────────── Enforces atomic state transitions (DRAFT → READY → ACTIVE...)
│
▼
[ DynamoDB TransactWriteItems ] ──── Idempotent, versioned atomic commit

The Dual-Payload Pattern

Every MCP tool returns a strict dual payload:
  1.  voice : A concise, jargon-free spoken sentence (< 2 sentences) optimized for text-to-speech on smart speakers.
  1.  data : Deep epistemic summaries, evidence items, and Echo Show visual payloads ( _ui.compact  and  _ui.fullscreen ).
// Sample dual payload returned from confirm_medication_taken
{
"voice": "Dad confirmed taking his evening dose at 7:15 PM.",
"data": {
"ok": true,
"result": { "missionId": "med-1", "state": "COMPLETED", "version": 2 },
"explanation": { "code": "MEDICATION_DOSE_RECORDED" },
"evidence": {
"items": [{ "kind": "stated", "source": "Spoken confirmation", "label": "Adult consent verified" }]
},
"epistemicSummary": {
"statedFacts": ["Dad explicitly confirmed his evening dose."],
"observedFacts": ["Medication mission marked COMPLETED at version 2."],
"inferredFacts": [],
"openQuestions": []
},
"_ui": {
"component": "confirm_medication_taken-card",
"compact": { "title": "Medication confirmed", "summary": "Evening dose logged." },
"fullscreen": { "title": "Medication Log", "status": "Completed" }
}
}
}



3. DynamoDB Single-Table Design with Event Sourcing

We designed a single DynamoDB table ( KithWealHouseholdMissions ) that models both active mission entities and immutable audit event streams with optimistic concurrency control.

Table Schema

  • Partition Key ( pk ):  MISSION#<missionId>  or  COVENANT#<covenantId> 
  • Sort Key ( sk ):  STATE  (for current entity state) or  REQUEST#<requestId>  (for idempotency and events)
  • GSI 1 ( ActiveCovenantByType ):  gsiType  (HASH) +  gsiStatus  (RANGE)
  • GSI 2 ( MissionsByFamily ):  gsiFamily  (HASH)

Idempotent Atomic State Transitions

// packages/persistence/src/dynamo-mission-store.ts
await this.client.send(
new TransactWriteCommand({
TransactItems: [
{
// 1. Update current mission state with optimistic version check
Update: {
TableName: this.tableName,
Key: { pk: `MISSION#${missionId}`, sk: "STATE" },
UpdateExpression: "SET #s = :toState, #v = :toVersion, #u = :now",
ConditionExpression: "#v = :expectedVersion",
ExpressionAttributeNames: {
"#s": "state",
"#v": "version",
"#u": "updatedAt",
},
ExpressionAttributeValues: {
":toState": transition.toState,
":toVersion": transition.expectedVersion + 1,
":expectedVersion": transition.expectedVersion,
":now": new Date().toISOString(),
},
},
},
{
// 2. Write immutable event record preventing duplicate requestId execution
Put: {
TableName: this.tableName,
Item: {
pk: `MISSION#${missionId}`,
sk: `REQUEST#${requestId}`,
eventType: "STATE_TRANSITION",
fromState: transition.fromState,
toState: transition.toState,
fromVersion: transition.expectedVersion,
toVersion: transition.expectedVersion + 1,
actor,
timestamp: new Date().toISOString(),
},
ConditionExpression: "attribute_not_exists(pk)",
},
},
],
}),
);
If network jitter causes an Echo device to retry an MCP request, DynamoDB’s condition expression prevents duplicate state updates and returns the original execution result.



4. User Journey & Differentiator MCP Tools




A. Invisible Labor Equity Auditor ( audit_household_burden )

Domestic research demonstrates that over 70% of family chore friction stems not from the work itself, but from the asymmetric mental load of remembering, planning, and organizing.
Our tool analyzes decision-making history across household members:
  • Categorizes missions into cognitive tasks (meal planning, medication tracking) vs. physical tasks.
  • Calculates an empirical Burden Equity Index.
  • Generates gentle, non-accusatory rotational suggestions ("Jordan handled 68% of household tasks this week. Suggesting Sam take dinner coordination tonight to rebalance.").

B. Cross-Generational Caregiver Handover ( generate_caregiver_handover )

For multi-generational households with aging parents or young children:
  • Aggregates confirmed medications, completed hydration missions, and active facility tasks over a rolling 12–24 hour window.
  • Formats a handover briefing for incoming caregivers, relatives, or babysitters with verified timestamps and open alerts.



5. The Open-Source Companion Library

To support developers building ambient agents, we published  @kithweal/household-covenant-schema  as a standalone, MIT-licensed open-source library.



  • Runtime Footprint: Pure Zod with zero AWS, cloud, or framework dependencies.
  • Capabilities: Full covenant schemas, state machine validators, and offline counterfactual replay engines.
  • CI/CD: Automated GitHub Actions matrix across Node.js 20.x and 22.x with integrated Gitleaks secret scanning and npm audit.



Conclusion & Key Takeaways

  1. MCP + AWS Serverless is a Match Made in Heaven: AWS Lambda and API Gateway HTTP API v2 provide an ideal, zero-idle-cost host for Model Context Protocol Streamable HTTP endpoints.
  1. Deterministic Boundaries Prevent LLM Failure: Using LLMs (Amazon Bedrock) for flexible conversational proposals combined with deterministic schemas (Zod) for execution creates safe, production-ready AI agents.
  1. Build for Real Humans: AI tools excel when they address subtle human dynamics—like the invisible burden of running a home—rather than merely automating mechanical button clicks.

All source code, schemas, and live deployment runbooks are open source under the MIT License on  GitHub .
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article