3.3.5. Managing Variables
💡 First Principle: Variables are the conversation's memory, and scope is a blast radius: a topic variable lives and dies with its topic; a global variable persists across the whole conversation; system variables are the platform narrating context. Choose the smallest scope that works and widen only on demonstrated need.
| Scope | Lifetime | Set by | Reach |
|---|---|---|---|
| Topic (default) | Its topic's execution | Question nodes, tool outputs, Power Fx | That topic only |
| Global | The whole conversation | Marked global by the maker | Every topic; readable everywhere |
| System | Platform-managed | The platform | Conversation context: user, channel, last message |
Mechanics worth exam-grade precision: Question nodes and tool outputs create topic variables; a variable's properties panel is where it's promoted to global; Power Fx expressions read and transform variables anywhere formulas are accepted (conditions, messages, set-variable nodes) — the candidate-profile skill surfacing in-product. Movement between contexts is explicit: topics pass values through redirect input/output wiring; flows receive and return them as parameters (3.2.3); connected agents exchange them where supported (2.3.2). Global variables can even be seeded from outside the conversation (e.g., set by the hosting page), which is how a website hands the agent a logged-in user's context.
⚠️ Common Misconception: Variables are shared across all topics by default. Default scope is the topic; cross-topic visibility is an explicit act — promote to global or pass through redirect parameters. "Why is the variable empty in the second topic?" is this misconception wearing a debugging costume.
⚠️ Exam Trap: When a value must survive from one topic into another and the second topic can be reached without the first (orchestrator routing), global scope is the reliable answer — redirect parameters only work along an authored redirect path.
Reflection Question: The user's account number is collected in the greeting topic and needed in four others, reachable in any order. Scope decision, mechanism, and one risk that the widest scope introduces — go.