Pathways.next_state()
Define direct transition to the next state.
Usage
Pathways.next_state(state_name)Use for linear progression after state completion. Do not use with type="decision" states (use .branch_on() instead). This creates unconditional forward movement in the pathway.
Parameters
state_name: str-
Name of the state to transition to next. The target state must be defined later in the pathway using
.state().
Returns
Pathways- Self for method chaining, allowing combination with other pathway building methods to create comprehensive conversation flows.
Integration Notes
- Linear Progression: creates unconditional transition after state completion
- Decision State Restriction: cannot be used with
type="decision"states; use.branch_on()instead - Forward Declaration: target state must be defined later with
.state() - Sequential Flow: useful for processes with a clear order
- Unconditional Movement: for conditional logic, use
.branch_on() - Straightforward Routing: creates sequential flows where each step naturally follows the previous
The .next_state() method creates straightforward, sequential flows where each step naturally follows the previous one, which is good for processes with a clear order.
Examples
Complete pathway showing .next_state() creating linear progression:
import talk_box as tb
# Creating a customer onboarding pathway
pathway = (
tb.Pathways(
title="Customer Onboarding",
desc="welcome new customers and set up their accounts",
activation="new customer signs up"
)
# === STATE: welcome ===
.state("welcome: welcome and collect basic information")
.required(["full name", "email", "company name"])
# .next_state() creates smooth linear progression ---
.next_state("account_setup")
# === STATE: account_setup ===
.state("account setup: set up account preferences")
.required(["password is created", "preferences are selected"])
.success_condition("account is fully configured")
# .next_state() continues the sequential flow ---
.next_state("feature_tour")
# === STATE: feature_tour ===
.state("feature tour: provide guided feature tour")
.required("key features are demonstrated")
.success_condition("customer understands main functionality")
# .next_state() leads to final step ---
.next_state("completion")
# === STATE: completion ===
.state("completion: complete onboarding process")
.required(["welcome resources are provided", "next steps are explained"])
.success_condition("customer is ready to use the platform")
)
# See the clear linear progression
print(pathway)