v1.0.1
Core Conceptsv1.0.1

Behavioral States

Defining and configuring discrete behavioral states in BehaviorSim.

A State in BehaviorSim represents a discrete behavioral status of an agent.

The State Class

The behaviorsim.State dataclass requires a unique name and accepts an optional human-readable description:

states.py
from behaviorsim import State

active_state = State(
    name="ActiveSession",
    description="Agent is actively performing transactions"
)
idle_state = State(
    name="Idle",
    description="Agent is passive or awaiting notification"
)

State Lifecycle & Absorbing States

States can be transient or absorbing:

  • Transient States: States where outgoing transition probabilities sum to 1 across other states.
  • Absorbing States: States such as Discharged or Churned where transition to self equals 1.0. Once reached, the agent remains in this state for remaining steps.

Example: Custom States

custom_states.py
from behaviorsim import State, Simulator

states = [
    State("Exploring"),
    State("Comparing"),
    State("Purchased"),
    State("Exited")
]

# Initialize simulator with custom state list
sim = Simulator(states=states)