A lightweight Node.js server that processes exam questions using AI capabilities from OpenRouter's API, specifically designed to interact with the Google Gemini model.
- Processes exam questions using AI models
- RESTful API endpoints for question processing
- Configurable system prompts
- Deployed to Azure Web App
- CI/CD with GitHub Actions
The Zolve AI Agent acts as a middleware between client applications and AI models. When a question is submitted, the server:
- Receives the question through the
/processendpoint - Formats the question with system prompts
- Sends the formatted request to OpenRouter API
- Processes the AI model's response
- Returns a clean, formatted answer
The agent is specifically designed to interpret exam questions and return concise answers in the format "Question Number ⇒ Answer" without showing the reasoning process.
- Node.js v22.x
- npm (comes with Node.js)
- OpenRouter API key
-
Clone the repository:
git clone https://github.com/gitnasr/zolve-agent.git cd zolve-agent -
Install dependencies:
npm install
-
Create a
.envfile in the root directory with the following variables:PORT=3000 OPEN_ROUTER_API_KEY=your_openrouter_api_key -
Build the project:
npm run build
For development with hot reload:
npm run devFor production:
npm startPOST /process
Request body:
{
"messages": [
{
"content": "Question #1 (Only one answer valid):\n\n What is 2+2?\n\nOptions:\nA) 3\nB) 4\nC) 5\nD) 6"
}
]
}Response:
{
"response": "Question 1 ⇒ B"
}GET /config
Response:
{
"globalPrompt": "You role is a Student that currently having an exam..."
}└── zolve-agent/
├── README.md # Project documentation
├── nodemon.json # Nodemon configuration
├── package.json # Project dependencies and scripts
├── tsconfig.json # TypeScript configuration
├── .deployment # Azure deployment configuration
├── .eslintrc.js # ESLint configuration
├── src/ # Source code
│ ├── index.ts # Server entry point
│ ├── controller/ # Request handlers
│ │ └── index.ts # Controller definitions
│ ├── router/ # API routes
│ │ └── index.ts # Route definitions
│ └── service/ # Business logic
│ └── ExamProcessor.ts # Exam processing service
└── .github/ # GitHub configuration
└── workflows/ # CI/CD workflows
└── zolve-agent_zolve.yml # Azure deployment workflow
Sets up a Fastify server with CORS support and configures environment variables.
Provides the system prompt for AI and sends questions to the OpenRouter API.
Handles HTTP requests and processes exam questions.
Defines API routes for the application.
npm start: Run the built applicationnpm run build: Compile TypeScript to JavaScriptnpm run dev: Run the application with nodemon for developmentnpm run lint: Lint the codebase
Contributions are welcome! To contribute:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request