
Production reference architecture for multi-tenant RAG with tool-using agents. FastAPI · Postgres RLS · Kafka workers · Anthropic · OpenAI · pgvector.
chat:create, documents:read/create/search/delete, API keys.set_config('app.current_org', ...) on every session; bypass GUC for service-internal paths.POST /v1/documents/search over pgvector HNSW with cosine similarity.search_documents and get_document tools, bounded iteration loop, citations carried back to the caller. ReAct pattern implemented directly against the Anthropic SDK (see docs/adr/0008-no-langgraph.md).POST /v1/chat (synchronous JSON) and POST /v1/chat/stream (SSE: token, tool_use, tool_result, citations, done, error).uv, and an Anthropic + OpenAI API key.POST /v1/auth/login — Email + password → JWT access/refresh tokens POST /v1/documents JWT Multipart upload, queues async ingestion GET /v1/documents/{id} JWT Fetch document metadata + status POST /v1/documents/search JWT Semantic search over the org's chunks POST /v1/chat JWT One-shot tool-using agent turn (JSON) POST /v1/chat/stream JWT Same agent, SSE-streamed events GET /healthz / GET /readyz — Liveness and readiness probesGET /openapi.json when the server is running.docs/adr/:.v1 suffix)/v1/chat/stream)Posted Oct 21, 2026
Architected a multi-tenant AI platform with RAG, intelligent agents, secure document retrieval and scalable workflows using Python, FastAPI and PostgreSQL.
0
0