This repository provides a collection of serverless utilities designed for AI-driven tasks. The project includes REST endpoints for gathering information, communicating via email or WhatsApp, handling Google Drive files, and much more.
Agent Toolbox exposes a set of serverless APIs for tasks such as location lookup, Google searches, capturing website screenshots, weather data retrieval, and communication integrations. It is optimized for deployment on Vercel and can be used in other serverless environments.
api/ Vercel API routes that route requests to the functions
functions/ Core serverless functions
functions/unitConversion/ Utility APIs for unit conversions (length, weight, etc.)
public/ Static assets served by Vercel
utils/ Helper modules shared by the functions
types/ TypeScript type declarations
Each entry point in api/ proxies to a handler from the functions directory via toolsHandler.ts. The vercel.json file configures these routes for deployment.
Below is a summary of the main functions exposed through toolsHandler.ts:
- IPAddressLookUp – Resolves IP address information and caches results in MongoDB.
- getWebsiteScreenshot – Uses Puppeteer to capture screenshots of websites and uploads them to Google Drive.
- googleImageSearch – Performs Google image searches using the Scale SERP API.
- searchGoogle – Performs Google web searches via Scale SERP.
- fetchTodaysWeatherData / fetchWeeklyWeatherData / fetchExtendedWeather – Retrieve weather information.
- getIslamicPrayerTimingsDay / getIslamicPrayerTimingsWeek – Provide Islamic prayer times.
- Communication utilities – Send emails, SMS messages, WhatsApp messages, and audio conversions.
Other helpers in functions/unitConversion/ handle unit conversions (length, weight, temperature, etc.).
-
Install dependencies:
npm install
-
Create a local environment file by copying
.env.exampleto.envand fill in the required values. -
Start the development server with Vercel CLI:
npx vercel dev
The API will be available at
http://localhost:3000by default and will load values from your.envfile.
Send a JWT in the Authorization header when calling any route. The token should be signed with the JWT_SECRET defined in your .env file.
Example request to perform a Google web search through api/toolsHandler:
curl -X POST http://localhost:3000/api/toolsHandler \
-H "Authorization: Bearer <your-jwt-token>" \
-H "Content-Type: application/json" \
-d '{"functionName":"googleWebSearch","searchTerm":"serverless"}'To view the welcome page you can call api/welcome:
curl -H "Authorization: Bearer <your-jwt-token>" http://localhost:3000/api/welcomeCreate a .env file using .env.example as a reference. Required variables include:
OPENAI_API_KEY– API key for OpenAI servicesOPEN_WEATHER_API_KEY– Key for OpenWeatherVISUAL_CROSSING_WEATHER_API_KEY– Key for Visual Crossing weather- MongoDB credentials:
DB_USERNAME,DB_PASSWORD,DB_NAME,DB_CLUSTER GDRIVE_SERVICE_ACCOUNT_JSON– Google Drive service account JSONTRUSTED_API_KEY– Shared API key for protected routesJWT_SECRET– Secret used for JWT verificationTOKEN_SERVICE_URL– URL of the JWT token service- Cloudinary credentials:
CLOUDINARY_CLOUD_NAME,CLOUDINARY_API_KEY,CLOUDINARY_API_SECRET - Azure speech:
AZURE_SPEECH_KEY,AZURE_SPEECH_REGION - WhatsApp integration:
WHATSAPP_GRAPH_API_TOKEN,WHATSAPP_GRAPH_API_URL,WHATSAPP_PHONE_ID,WHATSAPP_ASSISTANT_PHONE_NUMBER - Twilio:
TWILIO_ACCOUNT_SID,TWILIO_AUTH_TOKEN,TWILIO_ASSISTANT_PHONE_NUMBER GMAIL_MAILER_ASSISTANT_NAME– Sender name for GmailGOOGLE_API_KEY– Key for Google APIsSCALE_SERP_API_KEY– API key for Scale SERP web search
-
Install dependencies with
npm install. -
Build the TypeScript sources:
npm run build
-
Deploy to Vercel using the Vercel CLI:
npx vercel --prod
Vercel reads
vercel.jsonto configure functions and rewrites.
Tests run with Jest. After installing dependencies, run:
npm testThis executes the Jest test suite defined in the project.
MIT