A real-time chat application demonstrating Server-Sent Events (SSE) with an AI agent backend.
Frontend:
- Next.js 14 with TypeScript, React 18, Server-Sent Events for real-time streaming
Backend:
- Python with FastAPI, LangGraph for agent workflows
- Node.js 18+
- Python 3.8+
-
Install frontend dependencies:
npm install
-
Install backend dependencies:
cd backend pip install -r requirements.txt
-
Start the backend server:
cd backend python uvicorn app:app --reload --port 8000 -
Start the frontend (in a new terminal):
npm run dev
-
Open your browser: Navigate to
http://localhost:3000
├── app/ # Next.js app directory
├── backend/ # FastAPI backend
│ ├── app.py # Main FastAPI application
│ ├── graph.py # LangGraph agent definition
│ └── requirements.txt
├── components/ # React components
└── package.json # Frontend dependencies
GET /agent?query=<your-question>- Stream AI agent responses via SSE