All posts

Build a Vietnamese chat agent in a day — with LocDo's open-source starter

Six-step walk-through (clone → configure endpoint → custom tool → custom persona → deploy Vercel → test) using LocDo's MIT-licensed starter. UI + multi-step tool calling + VN persona out of the box, ship in a day.

May 2, 2026Loc Do
TutorialAI AgentOpen SourceNext.js

Build a Vietnamese chat agent in a day — with LocDo's open-source starter

The chat widget at the bottom-right of this page is the exact pattern this post walks through. It's MIT-licensed and on GitHub:

github.com/locdo-freelancer/locdo-chat-agent-vn-starter

Why a Vietnamese-first chat agent template? Most "AI agent" boilerplates on GitHub are English-only with stiff "Dear customer" personas, assuming OpenAI's direct API. Vietnamese teams copy them and end up with a bot that talks like ChatGPT, burns tokens, and doesn't close leads. This starter is the opposite: VN-first persona, tool-first answers, works against any OpenAI-compatible endpoint.

Goal: from git clone to a live chat agent on Vercel within one working day.


What you'll have

  • Floating chat widget (mobile + desktop), Esc handler, sessionStorage, status indicator.
  • 5 tools out of the box: searchCourses, searchProducts, getServices, listFAQ, captureLead.
  • Multi-step tool calling — model decides when to look up, when to ask, when to propose.
  • VN consultant persona: short, sharp, no filler, anchored to VN-market context (Misa / Fast / Zalo / MoMo).
  • simulateStreamingMiddleware workaround for gateways that drop tool_calls from stream chunks.
  • MIT license — fork, rebrand, ship commercial.

Six steps

  1. Clone + install (~5 min). Drop OpenAI-compat endpoint into .env.local. Default model: gemini-2.5-flash.
  2. Custom tool (~1-2h). Replace stub data with your DB/API. Action-oriented descriptions, Zod inputSchema, server-side execute returning typed objects with a type discriminator the renderer keys off.
  3. Custom persona (~30 min). Edit system-prompt.ts. Keep the 4-step flow (ASK → DATA → RECOMMEND → CLOSE) and the BAN list — that's what stops the bot from selling like a SaaS popup.
  4. Lead capture wiring (~1h). Replace the captureLead stub with DB insert + fire-and-forget email notify.
  5. Deploy (~15 min). vercel, set 3 env vars, push.
  6. Test + iterate (~2h). Five canonical prompts: greeting, tool intent, pricing, out-of-scope, lead intent. 90% of "bot didn't call the tool" is fixable in the system prompt.

(Vietnamese version above has the full code samples.)


When to build vs hire

DIY if you're a dev + have a day + scope is simple (Q&A + lead capture).

Hire LocDo for: tight Misa/Fast/SAP/Salesforce integration, RAG on a 100+ page knowledge base, multi-channel (web + Zalo + email), audit + RLS + multi-tenant, or SLA + on-call.

Pricing detail in our AI agent cost breakdown post.

Ping the assistant at the bottom-right if you want a quick estimate.

— Loc Do, founder, LocDo.Tech

Want a quick cost estimate for your project?