Skip to content
Back

Fallback Chain

Which model actually served a request: the fallback order drawn as a small flow with a running clock and cost, each failed try broken red with its reason, the one that answered carried through to the response.

oxyn add fallback-chain
MCP

Summarise the support ticket

Attempt 1 of 40.0s$0
Dioxus
rsx! {
    FallbackChain {
        attempts: Some(router.attempts()),
        request: req.summary(),
        route: "router/auto",
        on_retry: move |_| router.retry(req),
        now: clock.now(),
    }
}

Rendered from Rust at build time · goes live when visible

When to use

  • Which model actually served a request: the fallback order as a small flow with a running clock and cost, each failed try broken red with its reason, the one that answered carried on to the response.

When not to use

  • An agent asks before it acts: use Approval Card instead.
  • Several open requests in one card: use Approval pager instead.
  • An agent's question in its own card above the composer: use Decision Card instead.

Installation

Fallback Chain is free and MIT. The oxyn CLI copies its code, and the components it needs, into src/oxyn/ of your Dioxus or GPUI project, so it is yours to change.

Terminal
cargo install --git https://github.com/ismailqureshi72/Oxyn oxyn-cli
oxyn init
oxyn add fallback-chain
Rust
use crate::oxyn::{FallbackChain, STATUS_INDICATOR_CSS};

Rather depend on the crate? cargo add oxyn-dioxus oxyn-core --git https://github.com/ismailqureshi72/Oxyn, then use oxyn_dioxus::{FallbackChain, STATUS_INDICATOR_CSS};

Usage

Dioxus · rust
rsx! {
    FallbackChain {
        attempts: Some(router.attempts()),
        request: req.summary(),
        route: "router/auto",
        on_retry: move |_| router.retry(req),
        now: clock.now(),
    }
}

Examples

Live

Plays and loops: a dotted light grows along each branch while that model is tried; the first is rate limited, the second runs out of time, the third answers and runs on to the response. Clock and cost tick in the header.

Summarise the support ticket

Attempt 1 of 40.0s$0
Code
rsx! {
    FallbackChain {
        attempts: Some(router.attempts()),
        request: req.summary(),
        route: "router/auto",
        on_retry: move |_| router.retry(req),
        now: clock.now(),
    }
}

Settled

The finished run: two red breaks, the answer in green, one model never asked.

Summarise the support ticket

Answered7.7s$0.0049
Code
rsx! {
    FallbackChain {
        attempts: Some(router.attempts()),
        request: req.summary(),
        route: "router/auto",
        on_retry: move |_| router.retry(req),
        now: clock.now(),
    }
}

First try

The first model answers – everything after it stays dashed and is marked not needed.

Summarise the support ticket

Answered1.6s$0.0027
Code
rsx! {
    FallbackChain {
        attempts: Some(router.attempts()),
        request: req.summary(),
        route: "router/auto",
        on_retry: move |_| router.retry(req),
        now: clock.now(),
    }
}

Second try

One rate-limit break before the second model answers.

Summarise the support ticket

Answered4.3s$0.0031
Code
rsx! {
    FallbackChain {
        attempts: Some(router.attempts()),
        request: req.summary(),
        route: "router/auto",
        on_retry: move |_| router.retry(req),
        now: clock.now(),
    }
}

All failed

Every model fails: red branches, a red status, no response, and a Retry button in the header.

Summarise the support ticket

All failed4.0s$0
Code
rsx! {
    FallbackChain {
        attempts: Some(router.attempts()),
        request: req.summary(),
        route: "router/auto",
        on_retry: move |_| router.retry(req),
        now: clock.now(),
    }
}

Details

A model opened: provider, its tag, then model, time against its budget, cost, status code, list price and the reason.

Summarise the support ticket

Answered7.7s$0.0049
Code
rsx! {
    FallbackChain {
        attempts: Some(router.attempts()),
        request: req.summary(),
        route: "router/auto",
        on_retry: move |_| router.retry(req),
        now: clock.now(),
    }
}

Medium

Under 600 px the provider leaves the row and lives only in the details card.

Summarise the support ticket

Answered7.7s$0.0049
Code
rsx! {
    FallbackChain {
        attempts: Some(router.attempts()),
        request: req.summary(),
        route: "router/auto",
        on_retry: move |_| router.retry(req),
        now: clock.now(),
    }
}

Narrow

Under 520 px the diagram becomes a vertical tree on a dashed rail.

Summarise the support ticket

Answered7.7s$0.0049
Code
rsx! {
    FallbackChain {
        attempts: Some(router.attempts()),
        request: req.summary(),
        route: "router/auto",
        on_retry: move |_| router.retry(req),
        now: clock.now(),
    }
}

Classic

Classic style: header band over a grey field, flatter nodes.

Summarise the support ticket

Answered7.7s$0.0049
Code
rsx! {
    FallbackChain {
        attempts: Some(router.attempts()),
        request: req.summary(),
        route: "router/auto",
        on_retry: move |_| router.retry(req),
        now: clock.now(),
    }
}

API reference

FallbackChain

PropTypeDefaultDescription
attemptsOption<Vec<FbAttempt>>Default::default()The models in fallback order (the demo's when `None`).
requestString"Summarise the support ticket"The request as the header title.
routeString"router/auto"The router the request went through (under "Request").
liveboolDefault::default()Demo: the chain plays out live and loops; otherwise it shows the settled result.
gap_msu64300Hand-over pause between two tries, ms.
openOption<usize>Default::default()The attempt whose details are open from the start.
nowrequiredClockMs—The clock.
styleStringDefault::default()`clean`, `classic`, or empty to follow `data-cstyle`.
on_retryEventHandler<()>—Retry pressed (shown when every model failed).
on_open_changeEventHandler<Option<usize>>—An attempt's details opened (index) or closed (`None`).

Read from the Rust signature and doc comments.

Keyboard interactions

KeyAction
TabRequest, then each model in order, then the response – each shows its details card on focus
EnterorSpacePins a node's details card open or closes it
EscapeCloses a pinned card

Accessibility

  • Each model is a button whose name carries its place in the order, model, provider and what happened to it; its details card is a role=tooltip that opens on hover, focus or click.
  • The header status (attempt k of n, answered, all failed) is a status region; failures are named in words, never colour alone.
  • The links are an aria-hidden SVG; the order is also the list order. Reduced motion stops the travelling light and the drawing.

Responsive behaviour

  • Wide: request, links, models, links, response in one row.
  • Under 600 px the provider moves into the details card.
  • Under 520 px the links give way to a dashed rail and request, models and response stack.
Edge cases (spec)

Under 600 px the provider leaves the row (it stays in the details card); under 520 px the diagram becomes a vertical tree on a dashed rail with request, models and response stacked.

Notes for AI

  • Import FallbackChain from oxyn_dioxus and include STATUS_INDICATOR_CSS plus the token stylesheet once.
  • A GPUI version exists: FallbackChainEl in oxyn_gpui.
  • Props to set first: now.
  • It reads a clock (now) for live timers; pass one clock for the whole page rather than one per component.
  • Keep its states and timings as they ship; restyle it through the CSS variables rather than by hand.

Guides

Oxyn · 74 free components · 264 Pro components · 96 screens · 20 blocks · Dioxus and GPUI