# Decision Tree: Two Levels: Diagram element for AI agents

> A question with two answers, each leading to two outcomes. The dot drops, splits to the two answer tags, splits again to four outcome switches, then the recommended outcome switches on.

Canonical page: https://agentframes.ai/elements/toggle/decision-tree/
Markdown: https://agentframes.ai/elements/toggle/decision-tree.md

## Overview

- Name: Decision Tree: Two Levels (`decisionTree`), an element: one HyperFrames block per size
- Part of: the [Toggle](https://agentframes.ai/packs/toggle.md) pack (17 of 50). Available only through the All-access subscription.
- Category: Diagram
- Purpose: A question with two answers, each leading to two outcomes. The dot drops, splits to the two answer tags, splits again to four outcome switches, then the recommended outcome switches on.
- Pack: [Toggle](https://agentframes.ai/packs/toggle.md), included in All-access (from $14/month billed annually ($168/year), or $19 monthly)
- Subscribe: POST https://agentframes.ai/api/checkout/subscribe with interval=month or interval=year (optional currency=USD|GBP|EUR|AUD|CAD; 303 redirect to Stripe checkout; a human pays there). Then download any pack with the subscriber key: https://agentframes.ai/account.md
- Aspects: 16:9 (native), 9:16 (native), 4:5 (native), 1:1 (native)
- Canvases: works on Lime (acid lime + charcoal) (`lime`), Cobalt (electric blue + midnight) (`cobalt`), Coral (warm coral + espresso) (`coral`); avoid none
- Typical duration: 8s
- Speaker-safe: no
- Preview video (watermarked): https://agentframes.ai/media/toggle/decision-tree.mp4
- Poster: https://agentframes.ai/media/toggle/decision-tree.jpg
- Licence: [AgentFrames Licence](https://agentframes.ai/licence.md)

## Paste this into Claude Code

```text
Use the AgentFrames Toggle pack. Add a `decisionTree` beat to plan.json on a `lime` canvas with slots `question`, `a`, `b` and `pick` from my script. Then run validate → build → qa and show me qa/contact.jpg.
```

## Variables

| Variable | Type | Label | Description | Default |
|---|---|---|---|---|
| `question` | string | question | {"type":"string","minLength":1,"maxLength":48} | Do people watch past 3 seconds? |
| `a` | string | a | JSON string. {"type":"object","properties":{"label":{"type":"string","minLength":1,"maxLength":10},"leaves":{"type":"array","minItems":2,"maxItems":2,"items":{"type":"string","minLength":1,"maxLength":14}}},"required":["label","leaves"]} | {"label":"Yes","leaves":["Keep the hook","Test payoff"]} |
| `b` | string | b | JSON string. {"type":"object","properties":{"label":{"type":"string","minLength":1,"maxLength":10},"leaves":{"type":"array","minItems":2,"maxItems":2,"items":{"type":"string","minLength":1,"maxLength":14}}},"required":["label","leaves"]} | {"label":"No","leaves":["Rewrite line 1","Cut the intro"]} |
| `pick` | enum | pick | {"type":"string","enum":["none","a0","a1","b0","b1"]} | b0 |

## What your agent can change

**Decision Tree: Two Levels**. Native 1920×1080, 8s at 30fps.

A question with two answers, each leading to two outcomes. The dot drops, splits to the two answer tags, splits again to four outcome switches, then the recommended outcome switches on.

**Motion.** Dot falls (ease-in); first branches draw as twin dots run (ease in-out); answer tags pop; second branches draw as four dots run; outcome switches pop; the picked switch flips on with one burst and the others dim.
**Why it moves.** change: each split is a choice, and the switch shows where the advice lands.

### Mount

Copy every manifest file into your project (plus `af-toggle-runtime`). Mount with a unique host id, `data-composition-id="af-toggle-decision-tree-16x9"`,
`data-composition-src="compositions/af-toggle-decision-tree-16x9.html"`, `data-duration="8"` and `data-variable-values`.
Use the variant whose size matches your project (16x9, 9x16, 4x5, 1x1): each is laid out natively, never scaled.

### Content slots

Nested slots are JSON strings. Every slot is checked against `constraints.json` and measured against the layout before anything
draws; the block stops with a message naming the slot and the fix (it never truncates or shrinks text).

- `question` (required): {"type":"string","minLength":1,"maxLength":48}
- `a` (required): {"type":"object","properties":{"label":{"type":"string","minLength":1,"maxLength":10},"leaves":{"type":"array","minItems":2,"maxItems":2,"items":{"type":"string","minLength":1,"maxLength":14}}},"required":["label","leaves"]}
- `b` (required): {"type":"object","properties":{"label":{"type":"string","minLength":1,"maxLength":10},"leaves":{"type":"array","minItems":2,"maxItems":2,"items":{"type":"string","minLength":1,"maxLength":14}}},"required":["label","leaves"]}
- `pick`: {"type":"string","enum":["none","a0","a1","b0","b1"]}

- `a` is drawn on the left, `b` on the right. 16:9 spreads the four outcomes across; the other sizes stack each pair under its answer.

Style: `colourway` (lime, cobalt, coral), `accent` (optional hex), `footer`, ground: dark only, `exit` (slide or cut).

### Timing

8s. Everything has landed by 4.8s (60%), then the scene holds for reading (the grid and the faint rings slow to a residual drift,
text stays still) and slides out to the left in a motion blur over the last 0.5 s, leaving the empty ground.

### Example

```json
{
  "question": "Do people watch past 3 seconds?",
  "a": "{\"label\":\"Yes\",\"leaves\":[\"Keep the hook\",\"Test payoff\"]}",
  "b": "{\"label\":\"No\",\"leaves\":[\"Rewrite line 1\",\"Cut the intro\"]}",
  "pick": "b0"
}
```

## FAQ

### What can my AI agent change in Decision Tree: Two Levels?

Your agent fills the `question`, `a`, `b` and `pick` slots through the block's data-variable-values (or the starter project's variables). Motion, timing, palette, fonts and the internal layout are protected, so the result keeps the Toggle look.

### Which aspect ratios does Decision Tree: Two Levels support?

Decision Tree: Two Levels is designed natively for 16:9, 9:16, 4:5 and 1:1. A typical beat lasts 8s.

### How do I get Decision Tree: Two Levels?

Decision Tree: Two Levels is included in the Toggle pack, which is part of the AgentFrames All-access subscription along with 49 other templates in this pack and every other pack on the store. You get the full source, the editing contracts and the agent instructions.

## More in Toggle

- [Step Flow: Neon Markers](https://agentframes.ai/elements/toggle/step-flow.md): Two to five steps in order. Each step gets a glowing outline marker (square, triangle, capsule, circle) that spins a quarter turn into place; the accent dot runs the path, drawing the connector ahead of it, and each marker lights with its number as the dot arrives.
- [Cycle: The Dot Switches Each Stage On](https://agentframes.ai/elements/toggle/cycle-loop.md): A loop of three to six stages. Each stage is a toggle switch on a dotted track; the dot laps the loop once, the track lights behind it and every stage switches on as the dot reaches it, then the centre word types on.
- [Hub and Spoke: Out of the Disc](https://agentframes.ai/elements/toggle/hub-spoke.md): One idea and what it connects to. An accent disc lands in the middle with the idea typed inside it, then three to six pills fly out of it to their places with the spokes drawing after them.
- [Decision: The Dot Splits, One Switch Flips](https://agentframes.ai/elements/toggle/decision-branch.md): A yes/no question and its two outcomes. The dot drops from the question and squashes on the fork, splits in two and runs down both branches to two switches; the outcomes rise under them, then the recommended switch flips on and the other dims.

## Community

Coming soon.
