Skip to content
Back

Decision Tree

An agent at a fork shows each way forward as a branch – what it changes, which parts worry it, which one it would take – and waits for you to pick a path or tell it something else.

oxyn add decision-tree
MCP

Decisions

3 waiting for you1 of 3
High risk
Deploy agentOpus 4.1

Sign-in errors rose to 9% after build 1207 – how should I proceed?

1,860 failed sign-ins in 15 minutes · support tickets doubling.

  1. Sign-ins recover in ~3 minDrops the new SSO screen
    Post a status update?
  2. Fix is 2 lines · ~20 min to ship
  3. Instant · old sign-in for everyone
Choose a path1–4· next· noteF
Dioxus
rsx! {
    DecisionTree {
        decisions: Some(agent.pending_decisions()),
        now: clock.now(),
        on_choose: move |(id, branch, then)| agent.resolve(id, branch, then),
        on_other: move |(id, text)| agent.instruct(id, text),
    }
}

Rendered from Rust at build time · goes live when visible

When to use

  • An agent at a fork it should not take alone shows each way forward as a branch – what it changes, which consequence worries it, which one it would take – and waits for a person to pick a path or write a different instruction.

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

Decision Tree 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 decision-tree
Rust
use crate::oxyn::{DecisionTree, STATUS_INDICATOR_CSS};

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

Usage

Dioxus · rust
rsx! {
    DecisionTree {
        decisions: Some(agent.pending_decisions()),
        now: clock.now(),
        on_choose: move |(id, branch, then)| agent.resolve(id, branch, then),
        on_other: move |(id, text)| agent.instruct(id, text),
    }
}

Examples

Auto

The tree plays itself – the agent's pick lights up, gets picked, its follow-up answered, then the next decision grows in. Touch it to take over.

Decisions

3 waiting for you1 of 3
High risk
Deploy agentOpus 4.1

Sign-in errors rose to 9% after build 1207 – how should I proceed?

1,860 failed sign-ins in 15 minutes · support tickets doubling.

  1. Sign-ins recover in ~3 minDrops the new SSO screen
    Post a status update?
  2. Fix is 2 lines · ~20 min to ship
  3. Instant · old sign-in for everyone
Choose a path1–4· next· noteF
Code
rsx! {
    DecisionTree {
        decisions: Some(agent.pending_decisions()),
        now: clock.now(),
        on_choose: move |(id, branch, then)| agent.resolve(id, branch, then),
        on_other: move |(id, text)| agent.instruct(id, text),
    }
}

Settled

Waiting for you: three branches and Other…, the follow-ups dimmed until their branch is picked.

Decisions

3 waiting for you1 of 3
High risk
Deploy agentOpus 4.1

Sign-in errors rose to 9% after build 1207 – how should I proceed?

1,860 failed sign-ins in 15 minutes · support tickets doubling.

  1. Sign-ins recover in ~3 minDrops the new SSO screen
    Post a status update?
  2. Fix is 2 lines · ~20 min to ship
  3. Instant · old sign-in for everyone
Choose a path1–4· next· noteF
Code
rsx! {
    DecisionTree {
        decisions: Some(agent.pending_decisions()),
        now: clock.now(),
        on_choose: move |(id, branch, then)| agent.resolve(id, branch, then),
        on_other: move |(id, text)| agent.instruct(id, text),
    }
}

Hover

Hover a branch: the route from the question to it turns blue and the rest fade to 40 %.

Decisions

3 waiting for you1 of 3
High risk
Deploy agentOpus 4.1

Sign-in errors rose to 9% after build 1207 – how should I proceed?

1,860 failed sign-ins in 15 minutes · support tickets doubling.

  1. Sign-ins recover in ~3 minDrops the new SSO screen
    Post a status update?
  2. Fix is 2 lines · ~20 min to ship
  3. Instant · old sign-in for everyone
Choose a path1–4· next· noteF
Code
rsx! {
    DecisionTree {
        decisions: Some(agent.pending_decisions()),
        now: clock.now(),
        on_choose: move |(id, branch, then)| agent.resolve(id, branch, then),
        on_other: move |(id, text)| agent.instruct(id, text),
    }
}

Picked

A branch picked: the rest fade away and its follow-up wakes up – press 1 or 2.

Decisions

3 waiting for you1 of 3
High risk
Deploy agentOpus 4.1

Sign-in errors rose to 9% after build 1207 – how should I proceed?

1,860 failed sign-ins in 15 minutes · support tickets doubling.

  1. Sign-ins recover in ~3 minDrops the new SSO screen
    Post a status update?
  2. Fix is 2 lines · ~20 min to ship
  3. Instant · old sign-in for everyone
