<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Samik Bandyopadhyay on Medium]]></title>
        <description><![CDATA[Stories by Samik Bandyopadhyay on Medium]]></description>
        <link>https://medium.com/@callsamik?source=rss-495d496617d6------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*O2SbrZWsVzWola68.</url>
            <title>Stories by Samik Bandyopadhyay on Medium</title>
            <link>https://medium.com/@callsamik?source=rss-495d496617d6------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 07:31:31 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@callsamik/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Intent Upstream, Execution Downstream: Hermes + OmniRoute + HermesVault]]></title>
            <link>https://medium.com/@callsamik/intent-upstream-execution-downstream-hermes-omniroute-hermesvault-7d4f94472174?source=rss-495d496617d6------2</link>
            <guid isPermaLink="false">https://medium.com/p/7d4f94472174</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[developer-tools]]></category>
            <dc:creator><![CDATA[Samik Bandyopadhyay]]></dc:creator>
            <pubDate>Sun, 30 Aug 2026 05:24:10 GMT</pubDate>
            <atom:updated>2026-08-30T05:25:12.427Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vi4Bae5ChREGickTyxandg.png" /></figure><h3>How I separated agent workflow from model routing — and kept multi-client project memory honest — without treating every IDE as a wiki editor.</h3><p>If you run a personal AI agent alongside Cursor, Claude Code, and Codex, you hit two failures at once.</p><p><strong>Failure one:</strong> your chief-of-staff agent and your local model gateway both think they pick the model. Config sprawl. Mystery routing. Every skill file becomes a second place to encode auto/best-chat vs auto/cheap.</p><p><strong>Failure two:</strong> every tool can read your project folder, but none of them share a durable project brain. Chat residue is not a board. A shared Obsidian folder with five writers is last-writer-wins chaos.</p><p>I did not fix this by choosing one vendor. I fixed it by drawing two hard lines — and validating both on a live stack:</p><blockquote><strong><em>Hermes expresses intent. OmniRoute decides execution. HermesVault curates truth.</em></strong></blockquote><p>The full HermesVault design (multi-agent memory, outbox protocol, remote-from-Telegram model) is here:<br><a href="https://gist.github.com/callsamik/95d61ead30e1346dbaab7dceb95fd6b6">HermesVault Multi-Agent Knowledge Framework</a></p><p>This article is about the <strong>Hermes + OmniRoute integration</strong> I forked, what each side changed, why it is cheaper and cleaner than the default setup, and how you can run the same forks yourself.</p><h3>The problem is not “pick one AI tool”</h3><p>The problem is <strong>mixed responsibilities</strong>.</p><ul><li><strong>Hermes</strong> — sent OmniRoute aliases (auto/best-chat, auto/best-free) and acted like a router</li><li><strong>OmniRoute</strong> — guessed intent from opaque tokens; stock build ignored structured workload envelopes</li><li><strong>Every agent</strong> — could see the vault on disk and treat chat or skills as project truth</li></ul><p>Multi-agent work fails when routing policy and knowledge authority are ambiguous. You pay twice: once in tokens (duplicate cognition), once in coordination tax (scavenger hunts for “what’s done?”).</p><p>What I wanted:</p><ul><li>One local gateway that <strong>owns model and provider selection</strong></li><li>One personal agent that <strong>owns workflow, delegation, and memory curation</strong></li><li>One protocol so Cursor tomorrow and Codex tonight orient from the <strong>same BOARD</strong></li></ul><h3>What I changed — OmniRoute fork</h3><p><strong>Fork:</strong> <a href="https://github.com/callsamik/OmniRoute">github.com/callsamik/OmniRoute</a> · branch <strong>hermes-workload-policy-v0</strong> (from upstream 3.8.49)</p><p>OmniRoute already solves a practical problem: one OpenAI-compatible endpoint (http://127.0.0.1:20128/v1) in front of <strong>200+ providers</strong>, with automatic fallback when a free tier rate-limits. That is the cost engine. My fork adds the <strong>policy layer</strong> so agents stop speaking routing mechanics.</p><h3>Gateway-side changes</h3><ol><li><strong>Workload envelope parser</strong> — reads extra_body.omniroute (or top-level omniroute) on every chat completion request.</li><li><strong>Profile map</strong> — maps eight Hermes-visible profiles to OmniRoute’s internal auto-combo channels (map-only in v0; no new scoring weights).</li><li><strong>Fail-closed enforcement</strong> — unknown profile → <strong>HTTP 400</strong>; unsatisfiable constraints → reject, not silent downgrade.</li><li><strong>Envelope stripping</strong> — routing metadata does not leak downstream to providers.</li></ol><h3>What OmniRoute now owns (exclusively)</h3><ul><li>Model selection</li><li>Provider selection</li><li>Provider/model fallback when a tier is exhausted</li><li>Constraint filtering (max_cost, provider_exclusions, etc.)</li></ul><h3>What OmniRoute expects on the wire</h3><pre>model: auto                    # constant — never auto/coding, never vendor IDs<br>omniroute:<br>  profile: coding              # general | coding | hard_reasoning | review | …<br>  constraints: { … }           # optional; fail-closed<br>  objective: { quality, speed } # on the wire in v0; ranking weights unlocked later</pre><p>Stock npm OmniRoute <strong>ignores</strong> this envelope. The fork <strong>enforces</strong> it. That difference is now live on my :20128 listener.</p><h3>What I changed — Hermes fork</h3><p><strong>Fork:</strong> <a href="https://github.com/callsamik/hermes-agent">github.com/callsamik/hermes-agent</a> · branch <strong>omniroute-model-picker</strong></p><p>Hermes is the personal agent layer: Telegram, cron, skills, thin orchestration, delegation to Claude Code and Codex. It should coordinate — not compete with coding agents on reasoning, and not compete with OmniRoute on routing.</p><h3>Agent-side changes</h3><ol><li><strong>OmniRoute provider plugin</strong> — always emits model: auto + workload envelope in Auto mode; never puts vendor IDs or auto/* aliases on the wire.</li><li><strong>Model picker (TUI, Web, Telegram)</strong> — user-visible tree:</li></ol><ul><li><strong>Auto →</strong> eight profiles (General, Coding, Cheap, Review, …)</li><li><strong>Models →</strong> explicit catalog overrides (power users; <strong>no envelope</strong>; contract bypass by design)</li></ul><p><strong>3. Config contract</strong> — default model: auto; transport survival fallback to <strong>local Ollama only</strong> when the gateway is unreachable (not cost arbitrage).</p><p><strong>4. Contract tests</strong> — <strong>32/32</strong> acceptance tests; TUI/Web picker tests green; live turns verified.</p><p>Display reads like: OmniRoute · Auto · Coding — intent visible to the human, routing opaque to the agent config.</p><h3>What Hermes must NOT send anymore</h3><ul><li>Vendor model IDs as a routing choice in Auto mode</li><li>auto/best-chat, auto/cheap, brand aliases</li><li>Fallback chains or X-OmniRoute-Mode side channels</li><li>Profile switching to dodge cost or rate limits</li></ul><p>Hermes may <strong>retry the identical envelope</strong>. It may <strong>not</strong> change workload intent as a fallback strategy.</p><h3>HermesVault — the third layer (unchanged thesis, same repo)</h3><p>Routing fixes cost and clarity. It does not fix <strong>fragmented project memory</strong>.</p><p>HermesVault is the knowledge plane: Obsidian-compatible wiki, schema-v1 <strong>outbox packets</strong>, idempotent ingest, curated <strong>BOARD</strong>.</p><pre>CONTROL   →  Hermes routing / skills / Telegram<br>WORK      →  project repo + .hermes-outbox/<br>KNOWLEDGE →  Hermes ingest → BOARD + project KB</pre><p>Two invariants:</p><ol><li><strong>packet ≠ knowledge</strong> — agents propose; Hermes commits.</li><li><strong>Skills ≠ project KB</strong> — chat memory and skills are not the source of project truth.</li></ol><blockquote><em>Filesystem visibility does not equal knowledge authority.</em></blockquote><p>Agents read BOARD, write code, emit packets. <strong>Hermes only</strong> ingests into the vault. That is how Cursor at the desk and Claude Code from Telegram stop inventing three versions of “done.”</p><h3>Why this is superior to the default setup</h3><h3>1. Clean separation of concerns</h3><ul><li><strong>Hermes</strong> — workflow, delegation, ops, memory curation</li><li><strong>OmniRoute</strong> — model intelligence, provider fallback, cost routing</li><li><strong>HermesVault</strong> — durable project truth with provenance</li><li><strong>Cursor / Claude Code / Codex</strong> — code execution surfaces</li></ul><p>One question, one owner: <em>who picks the model?</em> OmniRoute. <em>who commits project truth?</em> Hermes.</p><h3>2. Policy changes without redeploying agents</h3><p>Rename an OmniRoute alias, add a provider, tune fallback — gateway config only. Hermes skills and agent boot files stay stable because they send <strong>profile: cheap</strong>, not a vendor string that goes stale next week.</p><h3>3. Fail-closed beats mystery completions</h3><p>Unknown profile → <strong>400</strong>. You get a typed rejection, not a silent hop to a random free model that hallucinates confidently on the wrong tier.</p><h3>4. Multi-client continuity</h3><p>The outbox protocol means the <strong>next</strong> agent starts from curated BOARD state — not from whichever chat window you left open.</p><h3>5. Thin Hermes, thick specialists</h3><p>Hermes does not re-implement Claude Code’s reasoning loop. That avoids duplicate token burn: the agent that codes should code; the agent that routes surfaces should route.</p><h3>Why this is cost-effective</h3><p>This stack is built for <strong>local gateway + free-tier arbitrage</strong>, not for sending every cron job to a flagship API.</p><ul><li><strong>OmniRoute in front of all Hermes model calls</strong> — one place to fan out across 200+ providers; automatic fallback when a free tier throttles</li><li><strong>cheap profile</strong> — explicit workload intent for low-stakes tasks without hand-picking a free model name</li><li><strong>Gateway-owned fallback</strong> — when provider A rate-limits, OmniRoute tries B; you do not restart agents or edit configs</li><li><strong>No routing tokens in every skill</strong> — less config drift; fewer accidental “best-chat” calls for triage that should be cheap</li><li><strong>Ollama transport survival only</strong> — local inference when :20128 is down; not a second routing policy</li><li><strong>Hermes cron pinned explicitly</strong> — morning digest jobs do not inherit chat’s “Hard reasoning” picker by accident</li></ul><p>OmniRoute’s value proposition (popularized in several “free AI stack” walkthroughs) is sitting <strong>in the middle</strong> so agents burn gateway-routed tokens — including large free-tier pools — instead of a single paid API for everything. This fork makes that middle layer <strong>policy-aware</strong>: Hermes says <em>what kind of work</em>; OmniRoute decides <em>which provider executes it</em>.</p><p>Honest caveat: free tiers change, rate limits are real, and “cheap” does not mean “zero cost” if you route heavy jobs poorly. The win is <strong>centralized, auditable routing</strong> — not a magic unlimited token fountain.</p><h3>Validated — but not official, not GA</h3><p>Three things readers confuse:</p><pre>Validated implementation<br>        ≠<br>Upstream contribution<br>        ≠<br>GA product</pre><p><strong>What is true on my stack today:</strong></p><ul><li><strong>Hermes picker + envelope emitter</strong> — complete</li><li><strong>Hermes acceptance tests</strong> — <strong>32/32</strong> pass</li><li><strong>TUI / Web / Telegram live turns</strong> — green</li><li><strong>Policy branch on </strong><strong>:20128</strong> — serving hermes-workload-policy-v0</li><li><strong>Unknown profile</strong> — <strong>400</strong></li><li><strong>coding + </strong><strong>model=auto envelope</strong> — <strong>200</strong></li><li><strong>Vault recall smoke</strong> — passes</li><li><strong>Fork branches pushed</strong> — yes</li><li><strong>Upstream merge / PR</strong> — not yet</li></ul><p>This is <strong>validated end-to-end in my local environment</strong>. It is <strong>not</strong> an official Hermes or OmniRoute release. Do not treat it as upstream-supported until it is.</p><h3>How to use the forks</h3><h3>Prerequisites</h3><ul><li>Node.js (for OmniRoute build)</li><li>Python 3.11+ (for Hermes)</li><li>A running OmniRoute data dir (typically ~/.omniroute with your provider keys)</li><li>Optional: HermesVault for project memory (<a href="https://gist.github.com/callsamik/95d61ead30e1346dbaab7dceb95fd6b6">framework gist</a>)</li></ul><h3>1. OmniRoute (gateway)</h3><pre>git clone https://github.com/callsamik/OmniRoute.git<br>cd OmniRoute<br>git checkout hermes-workload-policy-v0<br>npm install<br>npm run build   # produces dist/server.js + bin/omniroute.mjs</pre><pre># Serve — keep WorkingDirectory on your existing data dir, NOT the git clone<br>OMNIROUTE_DATA=~/.omniroute node bin/omniroute.mjs serve --port 20128</pre><p><strong>Smoke test:</strong></p><pre># Unknown profile → expect 400<br>curl -s -o /dev/null -w &quot;%{http_code}&quot; http://127.0.0.1:20128/v1/chat/completions \<br>  -H &quot;Authorization: Bearer $OMNIROUTE_API_KEY&quot; \<br>  -H &quot;Content-Type: application/json&quot; \<br>  -d &#39;{&quot;model&quot;:&quot;auto&quot;,&quot;messages&quot;:[{&quot;role&quot;:&quot;user&quot;,&quot;content&quot;:&quot;hi&quot;}],&quot;omniroute&quot;:{&quot;profile&quot;:&quot;not_a_real_profile&quot;}}&#39;</pre><pre># Valid envelope → expect 200<br>curl -s -o /dev/null -w &quot;%{http_code}&quot; <a href="http://127.0.0.1:20128/v1/chat/completions">http://127.0.0.1:20128/v1/chat/completions</a> \<br>  -H &quot;Authorization: Bearer $OMNIROUTE_API_KEY&quot; \<br>  -H &quot;Content-Type: application/json&quot; \<br>  -d &#39;{&quot;model&quot;:&quot;auto&quot;,&quot;messages&quot;:[{&quot;role&quot;:&quot;user&quot;,&quot;content&quot;:&quot;hi&quot;}],&quot;omniroute&quot;:{&quot;profile&quot;:&quot;coding&quot;}}&#39;</pre><p>For production-like always-on use, supervise with launchd/systemd and point at the <strong>built branch binary</strong>, not an accidental npm overwrite of your data dir.</p><p>Upstream reference (without workload policy): <a href="https://github.com/diegosouzapw/OmniRoute">github.com/diegosouzapw/OmniRoute</a></p><h3>2. Hermes (agent + picker)</h3><pre>git clone https://github.com/callsamik/hermes-agent.git<br>cd hermes-agent<br>git checkout omniroute-model-picker<br># follow upstream Hermes install docs for your platform<br>pytest tests/providers/test_omniroute_envelope.py tests/acceptance/  # contract + acceptance</pre><p>Point your Hermes profile at the gateway:</p><pre># ~/.hermes/profiles/&lt;your-profile&gt;/config.yaml (conceptual)<br>model:<br>  provider: omniroute<br>  default: auto<br>  base_url: http://127.0.0.1:20128/v1</pre><p>Install the OmniRoute provider plugin from the fork (user plugins override bundled). Select <strong>OmniRoute → Auto → Coding</strong> in TUI/Web/Telegram for normal work; use <strong>Models → explicit id</strong> only when you intentionally bypass the envelope.</p><p><strong>Transport survival:</strong> configure local Ollama as the only Hermes-side fallback when :20128 is unreachable — not as a cost-optimization lever.</p><h3>3. HermesVault (optional but recommended for multi-client memory)</h3><pre>git clone &lt;your-vault-repo&gt; ~/Projects/HermesVault<br>/path/to/HermesVault/scripts/link_project_to_vault.sh /path/to/your/project MyProject<br># … agents work …<br>python3 /path/to/HermesVault/scripts/ingest_project_outbox.py /path/to/your/project</pre><p>Linking creates .hermes-vault.json, .hermes-outbox/, agent boot stubs, and an empty BOARD. Agents emit packets; Hermes ingests. See the <a href="https://gist.github.com/callsamik/95d61ead30e1346dbaab7dceb95fd6b6">framework gist</a> for the locked protocol.</p><h3>4. End-to-end stack (mental model)</h3><pre>Phone / Telegram<br>    → Hermes (intent: profile + delegation)<br>        → OmniRoute :20128 (execution: model + provider)<br>        → Claude Code / Codex in project repo<br>        → outbox packet<br>        → Hermes ingest → BOARD<br>    → reply on Telegram</pre><h3>Honest limits</h3><ul><li><strong>Primary host must be awake</strong> for 24/7 Telegram delegation</li><li><strong>Free tiers rate-limit</strong> — fallback helps, but heavy hard_reasoning on free routes will still hurt</li><li><strong>Explicit model overrides bypass the contract</strong> — power feature, not the default path</li><li><strong>Cursor UI is not driven by Hermes</strong> — remote coding goes through CLI agents</li><li><strong>Team multi-user vault</strong> is design-only; single-user multi-client is what is proven</li><li><strong>Not upstream yet</strong> — you are running integration branches, not vendor-supported releases</li></ul><p>The win is not “replace every IDE.” The win is <strong>one routing brain, one memory curator, many agent surfaces</strong> — with costs centralized and project truth durable.</p><h3>What’s next</h3><ul><li>Upstream PR polish for the workload envelope (if the contract generalises beyond Hermes)</li><li>Phase 2: prove outbox protocol holds under sustained Claude Code / Codex delegation</li><li>Phase 3: LAN mount — others machines to reads BOARD; ingest stays on primary host (for multi device development)</li><li>Team vault roadmap (T0–T3) after single-user loops are boringly stable</li></ul><h3>The boundary that matters</h3><p>If you take one idea from this integration, take this:</p><blockquote><strong><em>Hermes expresses intent. OmniRoute decides execution. HermesVault curates truth.</em></strong></blockquote><p>That is how you run a cost-aware local gateway, a always-on chief-of-staff agent, and four coding surfaces — without every tool picking its own model and inventing its own project history.</p><h3>Links</h3><ul><li><strong>OmniRoute fork (policy branch)</strong> — <a href="https://github.com/callsamik/OmniRoute/tree/hermes-workload-policy-v0">https://github.com/callsamik/OmniRoute/tree/hermes-workload-policy-v0</a></li><li><strong>Hermes fork (model picker)</strong> — <a href="https://github.com/callsamik/hermes-agent/tree/omniroute-model-picker">https://github.com/callsamik/hermes-agent/tree/omniroute-model-picker</a></li><li><strong>OmniRoute upstream</strong> — <a href="https://github.com/diegosouzapw/OmniRoute">https://github.com/diegosouzapw/OmniRoute</a></li><li><strong>HermesVault framework gist</strong> — <a href="https://gist.github.com/callsamik/95d61ead30e1346dbaab7dceb95fd6b6">https://gist.github.com/callsamik/95d61ead30e1346dbaab7dceb95fd6b6</a></li><li><strong>Karpathy LLM wiki pattern</strong> — <a href="https://gist.github.com/karpathy/442a6bf555914893e9891c11519de94f">https://gist.github.com/karpathy/442a6bf555914893e9891c11519de94f</a></li></ul><p>If you run OmniRoute + a personal agent today, I’d like to hear what you’d prioritize: upstream merge of the envelope, stronger cheap-profile defaults, or HermesVault-style memory for your own multi-client setup.</p><p><em>Samik Bandyopadhyay — building practical agent systems with clear ownership boundaries.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7d4f94472174" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HermesVault: A Multi-Agent Knowledge Framework for Real Project Work]]></title>
            <link>https://medium.com/@callsamik/hermesvault-a-multi-agent-knowledge-framework-for-real-project-work-77792e54323e?source=rss-495d496617d6------2</link>
            <guid isPermaLink="false">https://medium.com/p/77792e54323e</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[systems-thinking]]></category>
            <category><![CDATA[productivity]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Samik Bandyopadhyay]]></dc:creator>
            <pubDate>Sat, 29 Aug 2026 15:33:08 GMT</pubDate>
            <atom:updated>2026-08-29T15:35:42.462Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Hk_ortljOrGIHoaRTevGbQ.png" /></figure><h3>How to keep Cursor, Claude Code, Codex, and Hermes aligned — including when you work from Telegram — without letting every agent invent its own project truth.</h3><p>If you use more than one AI coding tool in a week, you already know the failure mode.</p><p>You sketch architecture in Claude. You implement in Cursor. You ask Codex for a refactor. You ping Hermes from your phone. Each surface is competent. None of them reliably know what the others decided.</p><p>“What’s done?” becomes a scavenger hunt across chats. By Friday the project has several conflicting histories — and no single place that answers: <em>what is true right now?</em></p><p>I built <strong>HermesVault</strong> to fix that. Not by picking a single vendor agent. Not by dumping everything into an ever-growing memory file. Not by letting every IDE rewrite the same wiki.</p><p>The idea is simple: <strong>many agents, one curator.</strong></p><p>The full design write-up is here:<br><a href="https://gist.github.com/callsamik/95d61ead30e1346dbaab7dceb95fd6b6">HermesVault Multi-Agent Knowledge Framework</a></p><p>This article summarizes the locked architecture, why control must stay separate from knowledge, and how the same protocol supports working from remote.</p><h3>The problem is not “more AI”</h3><p>The problem is <strong>fragmented project memory</strong>.</p><p>Multi-agent work fails in predictable ways:</p><ul><li>Providers and products do not share context by default</li><li>Chat residue is not a project board</li><li>Research findings and coding outcomes never land in one durable place</li><li>Home and office machines drift unless there is one knowledge authority</li><li>Naively sharing an Obsidian folder with every agent recreates the original mess: many writers, weak provenance, conflicting “truth”</li></ul><p>What we needed was a thin protocol with a hard ownership boundary:</p><blockquote><em>Agents may read project knowledge and write project code.<br>Durable knowledge is committed only through a curator.</em></blockquote><p>In HermesVault, that curator is <strong>Hermes</strong>.</p><h3>Three planes, one invariant</h3><p>The framework separates work into three planes:</p><p><strong>Control plane</strong> — who you talk to (Telegram, Hermes chat, Cursor, Claude Code, Codex), plus skills, memory, and optional MCP bridges.</p><p><strong>Work plane</strong> — the project repository: code, tests, commits, and a local .hermes-outbox/ folder.</p><p><strong>Knowledge plane</strong> — HermesVault: a curated BOARD, project notes, indexes, and contradiction tracking.</p><pre>CONTROL   →  Hermes routing / skills / Telegram<br>WORK      →  project repo + outbox packets<br>KNOWLEDGE →  Hermes ingest → BOARD + project KB</pre><p>Two sentences that must stay true:</p><ol><li>packet ≠ knowledge — an outbox packet is a <em>proposal</em>; Hermes turns it into durable notes.</li><li>Skills ≠ project KB — reusable workflows and chat memory are not the source of project truth.</li></ol><p>That second line prevents a very common failure mode: slowly treating Hermes skills, MCP context, or chat history as another BOARD.</p><h3>The locked protocol (single-user, multi-client)</h3><p>For one human using many agents, the contract is frozen:</p><pre>READ BOARD<br>  → UNDERSTAND STEP<br>  → DO WORK IN THE PROJECT<br>  → EMIT OUTBOX PACKET (schema v1)<br>  → Hermes INGEST (idempotent)<br>  → CURATED BOARD</pre><p>Outbox packets carry a globally unique packet_id, provenance fields, and explicit statuses (completed, partial, blocked, failed, observation). Packets are immutable; corrections emit a new packet (optionally replaces).</p><p>Ingestion is idempotent: the same packet_id must never duplicate durable knowledge or replay a BOARD transition.</p><p>The BOARD is a <strong>curated projection of current state</strong> — not an append-only event log, and not blind last-writer-wins.</p><p>Who writes the vault knowledge tree? <strong>Hermes only.</strong> Agents do not edit project knowledge directly — even if they can <em>see</em> the files on disk or over the network.</p><blockquote><em>Filesystem visibility does not equal knowledge authority.</em></blockquote><h3>KEEP BOTH: Hermes the agent and Hermes the curator</h3><p>There is a popular narrative that “connecting Hermes MCP to Claude Code gives Claude Hermes’s brain.” Useful marketing. Incomplete engineering.</p><p>In practice we <strong>keep both</strong> layers — locked as a design decision:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gRB69gQYFXmGJtskKnfy6A.png" /></figure><p>Optional Hermes MCP in Cursor or Claude Code is a <strong>messaging bridge</strong> (read/send conversations through Hermes platforms). It does <strong>not</strong> perform vault ingest. “Ingest this” remains an explicit curator step.</p><p>That is intentional. It keeps write authority singular.</p><h3>Working from remote: where this actually helps</h3><p>This is the part that changes daily life.</p><p>If Hermes is running on a primary machine (in my setup, a Mac mini) with the project and vault reachable, remote work looks like this:</p><pre>Phone / Telegram<br>    → Hermes gateway<br>        → check Jira / wiki / BOARD<br>        → run Claude Code or Codex in the project<br>        → write schema v1 outbox packet<br>        → ingest → update BOARD<br>    → concise reply on Telegram</pre><h3>What you can do from the phone</h3><ul><li>Ask what the BOARD says for a project</li><li>Pull story context from Jira/Confluence via Hermes’s Atlassian tools</li><li>Delegate an implementation step to Claude Code or Codex on the host</li><li>File a durable outcome so the next agent — Cursor tomorrow morning — orients from the same BOARD</li></ul><p>You do <strong>not</strong> need Hermes MCP inside Cursor for this. Telegram already talks to Hermes. You do <strong>not</strong> need Cursor open. Hermes does not drive the Cursor UI; for hands-free coding it delegates CLI agents.</p><h3>Honest limits</h3><p>Remote coding is not magic:</p><ul><li>The primary host must be awake and reachable</li><li>Pixel-perfect UI work still wants an IDE</li><li>Claude Code / Codex quotas still apply on that machine</li><li>Interactive permission prompts can block non-interactive runs if tools are locked down</li></ul><p>The win is not “replace the IDE forever.” The win is <strong>continuity</strong>: remote sessions leave curated project memory, not another orphaned chat.</p><p>On a LAN, an office laptop can <strong>mount</strong> the primary vault for BOARD read access and keep the project local — without copying the wiki everywhere, and without requiring SSH from the primary back to the office machine.</p><h3>Attaching a real repo</h3><p>For a new or existing project:</p><pre>link_project_to_vault.sh /path/to/project [Slug]<br># …work…<br>ingest_project_outbox.py /path/to/project</pre><p>Linking creates the pointer (.hermes-vault.json), outbox, boot stubs for agents, and an empty BOARD shell in the vault.</p><p>Important for existing codebases: <strong>link does not auto-ingest the repository.</strong> Initial knowledge is bootstrapped deliberately — understanding/design packets, real BOARD steps — then grown by normal work outcomes. That keeps the knowledge base intentional instead of noisy.</p><h3>What about teams?</h3><p>Single-user multi-client is strong for one person and many tools. It is <strong>not</strong> automatically a multi-user product.</p><p>The proposed extension keeps the same packet protocol and adds one rule:</p><blockquote><strong><em>Sharing the vault does not mean sharing write authority.</em></strong></blockquote><p>Many humans and agents may emit packets. <strong>One curator</strong> commits BOARD and knowledge. Team phases are design-only until the single-user loops are proven. No watcher, cron, or auto-ingest until then. No distributed vault writers.</p><p>That sequencing is boring on purpose. Protocol first; automation later.</p><h3>The boundary that matters</h3><p>If you take one idea from HermesVault, take this:</p><blockquote><strong><em>Hermes owns how durable project knowledge is committed.</em></strong><em><br></em><strong><em>Agents own how code changes.</em></strong><em><br></em><strong><em>Chat, skills, and MCP own control and ops — not a second source of project truth.</em></strong></blockquote><p>That is how you use Claude Code from Telegram, Cursor at the desk, and Codex when it fits — without waking up to three conflicting versions of “done.”</p><h3>Read the full design</h3><p>Gist (framework + single-user limits + team roadmap + remote model):<br><a href="https://gist.github.com/callsamik/95d61ead30e1346dbaab7dceb95fd6b6">https://gist.github.com/callsamik/95d61ead30e1346dbaab7dceb95fd6b6</a></p><p>If you run multi-agent setups across IDE + CLI + messaging, I’d like to hear what you’d prioritize next: stronger packet ergonomics, a read-only BOARD API for agents, or a careful two-human experiment with one curator.</p><p><em>Samik Bandyopadhyay — building practical agent systems with clear ownership boundaries.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=77792e54323e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building multiprovider-llm: A Production-Ready Multi-LLM Client]]></title>
            <link>https://medium.com/@callsamik/building-multiprovider-llm-a-production-ready-multi-llm-client-b5683df033ed?source=rss-495d496617d6------2</link>
            <guid isPermaLink="false">https://medium.com/p/b5683df033ed</guid>
            <dc:creator><![CDATA[Samik Bandyopadhyay]]></dc:creator>
            <pubDate>Fri, 14 Aug 2026 01:49:20 GMT</pubDate>
            <atom:updated>2026-08-14T02:52:35.545Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7lK3RQsgko5wVP122rduOQ.png" /><figcaption>A single complete() call hits OpenAI, gets a 429, skips idle Anthropic, and lands on Gemini — with inflight budget still in view.</figcaption></figure><h3>Introduction</h3><p>Over the past year, I’ve built the <strong>Autonomous Investment Navigator</strong> (AIN) — a Python-based research laboratory for evidence-driven investment discovery. A core challenge has been safely routing financial research prompts across multiple LLM providers (Gemini, Groq, OpenRouter, OpenAI, Anthropic, and local Ollama models) with deterministic fallback logic, per-provider budgets, and cost control.</p><p>What started as internal infrastructure in AIN’s Layer 21 evolved into something larger: <strong>multiprovider-llm</strong>, a standalone, production-ready Python library that abstracts multi-provider LLM connectivity.</p><p>This article walks through the design, implementation, and lessons learned.</p><h3>The Problem Space</h3><h3>Why Multi-Provider?</h3><p>Using a single LLM provider is comfortable but risky:</p><ul><li><strong>Vendor lock-in</strong> — If OpenAI has an outage or changes pricing, your system breaks</li><li><strong>Cost optimization</strong> — Different providers suit different workloads (cheap for simple queries, capable for complex reasoning)</li><li><strong>Latency resilience</strong> — When primary provider is slow or rate-limited, fallback to secondary</li><li><strong>Feature access</strong> — Some capabilities (vision, structured output, extended context) vary by provider</li><li><strong>Freshness requirements</strong> — For real-time data validation, you need remote providers; local models have stale cutoffs</li></ul><h3>The Complexity Tax</h3><p>But multi-provider systems introduce unexpected complexity:</p><p><strong>API Surface Fragmentation</strong></p><ul><li>OpenAI: Chat Completions REST API with Bearer token</li><li>Anthropic: Messages API with different error codes</li><li>Gemini: generateContent with key in URL</li><li>Each has its own model names, response format, token counting</li></ul><p><strong>Rate Limiting &amp; Budgets</strong></p><ul><li>Each provider reports rate limits differently (some via headers, some via status codes)</li><li>You need per-provider inflight limits + global budgets</li><li>Rate limit handling requires cooldown tracking and retry-after respect</li><li>Concurrent callers need atomic reservation</li></ul><p><strong>Deterministic Fallback Logic</strong></p><ul><li>Which providers to try, and in what order?</li><li>How do you distinguish transient (retry) vs. terminal (stop) errors?</li><li>What if auth fails on primary? (Don’t try secondary, fail fast)</li><li>What if timeout happens? (Retry, it’s transient)</li><li>Need attempt auditing for debugging</li></ul><p><strong>Tier-Based Routing</strong></p><ul><li>“Simple” tasks → cheap models (gpt-4o-mini, llama-3.1–8b)</li><li>“Complex” tasks → flagship models (gpt-4o, claude-3–5-sonnet)</li><li>“Standard” → middle ground</li><li>This routing logic compounds with provider selection</li></ul><p><strong>Freshness Enforcement</strong></p><ul><li>Local models (Ollama, Qwen3) have training cutoffs; never use them for live news validation</li><li>Only remote providers can validate current information</li><li>This constraint must be enforced in orchestration, not left to callers</li></ul><p><strong>Concurrency &amp; Thread Safety</strong></p><ul><li>Multiple requests in flight to the same provider</li><li>Atomic budget reservations</li><li>Cooldown state shared across threads</li><li>Most naive implementations aren’t thread-safe</li></ul><p>Attempting to handle all this ad-hoc in application code leads to:</p><ul><li>Scattered provider logic across the codebase</li><li>Subtle bugs in fallback chains</li><li>Rate limit surprises in production</li><li>Inability to reason about system behavior</li></ul><h3>Design Philosophy</h3><p>Rather than wrap existing SDKs (OpenAI, Anthropic, google-generativeai) or adopt a heavy abstraction (LiteLLM), I chose to build a <strong>custom, orchestration-first library</strong>.</p><h3>Key Principles</h3><ul><li><strong>Orchestration Owns Routing, Fallback, Limits, Budgets</strong></li><li>Client is the single source of truth for:</li><li>Which provider attempts happen, and in what order</li><li>When to stop (auth failure, no eligible providers)</li><li>When to continue (rate limit, timeout)</li><li>Attempt history and audit trail</li><li>Adapters are dumb: just HTTP translation</li><li><strong>Protocol-Based, Not SDK-Based</strong></li><li>Define a clean adapter protocol: complete(req) → response and acomplete(req) → response</li><li>Implement adapters in pure httpx (no vendor SDKs as required dependencies)</li><li>This avoids:</li><li>SDK version conflicts</li><li>Unwanted transitive dependencies</li><li>SDK-specific retry/timeout semantics leaking into your logic</li><li><strong>Config-Driven, Not Hard-Coded</strong></li><li>Provider order, models, rate limits, tier routing live in JSON</li><li>Swap strategies without redeploying code</li><li>Fail explicitly on invalid config (strict validation)</li><li><strong>Deterministic Error Handling</strong></li><li>Define a retryability matrix: which exceptions should the library retry?</li><li>Stop on terminal errors (auth, validation, config)</li><li>Continue on transient errors (429, 5xx, timeout, connection)</li><li>Caller decides policy beyond that</li><li><strong>Concurrency-Safe from Day One</strong></li><li>In-memory limiter with threading.Lock</li><li>Atomic reserve/finalize semantics</li><li>Ready for concurrent Client instances + async workloads</li><li>Distributed backends (Redis) pluggable via Limiter protocol</li><li><strong>No Surprising Dependencies</strong></li><li>Only httpx (HTTP library)</li><li>Dev: pytest, pytest-asyncio, respx (mock HTTP)</li><li>Importing multiprovider_llm doesn’t pull OpenAI SDK, Anthropic SDK, etc.</li></ul><h3>Design Specification</h3><p>Before implementing, I froze a detailed v1 design spec covering:</p><ul><li>Public API surface (Client.complete, AsyncClient.acomplete)</li><li>Input validation and normalization</li><li>Result types and attempt records</li><li>Orchestration flow (resolve chain → reserve → attempt → release/finalize)</li><li>Retryability matrix</li><li>Limiter protocol (with default in-memory implementation)</li><li>Cooldown semantics</li><li>Provider adapter contract</li><li>Error types</li><li>Testing strategy</li><li>Package layout</li></ul><p>The spec is explicit about <strong>what the library owns vs. what callers own</strong>:</p><p>LibraryCallerAuth / base URL resolutionDomain-specific promptsModel resolution by tierStrict product schema validationFallback chain + routingBusiness policy (e.g., “skip brief if no Gemini”)Rate limits and budgetsInvestment-specific coercionTimeouts, typed errors, attempt log</p><p>This separation prevents scope creep and keeps the library focused.</p><h3>Implementation</h3><h3>Architecture Layers</h3><pre>                  ┌─────────────────────────┐<br>                  │  Client / AsyncClient   │<br>                  │   routing + fallback    │<br>                  └────────────┬────────────┘<br>                               │<br>             ┌─────────────────┼─────────────────┐<br>             │                 │                 │<br>             ▼                 ▼                 ▼<br>       ┌───────────┐     ┌───────────┐     ┌───────────┐<br>       │  Limits   │     │   Route   │     │  Errors   │<br>       └─────┬─────┘     └─────┬─────┘     └─────┬─────┘<br>             │                 │                 │<br>             └─────────────────┼─────────────────┘<br>                               │<br>                               ▼<br>                  ┌─────────────────────────┐<br>                  │    Provider Registry    │<br>                  │      (lazy-loaded)      │<br>                  └────────────┬────────────┘<br>                               │<br>             ┌─────────────────┼─────────────────┐<br>             │                 │                 │<br>             ▼                 ▼                 ▼<br>      ┌─────────────┐    ┌───────────┐     ┌───────────┐<br>      │OpenAI Compat│    │  Claude   │     │  Gemini   │<br>      └─────────────┘    └───────────┘     └───────────┘</pre><h3>Core Modules</h3><p>types.py<strong> — Frozen Data Models</strong></p><ul><li>Message (role, content)</li><li>CompletionResult (text, provider, model, tier, latency_ms, usage, attempts, optional raw)</li><li>Usage (prompt_tokens, completion_tokens, total_tokens, extras)</li><li>AttemptRecord (provider, model, ok, error_type, status_code, latency_ms, message)</li></ul><p>All frozen dataclasses for immutability and hashability.</p><p>client.py<strong> — Sync Orchestration</strong></p><pre>def complete(<br>    prompt=None,<br>    messages=None,<br>    tier=None,                # &quot;simple&quot; | &quot;standard&quot; | &quot;complex&quot; | None<br>    provider_chain=None,      # explicit override of tier routing<br>    response_format=&quot;text&quot;,   # &quot;text&quot; | &quot;json&quot;<br>    json_schema=None,<br>    freshness_required=False,<br>    timeout_s=None,<br>    include_raw=False,<br>) → CompletionResult</pre><p>Flow:</p><ul><li>Normalize messages (accept prompt OR messages, not both)</li><li>Validate kwargs (json_schema requires response_format=”json”)</li><li>Resolve provider chain (tier routing + freshness filter)</li><li>If no providers eligible → raise NoEligibleProviders (don&#39;t attempt)</li><li>For each provider in chain:</li><li>Skip if cooldown active</li><li>Try atomic reserve from limiter</li><li>If reserve fails → append AttemptRecord, continue</li><li>Build request (resolve model, handle response_format)</li><li>Call adapter</li><li>On success → finalize usage, return result</li><li>On retryable error → release, cooldown if 429, append AttemptRecord, continue</li><li>On terminal error → raise immediately (auth, validation, config)</li><li>If all attempts fail → raise AllProvidersFailed with attempts</li></ul><p>async_client.py<strong> — Native Async</strong></p><ul><li>Mirrors Client.complete as acomplete</li><li>Uses httpx.AsyncClient (not wrapped in to_thread)</li><li>Same error handling, same return types</li></ul><p>routing.py<strong> — Chain Resolution</strong></p><pre>def resolve_chain(<br>    config,<br>    tier=None,<br>    provider_chain=None,<br>    freshness_required=False,<br>) → tuple[str, ...]</pre><p>Logic:</p><ul><li>If explicit provider_chain provided → filter (enabled + freshness) and use it</li><li>Else → start from config.provider_order, apply tier routing if tier is set</li><li>Filter out disabled providers</li><li>Filter out stale providers if freshness_required=True</li></ul><p>limits.py<strong> — Rate Limiting &amp; Budgets</strong></p><pre>class InMemoryLimiter:<br>    def try_reserve(provider: str) → Reservation<br>    def finalize(reservation, usage: Usage) → None<br>    def release(reservation) → None</pre><ul><li>Thread-safe with threading.Lock</li><li>Per-provider inflight caps</li><li>Global inflight budget</li><li>Limiter is a protocol: easy to inject Redis later</li><li>Cooldowns tracked separately (per-provider, duration from retry-after or config)</li></ul><p>providers/<strong> — Adapter Implementations</strong> Each adapter implements:</p><pre>class ProviderAdapter:<br>    name: str<br>    def complete(req: ProviderRequest) → ProviderResponse<br>    async def acomplete(req: ProviderRequest) → ProviderResponse</pre><p><strong>OpenAI-Compatible</strong> (openai_compat.py):</p><ul><li>Handles OpenAI, and can be reused for Groq, OpenRouter (both are OpenAI-compatible)</li><li>Converts Message → Chat Completions format</li><li>Parses usage from response</li><li>Raises RateLimited on 429, ProviderError on other 4xx/5xx</li></ul><p><strong>Anthropic</strong> (anthropic.py):</p><ul><li>Messages API (not legacy Completions)</li><li>Different auth header (x-api-key)</li><li>Different error codes (429, 529)</li><li>Different usage reporting</li></ul><p><strong>Gemini</strong> (gemini.py):</p><ul><li>generateContent endpoint</li><li>Key in URL, not header</li><li>HarmBlockThreshold / HarmCategory safety filters</li><li>Converts Message → Content format</li></ul><p>config.py<strong> — Configuration</strong></p><pre>@dataclass(frozen=True)<br>class ProviderConfig:<br>    name: str<br>    enabled: bool<br>    freshness_ok: bool<br>    models: dict[str, str]  # tier → model name<br>    default_model: str<br>    base_url: str<br>    api_key_env: str<br>    rate_limits: ProviderLimit | None</pre><pre>@dataclass(frozen=True)<br>class LibraryConfig:<br>    providers: dict[str, ProviderConfig]<br>    provider_order: tuple[str, ...]<br>    tier_routing: dict[str, tuple[str, ...]]  # tier → preferred order<br>    global_budget: int | None</pre><p>Validation:</p><ul><li>Unknown top-level keys are rejected (strict mode)</li><li>Provider names in tier_routing must be valid</li><li>All enabled remote providers must appear in each tier_routing entry</li></ul><p>errors.py<strong> — Typed Exceptions</strong></p><ul><li>ValidationError (bad kwargs)</li><li>ConfigError (invalid config)</li><li>ProviderError (4xx/5xx, non-rate-limit)</li><li>RateLimited (429, with headers for retry-after)</li><li>BudgetExceeded (global inflight exceeded)</li><li>NoEligibleProviders (no providers after filters)</li><li>AllProvidersFailed (≥1 attempt, all failed retryably)</li></ul><h3>Testing Strategy</h3><p>12 test files covering:</p><ul><li><strong>Unit Tests (no network)</strong></li><li>test_routing.py — chain resolution, tier routing, freshness filtering</li><li>test_limits.py — atomic reserve/finalize, per-provider vs. global, concurrency</li><li>test_serialization.py — message normalization, JSON extraction</li><li>test_types.py — dataclass construction, frozen semantics</li><li>test_registry.py — provider registration, lazy loading, deduplication</li><li><strong>Adapter Contract Tests (respx mocks)</strong></li><li>test_openai_compat.py — request shape, auth header, model resolution, error parsing</li><li>test_anthropic.py — Messages API format, x-api-key header</li><li>test_gemini.py — generateContent format, safety filters</li><li><strong>Integration Tests</strong></li><li>test_client.py — fallback, stop-on-auth, attempt records, budget exhaustion</li><li>test_async_client.py — async fallback, same error handling</li><li>test_config_load.py — JSON parsing, validation</li><li><strong>Live Smoke Tests (opt-in)</strong></li><li>Marked @pytest.mark.live, excluded from required CI</li><li>Requires actual API keys</li><li>Useful for pre-release validation but not blocking</li></ul><p>Run:</p><pre>pytest -m &quot;not live&quot;                 # all required tests<br>pytest -m live                       # live provider smoke tests<br>pytest -v --tb=short tests/          # detailed output</pre><h3>Usage Examples</h3><h3>Basic Usage</h3><pre>from multiprovider_llm import Client, load_config</pre><pre>config = load_config(&quot;config.json&quot;)<br>client = Client(config)</pre><pre>result = client.complete(<br>    prompt=&quot;Summarize the latest AI news&quot;,<br>    tier=&quot;standard&quot;,<br>)<br>print(f&quot;Provider: {result.provider}&quot;)<br>print(f&quot;Model: {result.model}&quot;)<br>print(f&quot;Latency: {result.latency_ms:.0f}ms&quot;)<br>print(f&quot;Answer: {result.text}&quot;)</pre><h3>With Explicit Fallback Chain</h3><pre>result = client.complete(<br>    prompt=&quot;Complex financial analysis&quot;,<br>    provider_chain=[&quot;openai&quot;, &quot;anthropic&quot;, &quot;gemini&quot;],<br>    freshness_required=True,  # filter out stale local models<br>)</pre><h3>Tier-Based Routing</h3><pre># Automatic model selection based on tier<br>result = client.complete(<br>    prompt=&quot;Is this a typo?&quot;,<br>    tier=&quot;simple&quot;,  # uses gpt-4o-mini, not gpt-4o<br>)</pre><h3>JSON Response with Schema Hint</h3><pre>result = client.complete(<br>    prompt=&quot;Extract: {news_item}&quot;,<br>    response_format=&quot;json&quot;,<br>    json_schema={<br>        &quot;type&quot;: &quot;object&quot;,<br>        &quot;properties&quot;: {<br>            &quot;headline&quot;: {&quot;type&quot;: &quot;string&quot;},<br>            &quot;sentiment&quot;: {&quot;type&quot;: &quot;number&quot;}<br>        }<br>    }<br>)<br>data = json.loads(result.text)</pre><h3>Async</h3><pre>async_result = await async_client.acomplete(<br>    prompt=&quot;...&quot;,<br>    tier=&quot;standard&quot;<br>)</pre><h3>Attempt Auditing</h3><pre>result = client.complete(prompt=&quot;...&quot;, tier=&quot;standard&quot;)<br>for attempt in result.attempts:<br>    print(f&quot;{attempt.provider}: {attempt.ok} in {attempt.latency_ms:.0f}ms&quot;)<br># Output:<br># openai: True in 523ms<br># (or, if openai failed and gemini succeeded:)<br># openai: False (rate limited) in 0ms<br># gemini: True in 412ms</pre><h3>Custom Limiter</h3><pre>from multiprovider_llm import Client<br>from my_app import RedisLimiter</pre><pre>config = load_config(&quot;config.json&quot;)<br>limiter = RedisLimiter(redis_client)<br>client = Client(config, limiter=limiter)</pre><h3>Lessons Learned</h3><h3>Design-First Prevents Rework</h3><p>Freezing the specification before implementation forced clarity:</p><ul><li>What does the library own?</li><li>What does the caller own?</li><li>When do we stop vs. retry?</li></ul><p>This eliminated later scope creep and made implementation straightforward.</p><h3>Protocol-Based Beats SDK-Wrapping</h3><p>Building on httpx + protocols proved cleaner than wrapping OpenAI/Anthropic SDKs:</p><ul><li>No transitive dependency bloat</li><li>Full control over orchestration semantics</li><li>Easy to add new providers without SDK updates</li><li>Adapters stay simple (just HTTP translation)</li></ul><h3>Concurrency-Safety Requires Atomic Ops</h3><p>Early assumption: “Single-user MVP, thread safety can wait.” Reality: Build it in from the start. The overhead is minimal (a Lock around reservations), and bugs are hard to debug later.</p><h3>Config Validation Catches Mistakes Early</h3><p>Strict config validation (rejecting unknown keys, validating provider references in tier_routing) caught configuration errors that would otherwise silently fail at runtime.</p><h3>Retryability Matrix Belongs in Docs</h3><p>Documenting which errors are transient vs. terminal is as important as the code. Add a test for each cell of the matrix.</p><h3>Attempt Records Are Invaluable</h3><p>Logging full attempt history (provider, model, latency, error type, status code) made production debugging and observability so much easier.</p><h3>What’s Out of v1</h3><p>Intentionally deferred:</p><ul><li><strong>Streaming</strong> — Would require redesigning the result type (iterator vs. single value)</li><li><strong>Vision / Multimodal</strong> — Requires image input handling; adding later is feasible</li><li><strong>Distributed Limiters</strong> — Redis backend via Limiter protocol; low priority for single-user systems</li><li><strong>Observability Hooks</strong> — Placeholder for future integration (on_attempt_recorded, etc.)</li><li><strong>Groq/OpenRouter Presets</strong> — Config examples exist; formal entries wait for adoption feedback</li></ul><p>All marked <strong>experimental</strong> in the README until stabilized by actual usage.</p><h3>Integration with Autonomous Investment Navigator</h3><p>multiprovider-llm was extracted from AIN’s Layer 21. Future integration:</p><ul><li><strong>Adopt as sibling dependency</strong></li></ul><pre># pyproject.toml<br>multiprovider-llm = { git = &quot;https://github.com/callsamik/multiprovider-llm&quot; }</pre><ul><li><strong>Replace AiLiveAnalysisAgent.analyze()</strong></li><li>Current: direct calls to _call_openai, _call_gemini, etc.</li><li>Future: wrap Client.complete, inject audit logging</li><li><strong>Inject Custom Limiter</strong></li><li>AIN already audits usage to disk (data/ai_limits/*.json)</li><li>Could inject limiter that logs to audit_path</li><li><strong>Migrate Config</strong></li><li>Current: config/ai_providers.json (AIN-specific format)</li><li>Future: config/ai_providers.json (multiprovider_llm format)</li></ul><p>Migration effort: ~2–4 hours, low-risk refactor.</p><h3>Future Roadmap</h3><p>Post-v1 enhancements (subject to adoption feedback):</p><ul><li><strong>Streaming Support</strong> — Iterator-based completion for long-running tasks</li><li><strong>Observability Hooks</strong> — Callbacks for attempt records, budget events</li><li><strong>Distributed Limiters</strong> — Redis backend; shared quota across processes</li><li><strong>Groq/OpenRouter Presets</strong> — Formal config entries when adopted</li><li><strong>Vision Support</strong> — Image input handling</li><li><strong>PyPI Publication</strong> — Once surface is proven; likely Q4 2026</li></ul><h3>Getting Started</h3><p><strong>GitHub:</strong> <a href="https://github.com/callsamik/multiprovider-llm">https://github.com/callsamik/multiprovider-llm</a></p><p><strong>Clone and install:</strong></p><pre>git clone https://github.com/callsamik/multiprovider-llm.git<br>cd multiprovider-llm<br>pip install -e &quot;.[dev]&quot;</pre><pre># Run tests<br>pytest -m &quot;not live&quot;</pre><p><strong>What’s included:</strong></p><ul><li>Full design specification (docs/design.md)</li><li>README with examples</li><li>12 comprehensive test files</li><li>3 production adapters (OpenAI, Anthropic, Gemini)</li><li>MIT license</li></ul><p><strong>Status:</strong> v0.1.0a1 — Production ready, experimentals labeled, ready for adoption.</p><h3>Closing Thoughts</h3><p>The multi-provider LLM routing problem is nuanced and easy to get wrong. Most solutions either:</p><ul><li>Wrap SDKs too tightly, losing visibility into orchestration</li><li>Build abstractions too thin, leaving critical logic to callers</li><li>Add too much magic, making failures hard to debug</li></ul><p>multiprovider-llm aims for a third path: <strong>lean orchestration, protocol-based adapters, and deterministic error handling</strong>. The result is a library that’s:</p><ul><li>Easy to reason about</li><li>Safe for production (concurrency-safe, budget-controlled)</li><li>Extensible (Limiter protocol, easy to add providers)</li><li>Observable (full attempt history)</li></ul><p>If you’re building systems that use multiple LLM providers, give it a try and send feedback. If you’re building the next big LLM application, I’d love to hear how you’re solving this problem differently.</p><p><strong>Questions? Feedback? Contributions?</strong></p><ul><li>File an issue or PR on GitHub</li><li>Reach out on LinkedIn or Twitter (@callsamik)</li><li>Check docs/design.md for detailed specifications</li></ul><p>Happy coding! 🚀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b5683df033ed" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>