# Building a serverless AI assistant at Pelago: concept to care in two weeks

[AWS](https://yomu.fyi/company/aws) · Anton Aleksandrov · Jul 22, 2026

**Type:** Problem & solution

## Summary

Pelago engineered a serverless, event-driven AI assistant on AWS within two weeks to provide substance use recovery coaches with contextual response suggestions. Operating under strict Protected Health Information constraints, the system maintains clinical safety through human-in-the-loop review and keeps data confined to an Amazon VPC. Incoming messages flow via AWS AppSync and Amazon DynamoDB to an Amazon SNS topic, which fans out to independent AWS Lambda functions. The asynchronous Chat Assistant Lambda queries history, invokes Amazon Bedrock, and persists suggestions into Amazon RDS MySQL in under 10 seconds. When coaches access a conversation via Amazon API Gateway, pre-generated suggestions load in under 100 milliseconds.

## Context

Pelago needed to scale personalized substance use coaching without overburdening care teams. Coaches manage dozens of conversations requiring weeks of context, making synchronous LLM generation unacceptably slow. Strict PHI regulations also required keeping all data within Pelago's AWS VPC environment with mandatory human-in-the-loop oversight.

## Approach / What changed

Pelago implemented an asynchronous, event-driven serverless architecture using AWS AppSync, DynamoDB, Amazon SNS, and AWS Lambda. SNS fans out events to a Chat Assistant Lambda that invokes Amazon Bedrock in the background and writes suggestions to Amazon RDS MySQL, while API Gateway retrieves pre-generated suggestions on demand.

## Takeaways

- Decoupling message delivery from LLM processing through Amazon SNS fanout prevents tens-of-seconds inference times from blocking user interactions.
- Asynchronous background inference allows Amazon API Gateway and Lambda to serve pre-generated suggestions to coaches in under 100 milliseconds.
- Pelago used DynamoDB for high-throughput conversation writes and Amazon RDS MySQL for structured suggestion querying, analytics joins, and idempotency checks.

**Tags:** [Architecture](https://yomu.fyi/topic/architecture), [AWS](https://yomu.fyi/topic/aws), [LLMs](https://yomu.fyi/topic/llm), [MySQL](https://yomu.fyi/topic/mysql), [Serverless](https://yomu.fyi/topic/serverless)

[Read original post](https://aws.amazon.com/blogs/architecture/building-a-serverless-ai-assistant-at-pelago-concept-to-care-in-two-weeks)
