stateweave Docs
Guides

Scenarios

A scenario is a company your agent works in: people, customers, a few weeks of history, and the data each app holds. You describe it in a few sentences and StateWeave writes the rest.

Create a scenario

In your workspace, click New scenario, pick the apps and describe the company. Or from a shell:

sw env new --apps slack,zendesk,shopify \
  --describe "A 40-person online kitchenware store. Support is behind after a carrier lost a week of parcels, and the agent helps the support lead triage tickets and refunds."
import stateweave

client = stateweave.Client()
made = client.create_project(
    "A 40-person online kitchenware store. Support is behind after a carrier lost a week of parcels, "
    "and the agent helps the support lead triage tickets and refunds.",
    apps=["slack", "zendesk", "shopify"],
)
print(made["id"], made["status"])  # generating

sw env new prints the scenario's id at once, then follows the generation step by step and prints what each app holds when it's done. Pass --no-wait to return right after the id.

Write a good description

Say what the company does, how big it is, what is going on right now, and what your agent will be asked to do. The situation is what makes the data useful: a backlog after an outage, a launch next week, a quarter-end push. Every app's data follows from it, so the tickets, orders, deals and messages fit together.

Options

swPythonDescription
--appsappsRequired. Any of slack, gmail, google_calendar, google_sheets, google_drive, salesforce, shopify, zendesk.
--describedescriptionRequired. The company and what the agent will be tested on.
--companycompanyThe company's name. Made up when not given.
--peoplepeopleHow many employees, 2 to 5,000 (your workspace may allow fewer).
--weeksweeksWeeks of history, 1 to 104.
--templatescontent="templates"Write the text from built-in templates instead of with Claude: much faster, plainer text.

Generation

Generation runs in the background and takes a few minutes with Claude writing the text, depending on the apps and the company's size. It first designs the company and plans the story, then fills every app from that one plan, and checks the result. The scenario's page shows each step as it goes.

StatusMeaning
generatingstill going
readyevery app is ready
partialsome apps are ready and some failed; error says why
failedno app is ready

To follow a scenario from Python, read it until its status is no longer generating:

Python
import time

while (project := client.project(made["id"]))["status"] == "generating":
    time.sleep(5)
for app, env in project["envs"].items():
    print(app, env["counts"])

Look at a scenario

Shell
sw env ls
sw env show p-041ba8
Output
p-041ba8  Northstar Goods  (ready)
  google_sheets    stopped  20 spreadsheets, 40 sheets, 527 rows, 170 formulas, 20 named ranges, 5 folders
  google_calendar  stopped  487 events, 28 people, 5 calendars, 34 recurring, 431 meetings, 8 all-day
  shopify          stopped  38 products, 92 variants, 4 collections, 187 customers, 96 orders, 4 draft orders, 8 staff
  salesforce       stopped  18 users, 42 accounts, 99 contacts, 56 opportunities, 236 cases, 34 leads, 40 tasks
  gmail            stopped  8 mailboxes, 576 messages, 426 threads, 62 unread, 8 labels
  zendesk          stopped  240 tickets, 827 comments, 13 agents, 58 end users, 25 organizations, 4 groups
  slack            stopped  35 people, 10 channels, 1279 messages, 133 threads, 16 DMs

In the workspace, a scenario's page lets you start its apps and open each one in a web client modelled on the real app's. That is the quickest way to see what your agent will see. Runs never use these apps: each run gets its own copies.

Change a scenario's data

A generated scenario can take data of your own: a specific email, ticket, order or message your tests need. See Your own data.

Limits

A workspace has daily limits on new scenarios and on the people a scenario may ask for. A request over a limit is refused with HTTP 429 and says which limit it hit.