Problem & hardware constraints
An aggregation API gateway designed to host and isolate independent Python micro-services inside a single container environment on Hugging Face Spaces, featuring pre-warmed models and dynamic request routing.
System architecture & pipeline
The runtime is structured into decoupled execution layers to avoid latency jitter and unpredictable heap fragmentation:
Intercepts incoming requests, routes them to specific sub-modules, and handles graceful wake-up signals.
Uses uv for sub-second virtualenv resolution and module sandboxing inside the container.
Pre-warms PyTorch weights into shared memory during container startup, preventing cold-hit spikes on first user queries.
Engineering trade-offs & alternatives rejected
Single container orchestration over multi-container cluster
Given free-tier host limits, running multiple Docker containers was impossible. Building an internal in-process router saved 400MB of overhead.
Field notes & edge cases
- 01The hardest part was not the routing logic. It was stopping two sub-packages from importing conflicting versions of transformers in the same Python process.
— / deploy
Explore source & live runtime
Source code, static headers, and benchmarks are open for review on GitHub.

