@runloop/api-client - v1.4.0
    Preparing search index...

    Class ScenarioOps

    Scenario SDK interface for managing scenarios.

    The ScenarioOps class provides a high-level abstraction for managing scenarios.

    Use fromId() to get a Scenario by ID, or list() to retrieve all scenarios. Once you have a scenario, call scenario.run() to start a ScenarioRun with your agent mounted.

    This interface is accessed via RunloopSDK.scenario. You should construct a RunloopSDK instance and use it from there:

    const runloop = new RunloopSDK();
    const scenario = runloop.scenario.fromId('scn_123');

    // Get scenario details
    const info = await scenario.getInfo();
    console.log(info.name);

    // Start a run with agent mounted and wait for the devbox to be ready
    const run = await scenario.run({
    run_name: 'my-run',
    runProfile: {
    mounts: [{
    type: 'agent_mount',
    agent_id: 'agt_123',
    agent_name: null,
    agent_path: '/home/user/agent',
    }],
    },
    });

    // Execute your agent on the devbox
    await run.devbox.cmd.exec('python /home/user/agent/main.py');

    // Score and complete
    await run.scoreAndComplete();
    Index

    Methods

    Methods

    • Get a scenario object by its ID.

      Parameters

      • id: string

        The ID of the scenario

      Returns RunloopSDK.Scenario

      A Scenario instance

      const runloop = new RunloopSDK();
      const scenario = runloop.scenario.fromId('scn_123');
      const info = await scenario.getInfo();
      console.log(info.name);
    • List scenarios with optional filters (paginated).

      Parameters

      • Optionalparams: ScenarioListParams

        Optional filter parameters

      • Optionaloptions: RequestOptions<unknown>

        Request options

      Returns Promise<RunloopSDK.Scenario[]>

      An array of Scenario instances

      const runloop = new RunloopSDK();
      const scenarios = await runloop.scenario.list({ limit: 10 });
      console.log(scenarios.map((s) => s.id));