<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Ranajit Dhar</title>
    <description>The latest articles on DEV Community by Ranajit Dhar (@ranajit-dhar-dev).</description>
    <link>https://dev.to/ranajit-dhar-dev</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4102932%2Fba04ea4f-acbd-4f64-a267-436b945f07ed.jpg</url>
      <title>DEV Community: Ranajit Dhar</title>
      <link>https://dev.to/ranajit-dhar-dev</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ranajit-dhar-dev"/>
    <language>en</language>
    <item>
      <title>RDAI: A Multi-Brain Python SDK for Self-Healing AI</title>
      <dc:creator>Ranajit Dhar</dc:creator>
      <pubDate>Mon, 31 Aug 2026 15:01:40 +0000</pubDate>
      <link>https://dev.to/ranajit-dhar-dev/rdai-a-multi-brain-python-sdk-for-self-healing-ai-icl</link>
      <guid>https://dev.to/ranajit-dhar-dev/rdai-a-multi-brain-python-sdk-for-self-healing-ai-icl</guid>
      <description>&lt;h1&gt;
  
  
  RDAI: Building a Self-Healing Multi-Provider AI Orchestrator for Python
&lt;/h1&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;One Python SDK. Any AI Provider. Automatic Failover.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Modern AI applications are increasingly built on APIs from multiple LLM providers.&lt;/p&gt;

&lt;p&gt;Gemini. OpenAI. Groq. Claude. DeepSeek. New models appear constantly, and each provider brings different capabilities, pricing, latency, limits, and failure modes.&lt;/p&gt;

&lt;p&gt;But there is a problem that is easy to overlook:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;What happens when the AI provider your application depends on suddenly stops responding?&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That question became the starting point for &lt;strong&gt;RDAI&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;RDAI is an open-source &lt;strong&gt;Python AI orchestration SDK and CLI&lt;/strong&gt; designed around a simple idea:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;An AI provider failure should not have to become an application failure.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  🚨 The Problem: Your AI Provider Is a Dependency
&lt;/h2&gt;

&lt;p&gt;A typical application starts simply:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Your Application
       |
       v
   One AI Provider
       |
       v
     Response
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then reality happens.&lt;/p&gt;

&lt;p&gt;A provider can hit a rate limit, time out, become temporarily unavailable, reject a request, or experience an outage.&lt;/p&gt;

&lt;p&gt;Suddenly:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Your Application
       |
       v
   One AI Provider
       |
    Provider fails
       |
       v
 Application fails
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The natural response is to add retries and another provider:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;gemini&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;generate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;prompt&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;except&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;openai&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;generate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;prompt&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;except&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;groq&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;generate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;prompt&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That may be enough for a prototype.&lt;/p&gt;

&lt;p&gt;But as the application grows, so does the surrounding infrastructure:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;retry logic&lt;/li&gt;
&lt;li&gt;timeout handling&lt;/li&gt;
&lt;li&gt;provider selection&lt;/li&gt;
&lt;li&gt;API-key discovery&lt;/li&gt;
&lt;li&gt;health checks&lt;/li&gt;
&lt;li&gt;fallback chains&lt;/li&gt;
&lt;li&gt;recovery behavior&lt;/li&gt;
&lt;li&gt;debugging and diagnostics&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I wanted that complexity to live in one reusable layer instead of being rewritten inside every application.&lt;/p&gt;

&lt;p&gt;That layer became &lt;strong&gt;RDAI&lt;/strong&gt;.&lt;/p&gt;




&lt;h1&gt;
  
  
  🧠 From One Brain to Multiple Brains
&lt;/h1&gt;

&lt;p&gt;I like thinking about LLM providers as different &lt;strong&gt;brains&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Each brain can have different strengths and availability.&lt;/p&gt;

&lt;p&gt;Instead of an application being permanently coupled to one provider, RDAI places an orchestration layer in the middle:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;                    YOUR APPLICATION
                           |
                           v
                   +---------------+
                   |     RDAI      |
                   | AI Orchestrator|
                   +-------+-------+
                           |
             +-------------+-------------+
             |             |             |
             v             v             v
          Gemini        OpenAI         Groq
             |             |             |
             +-------------+-------------+
                           |
                      FAILOVER
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Your application talks to RDAI.&lt;/p&gt;

