Shipping it
Where it runs
The agent works on your laptop. Now it has to run all day, every day, for real parents.
Putting it somewhere real users can reach is called deploying it. Before you do, know every piece a message passes through, because each one can fail.
- WhatsAppA parent sends a message. WhatsApp passes it to Northstar's web address.
- serverYour code, on a server that's always on, receives it and hides personal details.
- modelYour code calls the model, which may ask for tools: fees or slots.
- checksThe guardrails check the reply.
- WhatsAppThe reply goes back to the parent.
- sheetThe lead and the chat are saved to the lead tracker.
Each piece needs a key. Where do keys go?
Keep keys secret
Your code proves who it is to WhatsApp and to the model company with secret codes called API keys. Anyone with the key can spend Northstar's money or read its messages.
So keys never go in the code, in a chat or on GitHub. They're stored on the server, in settings the code reads when it starts, called environment variables.
Keys aren't the only secret.
Protect personal data
Enquiries carry phone numbers, emails and family stories. Kevin's first worry was exactly this.
Send the model only what it needs to answer. A phone number never helps it answer a fee question, so replace it with a placeholder before the call. India's data protection law, the DPDP Act, also expects you to collect and share as little as you need.
Practise hiding data.
✏️ Practice 8.1
To show a number to staff without revealing it, keep only the last 4 digits: 9999901239 → ******1239.
share = count ÷ total × 100%
Keep the cost down
Models come in sizes. Big ones handle hard questions well but cost much more per call. Most enquiries are easy: fees, campuses, timings.
So send easy questions to a small, cheap model, and only hard ones to the big model. Sending each request to the right model is called routing.
Example prices: ₹0.60 per call on the big model, ₹0.05 on the small one. 3 calls per enquiry.
Ready to switch it on? Not all at once.
Roll out slowly
Don't switch it on for everyone on day one. Start small, watch closely, then grow.
And keep one switch that turns the agent off and sends every chat back to counsellors, in seconds. Going back to the old way like that is called a rollback.
- week 1Counsellors chat with it themselves, trying to break it.
- week 2Live at night only, 9 pm to 8 am. Counsellors read every chat next morning.
- week 3All hours, for 1 in 4 chats. Compare first-reply times with the rest.
- week 4Everyone, if the numbers hold. The off switch stays ready.
Work out the bill yourself.
✏️ Practice 8.2
monthly cost = enquiries × calls per enquiry × cost per call
Do it for real
Now get it ready for real users. In the notebook you'll scan for leaked keys, hide phone numbers and emails, and work out what routing saves.
Then you'll put the agent behind a web address with logging, run it in shadow mode, and build the switch that rolls it out, or back.
Colab runs Python in your browser for free. Replay mode needs no key. About 45 minutes.
Then check what stuck.
Lesson test
Five questions, all on new examples.
What's next?
Before you go on, an optional extra: Enterprise clients. Single sign-on, keeping clients' data apart, security reviews and webhooks. Big clients and interviewers both ask about these.