Open Ask AI

Open Ask AI Server

A deployable-ready, serverless documentation assistant AI agent, can be hosted on Vercel, leveraging LLM through Vercel AI Gateway, and providing in-memory filesystem based agentic searching using bash-tool, ALL FOR FREE (Vercel Hobby Plan with generous quota usage).

Open Ask AI Server on GitHub is a template repository ready for deploy as a serverless function on Vercel.

Once deployed, it provides an API endpoint /api/stream that accepts conversation messages and streams back AI-generated responses based on pre-scanned markdown documentation files.

Then integrate with Open Ask AI Widget on your documentation site.

Usage

  1. Click "Use this template" to create your own repo, or fork this repository.
  2. Edit projects.json to define your documentation projects.
  3. Add your markdown documentation files in the projects/ directory.
  4. Optionally, add an AGENTS.md file in each project folder to provide additional agent instructions, such as what the project is about and what's the docs file structure.
  5. Deploy to Vercel using the Vercel CLI.
npm i -g vercel vercel login vercel --prod

Your AI agent API will be live at https://<your-vercel-project>.vercel.app/api/stream.

It accepts a POST request with conversation messages and streams back AI-generated responses. See the "API Endpoints" section below for details.

Features

Architecture

Core Components

How It Works

  1. Pre-generation: Run npm run build to scan all projects in projects/ directory
  2. Generated Files: Creates JSON files in generated/ with all markdown content
  3. Runtime: API loads project JSON into memory and creates bash-tool with files
  4. Agent Execution: ToolLoopAgent uses bash commands to search pre-loaded files
  5. Streaming: Returns UIMessage stream compatible with AI SDK UI components
Client Request → Vercel Function → AI SDK ToolLoopAgent bash-tool Pre-loaded Files (in-memory) Streaming Response → Client

Prerequisites

Setup

1. Install Dependencies

npm install

2. Configure Projects

Edit projects.json to define your documentation projects:

{ "my-project": { "name": "My Project" } }

3. Add Documentation

Create a directory for each project in projects/:

projects/ ├── my-project/ │ ├── AGENTS.md # (Optional) Agent instructions │ ├── getting-started.md │ ├── api-reference.md │ └── guides/ │ └── authentication.md

4. Generate Documentation Files

Scan all projects and generate JSON files:

npm run build

This creates files in generated/:

generated/ └── my-project.json

5. Initialize Vercel Project

npm install -g vercel vercel login vercel

5. Run Locally

vercel dev

Visit http://localhost:3000/api/health to verify the server is running.

API Endpoints

GET /api/health

Health check endpoint.

Response:

{ "status": "ok", "timestamp": "2026-02-04T12:00:00.000Z", "version": "1.0.0" }

POST /api/stream

Streaming conversation endpoint with multi-project support.

Request:

{ "messages": [ { "role": "user", "parts": [ { "type": "text", "text": "How do I configure authentication?" } ] } ], "project": "my-project" }

Parameters:

Response: Server-Sent Events stream with UIMessage format

Usage Examples

Health Check

curl http://localhost:3000/api/health

Simple Query

curl -X POST http://localhost:3000/api/stream \ -H "Content-Type: application/json" \ -d '{ "messages": [ { "role": "user", "parts": [ { "type": "text", "text": "What topics are covered in the documentation?" } ] } ], "project": "my-project" }'

Query Specific Project

curl -X POST http://localhost:3000/api/stream \ -H "Content-Type: application/json" \ -d '{ "messages": [ { "role": "user", "parts": [ { "type": "text", "text": "Find API endpoints" } ] } ], "project": "my-project" }'

Conversation with History

curl -X POST http://localhost:3000/api/stream \ -H "Content-Type: application/json" \ -d '{ "messages": [ { "role": "user", "parts": [ { "type": "text", "text": "What is authentication?" } ] }, { "role": "assistant", "parts": [ { "type": "text", "text": "Authentication is..." } ] }, { "role": "user", "parts": [ { "type": "text", "text": "How do I implement it?" } ] } ], "project": "my-project" }'

Project Structure

open-ask-ai-server/ ├── api/ │ ├── health.ts # GET /api/health │ └── stream.ts # POST /api/stream ├── lib/ │ ├── types.ts # TypeScript interfaces │ ├── utils.ts # Error handling utilities │ ├── bash-tool-setup.ts # OverlayFs + createBashTool config │ └── agent.ts # Agent configuration ├── scripts/ │ └── scan-docs.ts # Documentation scanner ├── projects/ │ └── [project-id]/ # Project documentation directories │ └── *.md # Markdown files ├── generated/ │ └── [project-id].json # Generated project files ├── projects.json # Project configuration ├── package.json # Dependencies ├── tsconfig.json # TypeScript config ├── vercel.json # Vercel deployment config └── README.md # Documentation

Agent Capabilities

The agent can execute bash commands to explore documentation:

All commands operate on pre-loaded in-memory files for fast access.

Deployment

Deploy to Vercel

vercel --prod

Development

Type Checking

npx tsc --noEmit

Local Development

vercel dev

Performance

Security

License

MIT