FastAPI service for the Mentee bot.
- Python 3.14
- FastAPI 0.135 + Uvicorn 0.44
- Pydantic 2.13 +
pydantic-settings - Managed with uv
uv sync
cp .env.example .env # tweak if neededuv run uvicorn app.main:app --reload --port 8001The app will be available at http://localhost:8001. Interactive docs at /docs.
uv run ruff check .app/
├── main.py # FastAPI app, CORS, router wiring
├── core/config.py # Settings (pydantic-settings)
├── domain/ # Message, Thread, User, MessageRole
├── agents/
│ ├── base.py # AgentPort abstract interface
│ └── mock/agent.py # MockAgent (deterministic replies, no LLM)
├── services/
│ ├── thread_store.py # In-memory store (swap later for DB)
│ └── message_service.py # Orchestrates user msg → agent → assistant msg
└── api/
├── deps.py # Session + service injection helpers
└── routes/
├── chat.py # POST /api/chat/messages, GET /api/chat/thread
├── auth.py # Stub OAuth: /login, /callback, /me, /logout
└── health.py # GET /health
- Replace
MockAgentwith pydantic-ai / OpenAI / Perplexity — implementAgentPort, swap inapp/api/deps.py. - Replace
ThreadStorewith Postgres / Mongo — keep the same method signatures. - Replace stub auth in
app/api/routes/auth.pywith real MenteeGlobal OAuth — frontend contract stays identical.