A comprehensive AI workshop project demonstrating how to build and deploy an AI-powered security agent using LangGraph, Model Context Protocol (MCP), and Azion Edge Computing. This repository contains three interconnected projects that work together to create a full-stack AI chatbot application.
This workshop consists of three main components:
- Backend - AI Agent API powered by LangGraph and Hono
- Frontend - Vue3 chatbot widget interface
- MCP Server - Model Context Protocol server for extending AI capabilities
βββββββββββββββββββ
β Frontend β
β (Vue3) β
ββββββββββ¬βββββββββ
β
βΌ
βββββββββββββββββββ βββββββββββββββββββ
β Backend βββββββΊβ MCP Server β
β (LangGraph) β β (Tools) β
βββββββββββββββββββ βββββββββββββββββββ
β
βΌ
βββββββββββββββββββ
β Azion β
β (SQL Database) β
βββββββββββββββββββ
Before starting, ensure you have:
- Node.js (v18 or higher) and Yarn installed
- Azion CLI installed (Installation Guide)
brew install azion # For macOS - API Keys from:
- Azion Console - For edge deployment
- OpenAI - For AI models
- LangSmith (Optional) - For request tracing
git clone <repository-url>
cd tdc-2025-workshop-aiFollow the setup instructions for each component in order:
The backend is an AI agent built with LangGraph framework, deployed on Azion Edge Computing.
cd backend
yarn installCreate a .env file in the backend directory with the following variables:
# Required
AZION_TOKEN=your_azion_token
OPENAI_API_KEY=your_openai_api_key
# Optional - Model Configuration
OPENAI_MODEL=gpt-4o
EMBEDDING_MODEL=text-embedding-3-small
# Optional - LangSmith Tracing
LANGSMITH_API_KEY=your_langsmith_key
LANGCHAIN_PROJECT=your_project_name
LANGCHAIN_TRACING_V2=false
# Database Configuration
MESSAGE_STORE_DB_NAME=your_messagestore_db
MESSAGE_STORE_TABLE_NAME=messages
VECTOR_STORE_DB_NAME=your_vectorstore_db
VECTOR_STORE_TABLE_NAME=vectors-
Initialize the database:
yarn setup-db
-
Upload documents for RAG:
yarn upload-docs
This will process files from
migrations/files/(supports PDF, MD, JSON, TXT).
# Build the project
azion build
# Run locally
azion devThe server will start at http://localhost:3333
# Test the agent locally
curl 'http://localhost:3333/' \
--data-raw '{"messages":[{"role":"user","content":"Hello"}],"stream":false}'azion deployAfter deployment, test with:
curl 'https://<your-domain>/' \
--data-raw '{"messages":[{"role":"user","content":"Hello"}],"stream":false}'yarn upload-docs- Upload documents to vector databaseyarn setup-db- Initialize database schemayarn lint- Run ESLintyarn lint:fix- Fix linting issuesyarn type-check- TypeScript type checking
The MCP (Model Context Protocol) server provides additional tools and capabilities for the AI agent.
cd mcp-server
yarn install# Build the server
azion build
# Run locally
azion dev- Calculator - Perform basic arithmetic operations (add, subtract, multiply, divide)
To add new tools, edit src/core/tools.ts and follow the MCP protocol specifications.
azion deployA Vue3-based chatbot widget that provides the user interface for interacting with the AI agent.
cd frontend
yarn installCreate a .env file in the frontend directory based on .env.example:
# Backend Configuration
VITE_BACKEND_COPILOT_ENDPOINT_TESTAGENTV3=https://your-backend-url
# UI Configuration
VITE_THEME=dark
VITE_TITLE=Security Agent + MCP Server
VITE_SUBTITLE=Make your Agent with MCP Server
VITE_PREVIEW_TEXT=Hello
VITE_FOOTER_DISCLAIMER=
# Suggestion Options (customize as needed)
VITE_SUGGESTION_1_TITLE=List the latest HTTP events for my application.
VITE_SUGGESTION_1_CONTEXT=List the latest HTTP events for my application.# Start development server
yarn devThe application will be available at http://localhost:5173
yarn buildazion deployyarn dev- Start development serveryarn build- Build for productionyarn preview- Preview production build
tdc-2025-workshop-ai/
βββ backend/ # AI Agent Backend
β βββ src/ # Source code
β βββ migrations/ # Database migrations and setup
β βββ azion.config.ts # Azion configuration
β βββ package.json
β
βββ frontend/ # Vue3 Chatbot Widget
β βββ src/ # Vue components and logic
β βββ public/ # Static assets
β βββ azion.config.mjs # Azion configuration
β βββ package.json
β
βββ mcp-server/ # Model Context Protocol Server
β βββ src/ # MCP server implementation
β βββ azion.config.ts # Azion configuration
β βββ package.json
β
βββ README.md # This file
Monitor your AI agent's requests and responses through LangSmith:
- Set up LangSmith environment variables in backend
.env - Enable tracing:
LANGCHAIN_TRACING_V2=true - View traces in your LangSmith dashboard
The backend includes capabilities for evaluating:
- Retrieval Quality - Document relevance and retriever performance
- Hallucination Detection - LLM adherence to source material
- Answer Relevance - Response quality to questions
- Reference Answers - Comparison against ground truth
For detailed evaluation guides, see LangSmith Evaluation Tutorials.
- LangGraph - AI agent framework
- Hono - Web framework
- OpenAI - Language models
- Azion EdgeSQL - Vector database
- TypeScript - Programming language
- Vue 3 - Frontend framework
- PrimeVue - UI components
- TailwindCSS - Styling
- Vite - Build tool
- Axios - HTTP client
- Model Context Protocol SDK - MCP implementation
- Hono - Web framework
- Zod - Schema validation
- Azion Documentation
- LangGraph Introduction Course
- LangSmith Documentation
- Model Context Protocol
- Azion EdgeSQL Shell
This is a workshop project. Feel free to experiment and extend the functionality!
ISC License - See individual project package.json files for details.
-
Database connection errors
- Verify
AZION_TOKENis set correctly - Ensure databases are created with
yarn setup-db
- Verify
-
OpenAI API errors
- Check
OPENAI_API_KEYis valid - Verify you have sufficient API credits
- Check
-
Build failures
- Clear node_modules and reinstall:
rm -rf node_modules && yarn install - Ensure you're using Node.js v18 or higher
- Clear node_modules and reinstall:
-
Frontend can't connect to backend
- Verify
VITE_BACKEND_COPILOT_ENDPOINT_TESTAGENTV3points to correct backend URL - Check CORS settings if deploying to different domains
- Verify
For issues related to:
- Azion Platform: Azion Support
- LangChain/LangGraph: LangChain Discord
Happy Building! π