> This page is for version 0.7.0.
> For other versions, use one of these documentation indexes:
> - Main (default): https://docs.nvidia.com/nemo/gym/main/llms.txt
> - 0.7.0: https://docs.nvidia.com/nemo/gym/v0.7.0/llms.txt
> - 0.6.0: https://docs.nvidia.com/nemo/gym/v0.6.0/llms.txt
> - 0.5.1: https://docs.nvidia.com/nemo/gym/v0.5.1/llms.txt
> - 0.5.0: https://docs.nvidia.com/nemo/gym/v0.5.0/llms.txt
> - 0.4.0: https://docs.nvidia.com/nemo/gym/v0.4.0/llms.txt
> - 0.3.0: https://docs.nvidia.com/nemo/gym/v0.3.0/llms.txt
> - 0.2.1: https://docs.nvidia.com/nemo/gym/v0.2.1/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/nemo/gym/llms.txt.

# nemo_gym.web.operation_runner

Execution strategies for synchronous web-environment backends.

## Module Contents

### Classes

| Name                                                                                              | Description                                                             |
| ------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------- |
| [`DirectWebOperationRunner`](#nemo_gym-web-operation_runner-DirectWebOperationRunner)             | Run inexpensive or natively asynchronous-safe backend calls inline.     |
| [`ThreadAffineWebOperationRunner`](#nemo_gym-web-operation_runner-ThreadAffineWebOperationRunner) | Run every operation on one dedicated thread.                            |
| [`WebOperationRunner`](#nemo_gym-web-operation_runner-WebOperationRunner)                         | Run synchronous backend operations without prescribing a browser stack. |

### API

```python
class nemo_gym.web.operation_runner.DirectWebOperationRunner()
```

Run inexpensive or natively asynchronous-safe backend calls inline.

```python
nemo_gym.web.operation_runner.DirectWebOperationRunner.close() -> None
```

async

```python
nemo_gym.web.operation_runner.DirectWebOperationRunner.run(
    operation: typing.Callable[..., typing.Any],
    args: typing.Any = ()
) -> typing.Any
```

async

```python
class nemo_gym.web.operation_runner.ThreadAffineWebOperationRunner(
    thread_name_prefix: str = 'web-runtime',
    finalizer: typing.Callable[[], typing.Any] | None = None
)
```

Run every operation on one dedicated thread.

Playwright's synchronous API is greenlet- and thread-affine. The dedicated
thread keeps those calls off the FastAPI event loop. It is not the browser
isolation boundary: headed desktop-control runtimes still scale as one
resources-server process or container per DISPLAY.

**`_executor`**

---

```python
nemo_gym.web.operation_runner.ThreadAffineWebOperationRunner.close() -> None
```

async

```python
nemo_gym.web.operation_runner.ThreadAffineWebOperationRunner.run(
    operation: typing.Callable[..., typing.Any],
    args: typing.Any = ()
) -> typing.Any
```

async

```python
class nemo_gym.web.operation_runner.WebOperationRunner()
```

Protocol

Run synchronous backend operations without prescribing a browser stack.

```python
nemo_gym.web.operation_runner.WebOperationRunner.close() -> None
```

async

```python
nemo_gym.web.operation_runner.WebOperationRunner.run(
    operation: typing.Callable[..., typing.Any],
    args: typing.Any = ()
) -> typing.Any
```

async