Then1–2· noteF
Code
rsx! {
    DecisionTree {
        decisions: Some(agent.pending_decisions()),
        now: clock.now(),
        on_choose: move |(id, branch, then)| agent.resolve(id, branch, then),
        on_other: move |(id, text)| agent.instruct(id, text),
    }
}

Outcome

Both levels picked: the path runs on to Approved · running.

Decisions

3 waiting for you1 of 3
High risk
Deploy agentOpus 4.1

Sign-in errors rose to 9% after build 1207 – how should I proceed?

1,860 failed sign-ins in 15 minutes · support tickets doubling.

  1. Sign-ins recover in ~3 minDrops the new SSO screen
    Post a status update?
    Approved· running
  2. Fix is 2 lines · ~20 min to ship
  3. Instant · old sign-in for everyone
Decided · next one in a moment
Code
rsx! {
    DecisionTree {
        decisions: Some(agent.pending_decisions()),
        now: clock.now(),
        on_choose: move |(id, branch, then)| agent.resolve(id, branch, then),
        on_other: move |(id, text)| agent.instruct(id, text),
    }
}

Other

Other… turned into a small text box; Enter sends it, Shift+Enter adds a line break.

Decisions

3 waiting for you1 of 3
High risk
Deploy agentOpus 4.1

Sign-in errors rose to 9% after build 1207 – how should I proceed?

1,860 failed sign-ins in 15 minutes · support tickets doubling.

  1. Sign-ins recover in ~3 minDrops the new SSO screen
    Post a status update?
  2. Fix is 2 lines · ~20 min to ship
  3. Instant · old sign-in for everyone
Choose a path1–4· next· noteF
Code
rsx! {
    DecisionTree {
        decisions: Some(agent.pending_decisions()),
        now: clock.now(),
        on_choose: move |(id, branch, then)| agent.resolve(id, branch, then),
        on_other: move |(id, text)| agent.instruct(id, text),
    }
}

Sent

An instruction sent instead of a branch, with the agent's short answer.

Decisions

3 waiting for you1 of 3
High risk
Deploy agentOpus 4.1

Sign-in errors rose to 9% after build 1207 – how should I proceed?

1,860 failed sign-ins in 15 minutes · support tickets doubling.

  1. Sign-ins recover in ~3 minDrops the new SSO screen
    Post a status update?
  2. Fix is 2 lines · ~20 min to ship
  3. Instant · old sign-in for everyone
  4. Revert first, then page whoever owns the build
    Sent to the deploy agent
Got it – the deploy agent will do that instead.
Code
rsx! {
    DecisionTree {
        decisions: Some(agent.pending_decisions()),
        now: clock.now(),
        on_choose: move |(id, branch, then)| agent.resolve(id, branch, then),
        on_other: move |(id, text)| agent.instruct(id, text),
    }
}

Flagged

A flagged consequence with the agent's note open (F cycles through them).

Decisions

3 waiting for you2 of 3
Medium risk
Billing agentGPT-5

A customer asks for 30% off to renew – counter or accept?

Renewal is due Friday · 140 seats on the annual plan.

  1. Keeps ~$41k a year in margin
    Ask for a longer term?
  2. $58k a year · needs approvalAgent's noteDiscounts over 20% need a finance sign-off before they are offered.Pricing policy
  3. Reply expected within a day
Choose a path1–4· next· noteF
Code
rsx! {
    DecisionTree {
        decisions: Some(agent.pending_decisions()),
        now: clock.now(),
        on_choose: move |(id, branch, then)| agent.resolve(id, branch, then),
        on_other: move |(id, text)| agent.instruct(id, text),
    }
}

No other

Without Other…: the branches are the only way forward.

Decisions

3 waiting for you1 of 3
High risk
Deploy agentOpus 4.1

Sign-in errors rose to 9% after build 1207 – how should I proceed?

1,860 failed sign-ins in 15 minutes · support tickets doubling.

  1. Sign-ins recover in ~3 minDrops the new SSO screen
    Post a status update?
  2. Fix is 2 lines · ~20 min to ship
  3. Instant · old sign-in for everyone
Choose a path1–3· next· noteF
Code
rsx! {
    DecisionTree {
        decisions: Some(agent.pending_decisions()),
        now: clock.now(),
        on_choose: move |(id, branch, then)| agent.resolve(id, branch, then),
        on_other: move |(id, text)| agent.instruct(id, text),
    }
}

