Skip to content

darshjme/sharana

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
शरण — sharana by Darshankumar Joshi

🪷 शरण

sharana

Ramayana — Vibhishana's surrender

Divine Refuge — Sharanagati to the Lord

Fallback strategies for LLM agents. Model fallback, response fallback, default values.

Python Zero Dependencies Vedic Arsenal License

Formerly agent-fallback — Part of the Vedic Arsenal: 100 production-grade Python libraries for LLM agents, each named from the Vedas, Puranas, and Mahakavyas.


The Vedic Principle

When Vibhishana, brother of Ravana, came to Ram's side — renouncing Lanka, renouncing his own blood — Ram accepted him with these words: "Whoever comes to me for refuge, I shall protect."

This is Sharana — divine refuge, unconditional fallback.

sharana implements the fallback chain for LLM systems. When the primary model fails, sharana catches you. When GPT-4 is rate-limited, Claude catches you. When Claude is unavailable, the graceful degradation catches you. Like Ram's promise to Vibhishana, the fallback chain never abandons the task — it finds another way forward, every time.


How It Works

flowchart LR
    A[Task] --> B[Primary LLM]
    B -- Fail --> C[sharana fallback]
    C --> D[Secondary LLM]
    D -- Fail --> E[Tertiary LLM]
    E -- Fail --> F[Graceful Degradation]
    style C fill:#ec4899,color:#fff
Loading

Installation

pip install sharana

Or from source:

git clone https://github.com/darshjme/sharana.git
cd sharana && pip install -e .

Quick Start

from sharana import *

# See examples/ for full usage

The Vedic Arsenal

sharana is one of 100 libraries in darshjme/arsenal — each named from sacred Indian literature:

Sanskrit Name Source Technical Function
sharana Ramayana — Vibhishana's surrender Divine Refuge — Sharanagati to the Lord

Each library solves one problem. Zero external dependencies. Pure Python 3.8+.


Contributing

  1. Fork the repo
  2. Create feature branch (git checkout -b fix/your-fix)
  3. Add tests — zero dependencies only
  4. Open a PR

🪷 Built by Darshankumar Joshi · @thedarshanjoshi

"कर्मण्येवाधिकारस्ते मा फलेषु कदाचन" Your right is to action alone, never to its fruits. — Bhagavad Gita 2.47

Vedic Arsenal · GitHub · Twitter

About

Multi-strategy fallback chains for LLM agents — FallbackChain, ConditionalFallback, RetryThenFallback, @fallback decorator. Zero dependencies.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages