Pathways.success_condition()

Define what indicates successful completion of the current state.

Usage

Source

Pathways.success_condition(condition)

Use to specify when the state’s objectives are met and it’s ready to transition. More specific than just completing .required() items. Can be used in any order within the state configuration.

Parameters

condition: str
Specific, observable condition indicating the state succeeded. Use action-oriented language that the LLM can recognize.

Returns

Pathways
Self for method chaining, allowing combination with other pathway building methods to create comprehensive conversation flows.

Integration Notes

  • Completion Clarity: more specific than just completing .required() items
  • Observable Criteria: should be observable/confirmable in conversation
  • Active Voice: use active voice like "user confirms..." not "user understanding confirmed"
  • Multiple Conditions: can have multiple success conditions for complex states
  • Progression Control: prevents premature progression and ensures thorough coverage
  • Objective Definition: specifies when the state’s objectives are met and ready to transition

The .success_condition() method ensures the LLM knows exactly when each step is truly complete, preventing premature progression and ensuring thorough coverage.

Examples

Complete pathway showing .success_condition() defining clear completion criteria:

import talk_box as tb

# Creating a learning assessment pathway
pathway = (
    tb.Pathways(
        title="Skill Assessment",
        desc="evaluate student understanding and provide targeted feedback",
        activation="student completes a learning module"
    )
    # === STATE: practice ===
    .state("practice: present practice problems")
    .required(["problems are attempted", "student provided responses"])

    # .success_condition() defines when understanding is demonstrated ---
    .success_condition("student correctly solves at least 3 out of 5 problems")

    .next_state("feedback")
    # === STATE: feedback ===
    .state("feedback: provide personalized feedback")
    .required(["specific feedback", "improvement areas"])

    # .success_condition() ensures feedback is constructive ---
    .success_condition("student understands their mistakes and next steps")

    .next_state("advanced_practice")
    # === STATE: advanced_practice ===
    .state("advanced practice: offer advanced challenges")
    .required("challenging problems are presented")
    .optional("hints if needed")

    # .success_condition() confirms mastery ---
    .success_condition("student demonstrates confident problem-solving ability")
)

# See how success conditions guide the learning process
print(pathway)