Status: In Development · Playground demo coming soon.
The recipe below is complete and runnable today; only the hosted playground showcase is pending.
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
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
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 tenantuser_id = <stable user ID>: strict per-user isolationconversation_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
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 callsdk.memories.createwith a narrative summary (“Goal: half-marathon by October, training 4 days/week, knee-aware”).
- The model isn’t pulling DB state. Sharpen the system prompt: “Before any plan advice, call
get_current_planandget_streak.” If you’re using the TS wrapper, ensure tools fire by giving the model an explicit instruction to check state.
- The
suggest_plan_adjustmenttool needs the reason to come from Synap memory (injury context, life events). Without it, you get generic deload weeks.
Related
- Integrations: OpenAI Agents SDK · Vercel AI SDK
- Concepts: Memory Types · Memory Scopes · Long-term Context
- Other recipes: AI Companion · Voice Concierge