Single

One decision, two branches, no follow-ups.

Decisions

1 waiting for you1 of 1
Medium risk
Support agentSonnet 4.5

A duplicate charge was found on 37 orders – refund them all now?

$1,184 in total · customers not told yet.

  1. $1,184 · not reversible
  2. Only customers who write in
Choose a path1–3
Code
rsx! {
    DecisionTree {
        decisions: Some(agent.pending_decisions()),
        now: clock.now(),
        on_choose: move |(id, branch, then)| agent.resolve(id, branch, then),
        on_other: move |(id, text)| agent.instruct(id, text),
    }
}

Narrow

At 380 px the tree turns vertical: question first, then each branch on a line down the left with its consequences beneath.

Decisions

3 waiting for you1 of 3
High risk
Deploy agentOpus 4.1

Sign-in errors rose to 9% after build 1207 – how should I proceed?

1,860 failed sign-ins in 15 minutes · support tickets doubling.

  1. Sign-ins recover in ~3 minDrops the new SSO screen
    Post a status update?
  2. Fix is 2 lines · ~20 min to ship
  3. Instant · old sign-in for everyone
Choose a path1–4· next· noteF
Code
rsx! {
    DecisionTree {
        decisions: Some(agent.pending_decisions()),
        now: clock.now(),
        on_choose: move |(id, branch, then)| agent.resolve(id, branch, then),
        on_other: move |(id, text)| agent.instruct(id, text),
    }
}

Classic

Classic style: framed, grey title strip, the risk tag moves into the card and each set of consequences gets its own box.

Decisions

4 waiting for you1 of 4
Medium risk
Support agentSonnet 4.5

A duplicate charge was found on 37 orders – refund them all now?

$1,184 in total · customers not told yet.

  1. $1,184 · not reversible
  2. Only customers who write in
Choose a path1–3· next
Code
rsx! {
    DecisionTree {
        decisions: Some(agent.pending_decisions()),
        now: clock.now(),
        on_choose: move |(id, branch, then)| agent.resolve(id, branch, then),
        on_other: move |(id, text)| agent.instruct(id, text),
    }
}

API reference

DecisionTree

PropTypeDefaultDescription
decisionsOption<Vec<DtDecision>>Default::default()Everything waiting for a call (the demo queue when `None`).
allow_otherbooltrueOffer the "Other…" branch.
titleString"Decisions"Heading of the bar.
autoboolDefault::default()Demo: the tree plays itself (hover, pick, follow-up, next) until touched.
startusizeDefault::default()Start on this decision.
branchOption<usize>Default::default()Start with this branch of the first decision picked.
thenOption<usize>Default::default()Start with this follow-up option picked too (decision stays, no fade).
hoverOption<usize>Default::default()Start with this branch pointed at.
other_openboolDefault::default()Start with "Other…" open.
sentStringDefault::default()Start with this instruction already sent.
flagOption<usize>Default::default()Start with the n-th flag's note open.
nowrequiredClockMs—The clock.
styleStringDefault::default()`clean`, `classic`, or empty to follow `data-cstyle`.
on_chooseEventHandler<(String, usize, Option<usize>)>—A path was picked: (decision id, branch, follow-up pick).
on_otherEventHandler<(String, String)>—An instruction was sent: (decision id, text).

Read from the Rust signature and doc comments.

Keyboard interactions

KeyAction
1 – 4Chooses that branch; one past the last number opens Other…
EnterIn Other…: sends the instruction (Shift+Enter: new line)
→or← or JorKNext and previous decision
FCycles through the amber flags and shows why the agent raised each
EscapeCloses Other… or a note

Accessibility

  • Branches are real buttons named after their option (the preferred one says so in its name); aria-keyshortcuts lists the digit.
  • Amber flags take focus; aria-describedby ties each to its role=tooltip explanation.
  • Other… is a labelled textarea whose border darkens on focus; picks, instructions and answers go to a polite live region.
  • Connector lines are CSS decoration and never reach assistive tech.

Responsive behaviour

  • A container query: wide, question → branches → consequences run left to right.
  • Under 520 px it runs top to bottom with the consequences under each branch; nothing scrolls sideways.
Edge cases (spec)

A container query: wide, question → branches → consequences left to right. Under 520 px top to bottom: branches hang down the left below the question, consequences tucked under every branch; the "waiting" count steps aside.

Notes for AI

  • Import DecisionTree from oxyn_dioxus and include STATUS_INDICATOR_CSS plus the token stylesheet once.
  • A GPUI version exists: DecisionTreeEl 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