How sisig-ai/doctor works
Main Components
• Client / LLM Agent
– The user’s HTTP client or MCP-capable editor (e.g. VSCode) requesting crawl/search.
• API Layer
– Amazon API Gateway or AWS Application Load Balancer fronting the FastAPI service.
• Compute Cluster
– Amazon ECS (Fargate) or EKS cluster hosting two services:
a. Web Service (FastAPI in Docker)
b. Crawl Worker (as a background task processor)
• Message Broker
– Amazon ElastiCache (Redis) for Celery-style task queuing.
• Data Store
– DuckDB file stored on Amazon EFS (volume mounted into the containers)
• External API
– OpenAI Embedding endpoint via public internet.
• Monitoring & Logging
– Amazon CloudWatch Logs & Metrics for container and Redis metrics.
Relationships & Data Flows
a. Client → API Gateway (HTTPS) → ECS-Fargate (Web Service)
• “POST /fetch_url” enqueues a crawl job to Redis.
• “GET /search_docs” queries DuckDB via the Web Service.
b. Web Service → Redis (Enqueue)
c. Crawl Worker (polls Redis) → Crawls target URL → Chunker → Embedder → OpenAI API → Writes embeddings + pages to DuckDB on EFS
d. Web Service → EFS-backed DuckDB (Reads/Writes)
e. Web Service → Client via Server-Sent Events (MCP SSE endpoint)
Architectural Patterns
– Containerized microservices using ECS Fargate (no servers to manage).
– Asynchronous task queue with Redis (managed ElastiCache).
– Serverless-style data store for analytical workloads (DuckDB on EFS or Aurora).
– Third-party integration (OpenAI) abstracted in the embedder component.
– FastAPI as an API gateway inside the container, but fronted by API Gateway / ALB in AWS.