&lt;p&gt;RDAI handles the provider layer.&lt;/p&gt;

&lt;p&gt;That separation is the foundation of the project.&lt;/p&gt;




&lt;h1&gt;
  
  
  ⚡ How RDAI Routes Requests
&lt;/h1&gt;

&lt;p&gt;RDAI provides two routing strategies.&lt;/p&gt;

&lt;h2&gt;
  
  
  Smart Routing
&lt;/h2&gt;

&lt;p&gt;Smart routing can use request traits and provider capabilities to prefer a better-fit available provider.&lt;/p&gt;

&lt;p&gt;Conceptually:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Prompt
  |
  v
Intent / Trait Detection
  |
  v
Provider Matching
  |
  v
Best-Fit Available Brain
  |
 failure?
  v
Next Available Brain
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The current implementation keeps this intentionally lightweight: request signals such as coding-oriented terms or speed-oriented terms can influence provider ordering, while each provider exposes traits that the router can match.&lt;/p&gt;

&lt;p&gt;The goal is not to make routing mysterious.&lt;/p&gt;

&lt;p&gt;The goal is to make the default behavior useful while keeping the architecture extensible.&lt;/p&gt;




&lt;h2&gt;
  
  
  Manual Priority
&lt;/h2&gt;

&lt;p&gt;Sometimes developers already know exactly how their provider chain should work.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;strategy&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;manual&lt;/span&gt;
&lt;span class="na"&gt;providers&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;openai&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;groq&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;gemini&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This gives you a predictable preference order.&lt;/p&gt;

&lt;p&gt;If the preferred provider fails, other available providers remain eligible for fallback.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;OpenAI
   |
   | failure
   v
Groq
   |
   | failure
   v
Gemini
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;No provider-specific fallback code is required in the application.&lt;/p&gt;




&lt;h1&gt;
  
  
  🛡️ Automatic Failover
&lt;/h1&gt;

&lt;p&gt;The most important part of RDAI is not the first response.&lt;/p&gt;

&lt;p&gt;It is what happens &lt;strong&gt;when that response cannot be produced&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The core failover flow is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;                 REQUEST
                    |
                    v
               Provider A
                    |
             +------+------+
             |             |
          SUCCESS        FAILURE
             |             |
             v             v
          RETURN       Provider B
                           |
                    +------+------+
                    |             |
                 SUCCESS        FAILURE
                    |             |
                    v             v
                 RETURN       Provider C
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;RDAI also maintains circuit-breaker state so repeatedly failing providers can temporarily be skipped before being probed again.&lt;/p&gt;

&lt;p&gt;In practical terms:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Route
  ↓
Call provider
  ↓
Failure?
  ├── No → return response
  └── Yes
       ↓
   update failure state
       ↓
   try next eligible brain
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Reliability becomes part of the application architecture instead of an afterthought.&lt;/p&gt;




&lt;h1&gt;
  
  
  🩺 A CLI That Treats AI Infrastructure Like Infrastructure
&lt;/h1&gt;

&lt;p&gt;I did not want RDAI to be just another Python wrapper.&lt;/p&gt;

&lt;p&gt;The project also includes a CLI for setup, diagnostics, configuration, and benchmarking.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;rdai init&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;Start with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip &lt;span class="nb"&gt;install &lt;/span&gt;rdai
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;rdai init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The interactive wizard lets developers choose providers and a routing strategy, then creates the local configuration files.&lt;/p&gt;

&lt;p&gt;The intended workflow is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Install
  ↓
Configure
  ↓
Verify
  ↓
Generate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  &lt;code&gt;rdai doctor&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;Before shipping, you need to know which brains are actually reachable.&lt;/p&gt;

&lt;p&gt;Run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;rdai doctor
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The diagnostic flow checks configured provider credentials and performs live checks, reporting status and measured latency.&lt;/p&gt;

