Skip to main content

Overview

State machines can also be created using the CSV interface. See CSV Overview.

What Is a State Machine?

In MTP, a state machine is a simplified protocol that maps inputs to one of several predefined states instead of generating open-ended text. This is useful when your model should select from a fixed set of outcomes (for example, intent labels or routing states).

State machine protocols:

  • Use a single instruction that chooses between predefined states
  • Do not use final tokens (the final is always <NON>)
  • Do not allow numeric outputs

Enabling State Machines

State machines are disabled by default. Enable them when creating your protocol:

protocol = mtp.Protocol(
name="my_state_machine",
inputs=1,
encrypt=True,
state_machine=True
)

All CSV protocols are state machines.

Where States Are Stored

When state_machine=True, the template includes:

  • state_machine: set to true
  • states: a list of state strings derived from the StateMachineInstruction samples

See Template for the fields in the template and how they are structured.

Next Steps