Demo project for the article "How to Build a Customer Support Agent with ADK-TS"
ADK-TS · React · Vite · Built-in Tools · Custom Tools · Session State
This is the code demo for the article on the IQ blog:
Branch guide:
starter— UI complete, agent stubs in place — start here when following the articlefinal— Complete implementation: fully working agent with all tools, session state, and error handling
Please give this repo a ⭐ if it was helpful to you!
- Overview
- Features
- Architecture
- Technologies Used
- Prerequisites
- Getting Started
- Usage
- License
- Additional Resources
This is a customer support chatbot built with ADK-TS. It covers how to use ADK-TS built-in tools (FileOperationsTool, HttpRequestTool) alongside a fully custom tool built with createTool, with session state wired in throughout. The project runs as a web chat UI and as an interactive terminal CLI.
- Policy Q&A — answers shipping, return, payment, and membership questions from local markdown files
- Live order lookup — fetches real-time cart/order data by order number
- Account lookup — retrieves user details by user ID
- Human escalation — generates a timestamped ticket ID and flags the session when the agent can't resolve an issue
- Two run modes — web chat UI or interactive terminal CLI
- Multi-model support — works with Gemini, OpenAI, or Anthropic Claude via a single env var swap
- Session state — tracks escalation status across the conversation using ADK-TS state
flowchart TD
U["👤 User"] --> UI["Chat UI\n(React + Vite)"]
U --> CLI["Terminal CLI\n(readline)"]
UI -->|POST /chat| S["Node HTTP Server\nserver/server.ts"]
CLI --> R
S --> R["Agent Runner\n(ADK-TS)"]
R --> LLM["LLM\n(Gemini / OpenAI / Claude)"]
LLM --> F["FileOperationsTool\nreads knowledge-base/*.md"]
LLM --> H["HttpRequestTool\nGET dummyjson.com/carts or /users"]
LLM --> E["escalate_to_human\ncustom tool — creates ticket, sets state"]
F --> R
H --> R
E --> R
R --> U
- ADK-TS – TypeScript framework for building AI agents
- React 19 – Chat UI
- Vite – Frontend dev server and bundler
- Zod – Schema validation for custom tool inputs
- Google AI (Gemini) – Default LLM provider (OpenAI and Anthropic also supported)
- Node.js 22+ — Download Node.js
- A package manager of your choice (pnpm, npm, yarn, etc.)
- An API key for your chosen model provider:
- Google AI Studio (default — Gemini)
- OpenAI
- Anthropic
-
Clone the repository:
git clone https://github.com/IQAIcom/customer-support-agent.git cd customer-support-agent -
Install dependencies:
pnpm install
-
Set up environment variables:
cp .env.example .env
Add your API key to
.env:GOOGLE_API_KEY=your_google_api_key_here LLM_MODEL=gemini-2.5-flash
To use a different provider, swap the key and model:
# OpenAI OPENAI_API_KEY=your_openai_api_key_here LLM_MODEL=gpt-4o # Anthropic ANTHROPIC_API_KEY=your_anthropic_api_key_here LLM_MODEL=claude-sonnet-4-6
-
Start the app:
Web chat UI (server + frontend together):
pnpm dev
Open http://localhost:5173.
Terminal CLI (no UI, just the agent in your terminal):
pnpm dev:cli
Web UI (pnpm dev) — type a message into the chat box and press Send. Use the example prompt buttons on first load to try common support scenarios.
CLI (pnpm dev:cli) — type your question at the You: prompt and press Enter. Type exit to quit.
Things to try:
What is your return policy?— agent readsrefund-policy.mdand answers from itHow much does shipping cost?— agent readsshipping-info.mdWhere is my order? My order number is 3— agent calls the live orders APILook up my account, my user ID is 1— agent calls the live users APII need to speak to a human agent— agent creates an escalation ticket and prints it to the server console
MIT — see LICENSE.