JOVANA
Explore Library Glossary Getting Started Three Levels Fields How it works Mission
Join the mission
All guides

Beyond One Prompt: Trees, Chains, and Roles

Branch and explore with tree-of-thought, split work across linked prompts, and steer behaviour by assigning a role.

From a line of thought to a tree

Chain-of-thought walks one path. But some problems — puzzles, planning, search — need you to try a branch, judge it, and back up if it's a dead end. Tree-of-thought (ToT) prompting generalises chain-of-thought into a branching search: at each step the model proposes several possible next thoughts, evaluates how promising each is, and explores the best ones, abandoning weak branches.

  1. Generate: ask the model for several distinct candidate next steps, not just one.
  2. Evaluate: have the model score or rank each candidate's promise toward the goal.
  3. Expand: keep the top branches and repeat; prune the rest to keep the search affordable.
Tree-of-thought explores like a search tree: generate candidate thoughts, score them, expand the best branches, and back out of dead ends.

An interactive search tree branching from a root node, with nodes scored and the strongest branches expanded.

Prompt chaining: many small prompts beat one giant one

Instead of cramming an entire workflow into one mega-prompt, prompt chaining splits it into a sequence of focused prompts where each step's output feeds the next. Extract the facts, then summarise them, then draft an email from the summary — three clean stages instead of one tangled instruction.

Chaining is the practical cousin of least-to-most reasoning: both decompose work into stages, but chaining wires them as separate calls you control in code, so you can validate, retry, or branch between steps. Each step is simpler to write, easier to debug, and cheaper to fix when it breaks.

Step 1 prompt: Extract every date, name, and amount from the contract. Return JSON.
Step 2 prompt: Given this JSON, list any obligations due within 30 days.
Step 3 prompt: Write a one-paragraph reminder email for those obligations.
A three-link chain. Each prompt does one job; outputs flow forward.

Chaining is also the bridge to agents. Once a model's output decides which prompt runs next — or which tool to call — you have stepped from a fixed chain toward an LLM agent. The prompting skills here are exactly what makes those systems controllable.

Once a model's output decides which prompt or tool runs next, a fixed chain turns into an agent's reason–act–observe loop.

An LLM agent loop cycling through reason, act, and observe steps.

Role prompting: who should the model be?

Role prompting asks the model to answer as a particular persona — 'You are a patient maths tutor', 'You are a senior security reviewer'. A well-chosen role shifts vocabulary, depth, and what the model emphasises, often more cleanly than a paragraph of fiddly instructions. A 'careful editor' naturally fixes grammar without rewriting; a 'curious five-year-old' naturally asks simple questions.

Roles are most durable when placed in the system prompt, so the persona holds across the whole conversation rather than being restated each turn. Be honest about the limits, though: a role labelled 'expert doctor' makes the model sound more authoritative, not actually more correct. Use roles to shape tone and framing, not to manufacture trust you haven't verified.

Composing the toolkit

These techniques are building blocks, not rivals. A robust pipeline might assign a role in the system prompt, chain several steps, run a self-consistency vote on the one step that matters most, and reserve tree-of-thought for a genuinely hard search inside a single step. Reach for the lightest tool that solves the problem, and add structure only where simpler prompting falls short.