> ## Documentation Index
> Fetch the complete documentation index at: https://docs.argalabs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# TypeScript scenarios

> Create reusable scenarios and seed twin runs with the TypeScript SDK

## Create a scenario

Create with a natural language prompt. Arga generates the seed config.

```typescript theme={null}
const scenario = await 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
});
```

Or create with an explicit seed config:

```typescript theme={null}
const scenario = await client.scenarios.create({
  name: 'Support channel',
  twins: ['slack'],
  seedConfig: {
    slack: {
      channels: [{ name: 'support', messages: ['Help needed'] }],
    },
  },
});
```

## List scenarios

```typescript theme={null}
// All scenarios
const scenarios = await client.scenarios.list();

// Filter by twin or tag
const stripeScenarios = await client.scenarios.list({ twin: 'stripe' });
const checkoutScenarios = await client.scenarios.list({ tag: 'checkout' });
```

## Get a scenario

```typescript theme={null}
const scenario = await client.scenarios.get('scenario-id');
console.log(scenario.name, scenario.twins, scenario.seedConfig);
```

## Use a scenario when provisioning twins

Use a saved scenario to seed a short-lived twin session:

```typescript theme={null}
const { runId } = await client.twins.provision({
  twins: ['stripe', 'slack'],
  scenarioId: 'scenario-id',
});

const status = await client.twins.getStatus(runId);
if (status.status === 'ready') {
  for (const [name, twin] of Object.entries(status.twins)) {
    console.log(`${name}: ${twin.baseUrl}`);
    console.log(`  Admin: ${twin.adminUrl}`);
    console.log(`  Env vars:`, twin.envVars);
  }
}
```

<Note>
  The current TypeScript SDK exposes scenario CRUD plus seeded twin provisioning through `client.twins.provision({ scenarioId: ... })`. Long-lived per-scenario twin environment helpers are not part of the current SDK surface.
</Note>
