Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion src/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { NetworkPolicy } from './sdk/network-policy';
import { GatewayConfig } from './sdk/gateway-config';
import { McpConfig } from './sdk/mcp-config';
import { Scenario } from './sdk/scenario';
import { ScenarioBuilder } from './sdk/scenario-builder';
import { Secret } from './sdk/secret';

// Import types used in this file
Expand Down Expand Up @@ -1923,7 +1924,8 @@ export class McpConfigOps {
*
* ## Quickstart
*
* Use `fromId()` to get a {@link Scenario} by ID, or `list()` to retrieve all scenarios.
* Use `fromId()` to get a {@link Scenario} by ID, `list()` to retrieve all scenarios,
* or `builder()` to construct a new scenario with a fluent API.
* Once you have a scenario, call `scenario.run()` to start a {@link ScenarioRun} with
* your agent mounted.
*
Expand Down Expand Up @@ -1967,6 +1969,26 @@ export class ScenarioOps {
*/
constructor(private client: RunloopAPI) {}

/**
* Create a new {@link ScenarioBuilder} for constructing a scenario with a fluent API.
*
* @example
* ```typescript
* const runloop = new RunloopSDK();
* const scenario = await runloop.scenario
* .builder('my-scenario')
* .withProblemStatement('Fix the bug in main.py')
* .addTestCommandScorer('tests', { test_command: 'pytest' })
* .push();
* ```
*
* @param {string} name - Name for the scenario
* @returns {ScenarioBuilder} A {@link ScenarioBuilder} instance
*/
builder(name: string): ScenarioBuilder {
return new ScenarioBuilder(name, this.client);
}

/**
* Get a scenario object by its ID.
*
Expand Down
1 change: 1 addition & 0 deletions src/sdk/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ export { McpConfig } from './mcp-config';
export { Secret } from './secret';
export { ScenarioRun } from './scenario-run';
export { Scenario, type ScenarioRunParams } from './scenario';
export { ScenarioBuilder } from './scenario-builder';
Loading
Loading