Skip to main content
Status: In Development · Playground demo coming soon. The recipe below is complete and runnable today; only the hosted playground showcase is pending.
A wellness coach that holds the user’s goals, current plan, what they’ve actually done, and what’s been hard. It celebrates streaks, flexes plans when life gets in the way, and never starts from zero on Monday morning.

What you’ll build

A coaching agent that:
  • Tracks goals and plans: primary goal, weekly plan, constraints
  • Logs adherence: workouts, meals, sleep, sessions (whatever your domain is)
  • Adapts plans: if the user skipped three sessions, the next plan reflects that
  • Holds the narrative: last week’s slump, the injury that’s still healing, the trip coming up
Est. build time: 45 minutes (more if your logging schema is rich).

When to use this recipe

Build this if:
  • Your product has a notion of a plan the user is following over weeks
  • Adherence (what got done vs what was planned) matters as much as what’s currently planned
  • You want the coach to feel continuous, not session-bound
  • The user is the only client; per-user isolation is strict

Architecture at a glance

Stack

Prerequisites

  • A Synap API key. See Authentication
  • A DB for structured session logs (Synap is not your activity log; it’s the memory that wraps around it)
  • Python: Python 3.11+
  • TypeScript: Node 18+ and Python 3.11+ on the host
TypeScript recipe runs on Node only. Pin Next.js route handlers to export const runtime = "nodejs". See Installation → JavaScript / TypeScript SDK.

Install

Configure

Build it

1. The Synap-vs-DB split

This is the key call: structured data lives in your DB; narrative lives in Synap. Tools read both. The system prompt teaches the agent which is which.

2. Identity & scoping

  • customer_id = "coach": single tenant
  • user_id = <stable user ID>: strict per-user isolation
  • conversation_id: one continuous conversation per user works well here (this is a long-running relationship)
conversation_id, user_id, and customer_id must be valid UUIDs. Generate ids with crypto.randomUUID() (JS) or str(uuid.uuid4()) (Python), as shown below.

3. Business tools

4. System prompt

System prompt

5. Wire it together

Run & verify

Week 1
Week 4 (fresh session)
Week 8
The coach remembers the knee history (Synap), checks current plan (tool), proposes an adjustment (tool), and stays warm.

Customize / extend

  • Companion flavor → if you want less goal-driven and more open-ended, see AI Companion.
  • Voice journaling → swap the chat handler for Voice Concierge. Coaching by voice is natural.
  • Apple Health / Wearable ingestion → write structured rows to your DB; let Synap pick up the narrative when the user mentions it.
  • Cohort coaching → set customer_id = <cohort_id> to share light context (community PRs, group challenges) across users within a cohort while keeping personal context per-user_id.

Troubleshooting

Coach asks the same intake questions every session
  • Confirm goal-setting facts are being ingested. After set_goal, also call sdk.memories.create with a narrative summary (“Goal: half-marathon by October, training 4 days/week, knee-aware”).
Coach doesn’t adapt when user misses sessions
  • The model isn’t pulling DB state. Sharpen the system prompt: “Before any plan advice, call get_current_plan and get_streak.” If you’re using the TS wrapper, ensure tools fire by giving the model an explicit instruction to check state.
Plan adjustments feel generic
  • The suggest_plan_adjustment tool needs the reason to come from Synap memory (injury context, life events). Without it, you get generic deload weeks.