brettapps / knowledge /domain_router.md
Brettapps's picture
Upload folder using huggingface_hub
24ba1f5 verified

KB: Domain Router

The Domain Router is the traffic controller of the EbookBuilder ecosystem, responsible for directing requests to the correct agent or service based on the context of the task.

Functions

  • Contextual Routing: Analyzes incoming user prompts to determine if they need a "Creative Writer", an "API Wizard", or a "Technical Editor".
  • Multi-Tenant Support: Maps custom subdomains (e.g., user-1.ebookbuilder.com) to specific Hugging Face Space instances.
  • Load Balancing: Distributes heavy generation tasks across multiple backend model endpoints to maintain responsiveness.

Architecture

  • Layer 7 Routing: Operates at the application level to inspect headers and path parameters.
  • Failover Logic: If a specific model provider is down, the router automatically switches to a fallback (e.g., switching from Vertex AI to Hugging Face Inference Endpoints).