&lt;p&gt;Conceptually:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Provider      Key Status       Live Check      Latency
------------------------------------------------------
Gemini        ✔ DETECTED       🟢 ALIVE         420ms
Groq          ✔ DETECTED       🟢 ALIVE         180ms
OpenAI        ✔ DETECTED       🔴 ERROR            -
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That turns a vague question like:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Why isn't my AI application working?"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;into a much more actionable question:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Which provider is failing, and is it authentication, connectivity, rate limiting, timeout, or another provider-side error?"&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h1&gt;
  
  
  🔐 Configuration Without Hardcoding Secrets
&lt;/h1&gt;

&lt;p&gt;RDAI separates routing configuration from credentials.&lt;/p&gt;

&lt;p&gt;Provider credentials can be discovered from the process environment or a local &lt;code&gt;.env&lt;/code&gt; file, while routing policy can live in &lt;code&gt;rdai.yaml&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;GEMINI_API_KEY=your_key_here
GROQ_API_KEY=your_key_here
OPENAI_API_KEY=your_key_here
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;strategy&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;smart&lt;/span&gt;
&lt;span class="na"&gt;providers&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;gemini&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;openai&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;groq&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Environment values take precedence over &lt;code&gt;.env&lt;/code&gt; values.&lt;/p&gt;

&lt;p&gt;The result is a cleaner separation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Secrets
  ↓
Environment / .env

Routing Policy
  ↓
rdai.yaml

Application Logic
  ↓
RDAI SDK
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  💻 One Python API Across Multiple Providers
&lt;/h1&gt;

&lt;p&gt;Without an orchestration layer, applications often end up learning several provider SDKs.&lt;/p&gt;

&lt;p&gt;With RDAI, application code can stay focused on the task:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;rdai&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;AI&lt;/span&gt;

&lt;span class="n"&gt;ai&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;AI&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;ai&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;generate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Explain dependency inversion in simple words.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The public API stays small while provider-specific adapters live underneath it.&lt;/p&gt;




&lt;h1&gt;
  
  
  🎯 Overriding Default Models
&lt;/h1&gt;

&lt;p&gt;Different applications may prefer different models.&lt;/p&gt;

&lt;p&gt;RDAI supports model overrides without changing the overall orchestration API:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;rdai&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;AI&lt;/span&gt;

&lt;span class="n"&gt;ai&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;AI&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;gemini&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;gemini-1.5-flash&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;groq&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;llama3-8b-8192&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;ai&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;generate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Hello world!&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The architecture keeps provider selection separate from the application-facing API.&lt;/p&gt;




&lt;h1&gt;
  
  
  🔌 Bring Your Own Model
&lt;/h1&gt;

&lt;p&gt;The AI ecosystem moves quickly.&lt;/p&gt;

&lt;p&gt;A useful orchestration layer should not have to know every provider that will ever exist.&lt;/p&gt;

&lt;p&gt;That is why RDAI exposes a &lt;code&gt;BaseProvider&lt;/code&gt; abstraction for custom adapters.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;rdai.providers.base&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;BaseProvider&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;rdai&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;AI&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;CustomProvider&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;BaseProvider&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;generate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;prompt&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;**&lt;/span&gt;&lt;span class="n"&gt;kwargs&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Private model response&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;

&lt;span class="n"&gt;ai&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;AI&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;providers&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nc"&gt;CustomProvider&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;api_key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;your_key&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)]&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ai&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;generate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Hello custom engine!&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This opens the door to private endpoints, internal models, and future providers without changing the application-level API.&lt;/p&gt;




&lt;h1&gt;
  
  
  🏗️ The Architecture
&lt;/h1&gt;

&lt;p&gt;At a high level, RDAI separates responsibilities into distinct layers:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;             Environment
            (.env / vars)
                  |
                  v
         Credential Discovery
                  |
                  v
          Provider Registry
                  |
                  v
        Smart / Manual Router
                  |
                  v
            Failover Engine
                  |
                  v
         Provider Adapters
                  |
                  v
              Response
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That separation matters.&lt;/p&gt;

&lt;p&gt;The application should not need to know how Gemini, OpenAI, Groq, Claude, or a custom provider implements its API.&lt;/p&gt;

&lt;p&gt;The adapter handles that boundary.&lt;/p&gt;

