Lesson 4 / 26
The Start Node: Inputs and State Variables
Define what a run receives and what it remembers.
Typed inputs, explicit state
A workflow begins at a start node that defines the inputs for a run (typically the user's message, sometimes extra variables such as a customer ID or language) and the state variables the workflow will keep. Define them explicitly with sensible types and defaults. Avoid stuffing everything into one free-text message: a separate customer_tier or locale variable is easier to route on, test and log than something an agent has to infer from text. Product details such as node names and menus change; check the current OpenAI documentation.
Start, agent, tools, end
Most workflows combine a start node with inputs, agent nodes, tools and an end node with a defined output.
An input and state design
Name and type everything that routing depends on.
inputs:
input_as_text: string # the user message
customer_id: string # from your app, not from the user
locale: string = "en"
state:
category: "billing" | "technical" | "other" | null
attempts: number = 0
approved: boolean | nullPass identity from your app
Supply user or customer IDs from your authenticated backend, never from the chat text, so a user cannot claim to be someone else.
Quick check: Why define routing-relevant values as explicit variables?
- Variables make the model larger
- They are easier to route on, test and log than values inferred from text
- Agents cannot read text
- It removes the need for an end node
Answer
They are easier to route on, test and log than values inferred from text — Explicit state beats guessing.