Skip to main content

init Command

Initialize local FluxLoop scenarios and test templates.

Subcommands

init scenario

Initialize a new local scenario folder structure. This is the starting point for testing a specific agent behavior locally.

Usage

fluxloop init scenario [NAME] [OPTIONS]

Arguments

ArgumentDescription
nameName of the scenario (creates .fluxloop/scenarios/{name}/)

Options

OptionDescriptionDefault
--link <id>Link to an existing Web Scenario IDNone
--create-remoteAlso create the Scenario on the Web Platformfalse
--force, -fOverwrite existing filesfalse

Examples

# Create a new local scenario
fluxloop init scenario my-chatbot

# Create and link to a web scenario
fluxloop init scenario onboarding-flow --link sc_12345

# Create local and remote scenarios simultaneously
fluxloop init scenario search-test --create-remote

What Gets Created

.fluxloop/scenarios/my-chatbot/
├── configs/
│ ├── scenario.yaml # Scenario metadata
│ ├── input.yaml # Personas and input settings
│ └── simulation.yaml # Runner and experiment config
├── agents/ # Agent wrapper code
├── inputs/ # Local input data
├── experiments/ # Local test results
└── .env # Scenario-specific environment variables

init pytest-template

Scaffold a pytest test file that uses FluxLoop's test fixtures. This allows you to integrate FluxLoop into your existing CI/CD or automated testing suite.

Usage

fluxloop init pytest-template [SCENARIO_ROOT] [OPTIONS]

Arguments

ArgumentDescriptionDefault
scenario_rootPath containing the scenario's configs/Current directory

Options

OptionDescriptionDefault
--tests-dirDirectory for tests (relative to root)tests
--filenameTest file name to createtest_fluxloop_smoke.py
--forceOverwrite existing templatefalse

Examples

# Create test in default location (./tests/test_fluxloop_smoke.py)
fluxloop init pytest-template

# Custom test directory and filename
fluxloop init pytest-template --tests-dir integration_tests --filename test_agent_e2e.py

Generated Test Template

The command creates a pytest file that demonstrates how to use the fluxloop_runner fixture:

import pytest
from fluxloop_cli.testing.pytest_plugin import fluxloop_runner

def test_fluxloop_smoke(fluxloop_runner):
"""Smoke test: verify agent runs without errors."""
result = fluxloop_runner(
config_path="configs/simulation.yaml",
iterations=1,
input_text="Hello, test!"
)

# Assertions on result
assert result.success_rate > 0.8
assert result.total_runs >= 1