&lt;p&gt;The router decides what to try.&lt;/p&gt;

&lt;p&gt;The failover layer decides what happens when a provider fails.&lt;/p&gt;




&lt;h1&gt;
  
  
  🌍 Why This Matters for AI Applications
&lt;/h1&gt;

&lt;p&gt;There is a larger architectural shift happening in AI development.&lt;/p&gt;

&lt;p&gt;We are moving from:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;One Application
      |
One Model
      |
One Provider
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;toward:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;One Application
      |
Orchestration Layer
      |
Multiple Models
      |
Multiple Providers
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That does not mean every application needs ten providers.&lt;/p&gt;

&lt;p&gt;It means the application can be designed so that &lt;strong&gt;provider choice is not an irreversible architectural decision&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;That is the space RDAI is designed to explore.&lt;/p&gt;




&lt;h1&gt;
  
  
  🧪 Building RDAI: From Prototype to Hardened Release
&lt;/h1&gt;

&lt;p&gt;The first versions focused on proving the core idea:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;multi-provider adapters&lt;/li&gt;
&lt;li&gt;routing&lt;/li&gt;
&lt;li&gt;automatic failover&lt;/li&gt;
&lt;li&gt;configuration discovery&lt;/li&gt;
&lt;li&gt;an interactive CLI&lt;/li&gt;
&lt;li&gt;diagnostics&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Then real testing exposed places where the implementation needed to become stronger.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;1.0.2&lt;/code&gt; release focused on hardening the foundation: unifying the routing/failover architecture, resolving a missing runtime dependency, adding explicit REST-provider timeouts, and improving diagnostic error classification.&lt;/p&gt;

&lt;p&gt;That process reinforced an important lesson:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Resilience is defined by the failure path, not just the happy path.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;A demo can prove that an AI response works.&lt;/p&gt;

&lt;p&gt;A real developer tool must also explain what happens when it doesn't.&lt;/p&gt;




&lt;h1&gt;
  
  
  🧭 RDAI vs. Building the Fallback Layer Yourself
&lt;/h1&gt;

&lt;p&gt;There are two broad approaches.&lt;/p&gt;

&lt;h2&gt;
  
  
  Build it inside every application
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Application
  |
  +-- Provider A logic
  +-- Provider B logic
  +-- Retry logic
  +-- Timeout logic
  +-- Health checks
  +-- Fallback logic
  +-- Diagnostics
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This can work, but the infrastructure becomes part of every application.&lt;/p&gt;

&lt;h2&gt;
  
  
  Put the orchestration behind an SDK
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Application
     |
     v
   RDAI
     |
     +-- Routing
     +-- Failover
     +-- Provider adapters
     +-- Diagnostics
     +-- CLI
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The application stays smaller, while the resilience layer can evolve independently.&lt;/p&gt;

&lt;p&gt;That is the problem RDAI is trying to solve.&lt;/p&gt;




&lt;h1&gt;
  
  
  ✨ The Developer Experience Matters
&lt;/h1&gt;

&lt;p&gt;A technically capable system can still be frustrating to use.&lt;/p&gt;

&lt;p&gt;I wanted the RDAI workflow to feel simple:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip &lt;span class="nb"&gt;install &lt;/span&gt;rdai
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;then:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;rdai init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;then:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;rdai doctor
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;then:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;rdai&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;AI&lt;/span&gt;

&lt;span class="n"&gt;ai&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;AI&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;ai&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;generate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Build a resilient AI workflow.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The goal is not to make developers think about orchestration every time they make an AI call.&lt;/p&gt;

&lt;p&gt;The goal is to make the resilient path the easy path.&lt;/p&gt;




&lt;h1&gt;
  
  
  🔭 What's Next?
&lt;/h1&gt;

&lt;p&gt;The next direction for RDAI is moving from &lt;strong&gt;resilience&lt;/strong&gt; toward &lt;strong&gt;visibility&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The roadmap includes live streaming-oriented features such as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Live Streaming
      |
      +-- Brain Activity
      +-- Frontend Events
      +-- Provider Timeline
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Imagine seeing a request move through the system:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;🧠 Gemini
   |
   | Timeout
   v
