This is an AI Agent backend system built in TypeScript (Node.js), featuring:
- Chat interface with memory
- Retrieval-Augmented Generation (RAG)
- Plugin system (Math + Weather)
- Hosted on Google Cloud Run
POST /agent/message— Send a message to the agent with asession_id.- Persistent memory for each session.
- Retrieves top 3 relevant context chunks from a local vector store (markdown/text files).
- Supports plugin execution for:
- Math expressions (
2 + 5 * 3) - Weather search (
weather in Mumbai)
- Math expressions (
- Uses Groq’s
LLaMA 3 70Bfor inference.
git clone https://github.com/kashewknutt/openagent-ts.git
cd openagent-ts/backend # Create your .env here in this backend folder.
# Install dependencies
npm install
# Run development server
npm run devHosted on Google Cloud Run
Live URL:
https://openagent-ts-backend-365628037012.asia-south1.run.app/agent/message
curl -X POST https://<your-deployed-url>/agent/message \
-H "Content-Type: application/json" \
-d '{
"session_id": "test123",
"message": "What is 12 * 8 + 1?"
}'backend/
├── src/
│ ├── agent/ # Core agent logic
│ ├── plugins/ # Plugin system (math + weather)
│ ├── rag/ # Embedding + vector search logic
│ ├── store/ # In-memory session store
│ └── index.ts # Express entry point
├── .env
├── package.json
└── README.md
- Local markdown/text files stored in
/data/ - Chunked and embedded on startup
- Vector search uses cosine similarity
- Top 3 matches are injected into prompt
Evaluates basic math expressions.
Mocks or fetches current weather using a sample API.
GROQ_API_KEY=<your-groq-key>