This repository contains the source code for a functional AI support agent built without external agent frameworks.
The project is designed to illustrate the core mechanics of an AI agent, focusing on implementing the Agent Loop, Memory (Conversation History), and Function Calling (Tools) using only the native Google Gen AI SDK.
- Core Agent Loop: Handles conversation flow and decision-making.
- FAQ Handling: Answers static questions efficiently using the system prompt.
- Order Validation: Uses a custom tool (
validateOrder) to check order details. - Refund Escalation: Uses a custom tool (
raiseRefundRequest) to simulate internal communication.
- Language: TypeScript
- LLM SDK: Google Gen AI SDK
- Model: Gemini-2.5-Flash
-
Ensure you have Node.js 25 and pnpm installed.
-
API Key Setup:
- You need a Gemini API key. Follow this guide to get one if you don't have one already.
- Copy the example environment file and replace the placeholder API key.
cp env-example .env # update the .env file contents with your own API key
-
Install the project dependencies
pnpm install
-
Start the agent loop
pnpm start
A detailed, step-by-step explanation of this implementation is available in the accompanying blog post: