|
| 1 | +# Create a New Test Flow |
| 2 | + |
| 3 | +Create a new YAML test flow for LLM compliance testing. |
| 4 | + |
| 5 | +## Usage |
| 6 | +``` |
| 7 | +/create-flow <flow_name> |
| 8 | +``` |
| 9 | + |
| 10 | +## Instructions |
| 11 | + |
| 12 | +Create a new flow spec file at `src/backend/tests/integration/flows/$ARGUMENTS.yml`. |
| 13 | + |
| 14 | +### Template |
| 15 | + |
| 16 | +```yaml |
| 17 | +name: $ARGUMENTS |
| 18 | +description: | |
| 19 | + [DESCRIBE: What this flow tests and why it matters] |
| 20 | +
|
| 21 | +version: "1.0" |
| 22 | + |
| 23 | +context: |
| 24 | + goal: "[DESCRIBE: The project goal for this test scenario]" |
| 25 | + project_type: "ma_due_diligence" |
| 26 | + |
| 27 | +session: |
| 28 | + project_id: test-$ARGUMENTS |
| 29 | + |
| 30 | +steps: |
| 31 | + - name: initial_step |
| 32 | + description: "[DESCRIBE: What this step does]" |
| 33 | + user_says: "[USER MESSAGE: What the user sends]" |
| 34 | + expect: |
| 35 | + phase: goal_understanding |
| 36 | + event: CUSTOM |
| 37 | + event_name: clara:ask |
| 38 | + cards: |
| 39 | + must_include_types: |
| 40 | + - stepper |
| 41 | + - snapshot |
| 42 | + |
| 43 | + # Add more steps as needed... |
| 44 | + |
| 45 | +assertions: |
| 46 | + - name: primary_assertion |
| 47 | + description: "[DESCRIBE: What we're validating]" |
| 48 | + critical: true |
| 49 | + check: | |
| 50 | + # Python validation code |
| 51 | + pass |
| 52 | +
|
| 53 | +compliance_notes: | |
| 54 | + If this flow fails: |
| 55 | + 1. Check the relevant prompt file |
| 56 | + 2. Verify the LLM outputs correct card types |
| 57 | + 3. Review the event trace for debugging |
| 58 | +
|
| 59 | +failure_actions: |
| 60 | + - action: show_event_trace |
| 61 | + description: "Display the actual event for debugging" |
| 62 | +``` |
| 63 | +
|
| 64 | +### Steps to Complete |
| 65 | +
|
| 66 | +1. Create the file with the template above |
| 67 | +2. Replace all `[PLACEHOLDERS]` with actual values |
| 68 | +3. Add the appropriate steps for this flow |
| 69 | +4. Define expectations for each step using: |
| 70 | + - `phase`: Expected phase (goal_understanding, agent_configuration, blueprint_design) |
| 71 | + - `event`: Event type (CUSTOM, TEXT_MESSAGE_START, etc.) |
| 72 | + - `event_name`: For CUSTOM events (clara:ask, clara:confirm, etc.) |
| 73 | + - `cards.must_include_types`: List of required card types |
| 74 | + - `cards.must_include`: Detailed card requirements with body validation |
| 75 | + - `cards.stepper_current_step_contains`: Text in active stepper step |
| 76 | + |
| 77 | +### Available Card Types |
| 78 | +- `stepper` - Progress indicator |
| 79 | +- `snapshot` - Project snapshot |
| 80 | +- `domain_setup` - Domain configuration |
| 81 | +- `personas` - Persona selection |
| 82 | +- `info` - General information |
| 83 | +- `agent_configured` - Agent configuration complete |
| 84 | + |
| 85 | +### Verify the Flow |
| 86 | + |
| 87 | +```bash |
| 88 | +cd src/backend |
| 89 | +
|
| 90 | +# Check it appears in the list |
| 91 | +uv run python -m clara.testing.flow_runner --list |
| 92 | +
|
| 93 | +# Run the flow (requires backend running) |
| 94 | +uv run python -m clara.testing.flow_runner $ARGUMENTS |
| 95 | +``` |
| 96 | + |
| 97 | +### Example Flows to Reference |
| 98 | +- `personas_step.yml` - Tests persona card type compliance |
0 commit comments