In the healthcare sector, scaling personalization is one of the most complex challenges. When an organization serves thousands of patients with behavioral needs, every interaction must reflect weeks of clinical and emotional history. Building an assistant that helps the clinical team without compromising privacy, speed, or quality requires careful architecture. Pelago, a digital clinic for substance use disorder treatment, demonstrated that this can be achieved in just two weeks using serverless services and artificial intelligence on AWS. This case inspires any regulated company seeking to innovate with artificial intelligence while maintaining data control.
Pelago’s engineering team faced a typical growth scenario: a single coach could hold active conversations with dozens of members at once. Drafting each response from scratch, accounting for all prior context, consumed valuable time. The solution could not send automated replies; human oversight was non-negotiable in a behavioral health environment. Additionally, protected health information (PHI) could not leave the AWS environment, and response times had to be near-instant for the care team. With these constraints, the team designed an event-driven system that separates suggestion generation from the end-user experience.
The chosen architecture is fully serverless. When a member sends a message, it is stored in DynamoDB and published to an Amazon SNS topic. From there, multiple Lambda subscribers process the event in parallel: one saves metadata, one sends analytics to Amplitude, one triggers push notifications, and the most relevant one invokes Amazon Bedrock to produce contextual suggestions. This asynchronous process takes less than four seconds, but the result is saved in MySQL so that when the coach opens the conversation minutes later, the suggestion is retrieved in under 100 milliseconds. The user never waits for model inference.
Choosing serverless services not only accelerates development but also simplifies operations. There are no servers to patch, no scaling configurations to adjust. When a traffic spike multiplies message volume by eight during a seasonal campaign, Lambda functions scale horizontally without human intervention. This pay-per-invocation model eliminates idle infrastructure costs, a crucial factor for startups and mid-size companies that need to optimize every euro invested in technology.
Security was a pillar from the start. To maintain HIPAA eligibility, all traffic to Amazon Bedrock travels through VPC endpoints, never over the public internet. Data is encrypted at rest in DynamoDB and RDS, communications use TLS 1.2+, and IAM permissions follow the principle of least privilege. Audit logs capture only message identifiers, not content. Every model invocation is recorded in CloudWatch, providing traceability without exposing sensitive information.
One technical success was separating programming languages based on the task. The Lambda functions that invoke Bedrock were written in Python, leveraging Boto3 maturity and ease of string manipulation for prompt engineering. In contrast, the suggestion retrieval function was written in TypeScript, maintaining consistency with the rest of the backend and reusing shared libraries. This polyglot strategy allows using the right tool for each job without forcing a single runtime across the entire system.
Pelago’s team also solved the idempotency problem. Since SNS may deliver the same message more than once, the Lambda function checks whether a suggestion already exists for that message before invoking Bedrock. This avoids duplicate invocations that would waste compute costs and could generate conflicting suggestions. If the model fails due to rate limits, an internal retry mechanism ensures the suggestion is eventually generated without blocking the message flow.
The business results speak for themselves. Response preparation time dropped by 40% on average, and 79.6% of AI-generated suggestions were rated as helpful by the care team. This adoption level shows that technology not only saves time but also improves care quality by freeing coaches to focus on what really matters: human connection.
Building such a system from scratch can seem daunting for small teams. This is where a company like Q2BSTUDIO adds value. With experience in custom software, integration of cloud services like AWS and Azure, and expertise in cybersecurity, Q2BSTUDIO can replicate this pattern in any regulated sector. From AI agents for customer service to clinical assistants compliant with HIPAA or GDPR, the serverless and event-driven approach enables scaling without complexity. Moreover, incorporating BI tools like Power BI to analyze suggestion performance and team satisfaction completes an ecosystem where data drives continuous improvement.
Pelago’s experience proves that it doesn’t take months of development or huge teams to implement generative AI in critical environments. With a well-designed architecture, serverless services, and the right technology partner, any organization can go from concept to production in a matter of weeks. The key is to separate concerns, prioritize asynchrony, and always keep the human at the center of decision-making.





