Python SDK
Python scenarios
Create reusable scenarios and seed twin runs with the Python SDK
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Create reusable scenarios and seed twin runs with the Python SDK
scenario = client.scenarios.create(
name="E-commerce checkout",
prompt="A Stripe account with 3 customers on different plans",
description="For testing checkout flows", # optional
tags=["checkout", "stripe"], # optional
)
scenario = client.scenarios.create(
name="Support channel",
twins=["slack"],
seed_config={
"slack": {
"channels": [{"name": "support", "messages": ["Help needed"]}]
}
},
)
# All scenarios
scenarios = client.scenarios.list()
# Filter by twin or tag
scenarios = client.scenarios.list(twin="stripe")
scenarios = client.scenarios.list(tag="checkout")
scenario = client.scenarios.get("scenario-id")
print(scenario.name, scenario.twins, scenario.seed_config)
result = client.twins.provision(
twins=["stripe", "slack"],
scenario_id="scenario-id",
)
run_id = result["run_id"]
status = client.twins.get_status(run_id)
if status.status == "ready":
for name, twin in status.twins.items():
print(f"{name}: {twin.base_url}")
print(f" Admin: {twin.admin_url}")
print(f" Env vars: {twin.env_vars}")
environment = client.scenarios.ensure_twin_environment(
"scenario-id",
twins=["stripe", "slack"],
public=True,
)
environment = client.scenarios.get_twin_environment("scenario-id")
environment = client.scenarios.reseed_twin_environment("scenario-id")
environments = client.scenarios.list_twin_environments()
environment = client.scenarios.delete_twin_environment("scenario-id")