⚡ Failover
   |
   v
🧠 Groq
   |
   v
✅ Streaming Response
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The long-term idea is simple:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Don't just make AI resilient. Make the resilience visible.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h1&gt;
  
  
  📈 Why I Think the Problem Is Bigger Than One Package
&lt;/h1&gt;

&lt;p&gt;AI providers are moving fast.&lt;/p&gt;

&lt;p&gt;New models appear.&lt;br&gt;
Old models are deprecated.&lt;br&gt;
Pricing changes.&lt;br&gt;
Rate limits change.&lt;br&gt;
Capabilities change.&lt;/p&gt;

&lt;p&gt;Application architecture should not have to change every time the underlying provider changes.&lt;/p&gt;

&lt;p&gt;An orchestration layer can provide a stable interface while the infrastructure underneath evolves.&lt;/p&gt;

&lt;p&gt;That is the long-term direction behind RDAI.&lt;/p&gt;


&lt;h1&gt;
  
  
  👨‍💻 Who Is RDAI For?
&lt;/h1&gt;

&lt;p&gt;RDAI is particularly interesting for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Python developers&lt;/strong&gt; building LLM applications&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AI engineers&lt;/strong&gt; working with multiple providers&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Startups&lt;/strong&gt; that need a resilient AI integration without building the routing layer from scratch&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Developers&lt;/strong&gt; who want provider health and latency visibility from the CLI&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Teams&lt;/strong&gt; experimenting with custom or private models&lt;/li&gt;
&lt;/ul&gt;


&lt;h1&gt;
  
  
  🚀 Get Started
&lt;/h1&gt;

&lt;p&gt;Install RDAI:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip &lt;span class="nb"&gt;install &lt;/span&gt;rdai
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Initialize your setup:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;rdai init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Check your providers:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;rdai doctor
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then use the SDK:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;rdai&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;AI&lt;/span&gt;

&lt;span class="n"&gt;ai&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;AI&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;ai&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;generate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;What happens when my primary AI provider goes down?&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  🌱 Open Source, Built in Public
&lt;/h1&gt;

&lt;p&gt;One of the most useful parts of building RDAI has been seeing how an open-source project changes once other developers start using it.&lt;/p&gt;

&lt;p&gt;A bug report becomes a fix.&lt;/p&gt;

&lt;p&gt;A feature request becomes a design discussion.&lt;/p&gt;

&lt;p&gt;A contribution becomes part of the roadmap.&lt;/p&gt;

&lt;p&gt;That feedback loop is a core part of where I want RDAI to go.&lt;/p&gt;

&lt;p&gt;The project is open source, and issues, ideas, and contributions are welcome.&lt;/p&gt;




&lt;h1&gt;
  
  
  Final Thought
&lt;/h1&gt;

&lt;p&gt;RDAI started with a simple question:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;What if your AI application had more than one brain?&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The answer is not to pretend that providers never fail.&lt;/p&gt;

&lt;p&gt;The answer is to build an architecture that can &lt;strong&gt;route, recover, diagnose, and evolve&lt;/strong&gt; when they do.&lt;/p&gt;

&lt;p&gt;That is what RDAI is trying to become:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;A developer-first orchestration layer for resilient, multi-provider AI applications.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  🔗 Explore RDAI
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;GitHub:&lt;/strong&gt; &lt;a href="https://github.com/ranajitdharpersonal/rdai" rel="noopener noreferrer"&gt;https://github.com/ranajitdharpersonal/rdai&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;PyPI:&lt;/strong&gt; &lt;a href="https://pypi.org/project/rdai/" rel="noopener noreferrer"&gt;https://pypi.org/project/rdai/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Website:&lt;/strong&gt; &lt;a href="https://www.ranajitdhar.in" rel="noopener noreferrer"&gt;https://www.ranajitdhar.in&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;⭐ Built something with RDAI? I'd genuinely love to see it. Open an issue, share feedback, or contribute a new idea.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Built with ❤️ by Ranajit Dhar for the next generation of AI developers.&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>ai</category>
      <category>opensource</category>
      <category>llm</category>
    </item>
  </channel>
</rss>
