TypeScript SDK
TypeScript scenarios
Create reusable scenarios and seed twin runs with the TypeScript 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 TypeScript SDK
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
});
const scenario = await client.scenarios.create({
name: 'Support channel',
twins: ['slack'],
seedConfig: {
slack: {
channels: [{ name: 'support', messages: ['Help needed'] }],
},
},
});
// 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' });
const scenario = await client.scenarios.get('scenario-id');
console.log(scenario.name, scenario.twins, scenario.seedConfig);
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);
}
}
const environment = await client.scenarios.ensureTwinEnvironment('scenario-id', {
twins: ['stripe', 'slack'],
public: true,
});
const current = await client.scenarios.getTwinEnvironment('scenario-id');
const reseeded = await client.scenarios.reseedTwinEnvironment('scenario-id');
const environments = await client.scenarios.listTwinEnvironments();
const deleted = await client.scenarios.deleteTwinEnvironment('scenario-id');
