AWS Builder Center
Building an Adaptive AI Habit Coach with Strands and Amazon Bedrock

Building an Adaptive AI Habit Coach with Strands and Amazon Bedrock

How I built a 21-day habit coach that combines native Android alarms, Spring Boot, Strands Agents SDK, and GPT-OSS 120B through Amazon Bedrock Mantle — while keeping the AI responsible for language, not application state.

Hi!

Building an Adaptive AI Habit Coach with Strands and Amazon Bedrock

Most habit trackers answer one question:
Did you complete your habit?
But when someone repeatedly misses a habit, simply marking another day as “missed” doesn't really help.
That was the problem I wanted to explore while building AI Habit Coach, a 21-day habit-building app created for the WeMakeDevs × AWS First Commit Hackathon.
The idea is simple:
Don't punish the miss. Prevent the pattern.

What I built

AI Habit Coach lets users describe a habit in natural language, choose a reminder time, and start a 21-day journey.
At the scheduled time, a real Android alarm triggers an AI coaching intervention. Users can mark the habit as DONE, SNOOZE it for 5, 10, or 15 minutes, or mark it MISSED.
The important part happens after the action.
The system looks at progress, streaks, missed days, feedback, and previous coaching strategies to adapt what the coach says next.
For example, repeated “no time” feedback can lead to a rescheduling suggestion, while consecutive misses can trigger a reflection-focused intervention.
The goal isn't to make users feel bad about missing a day. It's to understand why they're missing it.

The AI doesn't own the truth

One of my biggest architectural decisions was to keep the LLM away from application state.
The Spring Boot backend owns the source of truth:
  • Habit and journey state
  • Current day and streak
  • Missed days and snoozes
  • Feedback history
  • Coaching strategy
  • User profile and schedule
The backend selects the coaching strategy first. The AI then turns that structured context into natural language.
This gives the system a clear separation:
Spring Boot decides what is true. Strands decides how to express it.
That made the AI behavior much easier to reason about and test.

Architecture

The project is split into three main layers.
Mobile — React Native + Expo
The mobile app handles the UI, local state, offline behavior, text-to-speech, and communication with the backend. Native Android components handle the alarm system.
Backend — Spring Boot + Amazon Corretto 21
The backend runs on Java 21 using Amazon Corretto 21 and owns the application's source of truth, including habits, the 21-day journey, streaks, snoozes, feedback, user profiles, schedules, and coaching strategy selection.
AI — FastAPI + Strands Agents SDK + Amazon Bedrock
The Spring Boot backend sends the calculated habit context to a separate Strands service. Strands handles the AI agent and connects to Amazon Bedrock Mantle for model inference.
The complete flow is:
Android App → Spring Boot + Corretto → FastAPI + Strands → Amazon Bedrock Mantle → GPT-OSS 120B
The mobile app, Spring Boot backend, and database run locally. AWS provides the managed AI inference layer, while Amazon Corretto provides the Java runtime for the backend.

Why Strands and Amazon Bedrock?

I used the Strands Agents SDK as a dedicated AI coaching layer rather than putting model calls directly into the main backend.
Spring Boot sends Strands the context it has already calculated, including the habit, current day, streak, recent feedback, and selected coaching strategy.
For model inference, the Strands service connects to Amazon Bedrock Mantle through its OpenAI-compatible Responses API, using GPT-OSS 120B.
This separation keeps the application's business logic independent from the model.

Building a real alarm

Another interesting part of the project was making the reminder behave like an actual alarm rather than a normal notification.
The Android app uses the native AlarmManager and a foreground ringing service.
The flow is:
User selects time → AlarmManager → AlarmReceiver → AlarmRingService → Coaching intervention
Snoozing creates a separate one-time alarm without changing the user's permanent daily schedule.
This was a good reminder that building an AI application isn't only about the AI. The surrounding system has to work reliably too.

One problem I ran into

During development, I discovered that the Strands service was reusing the same Agent instance between requests.
That meant conversation state could potentially leak between unrelated requests.
I changed the service to create a fresh Agent for every generation request, keeping each generation isolated.
I also learned that telling a reasoning model to “keep the response short” isn't always enough.
For the Habit Advisor, I added explicit output constraints and a model-level output limit, while making backend-calculated values authoritative so the model couldn't reinterpret things like the user's streak.

What I learned

The biggest lesson wasn't a particular framework or AWS service.
It was deciding what the AI should and shouldn't be responsible for.
LLMs are great at turning structured context into natural language. They're much less suitable as the source of truth for application state when you need predictable behavior.
So the architecture ultimately came down to one rule:
The application owns the truth. The AI owns the conversation.
That allowed me to build an adaptive coach without giving the model control over schedules, streaks, or journey state.

What's next?

I'd like to explore:
  • Cloud deployment and cross-device synchronization
  • Longer-term behavioral analytics
  • More coaching strategies
  • Richer voice interactions
  • Wearable integrations
  • Smarter schedule suggestions
For now, the core experiment is simple:
Can an AI coach help someone understand why a habit keeps failing instead of simply telling them that they failed?
That's what I wanted to build with AI Habit Coach.
Don't punish the miss. Prevent the pattern.
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