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

# OuterProductClient

> An authenticated client for OuterProduct resources.

```python theme={null}
class OuterProductClient
```

The runtime passes each function a client scoped to its Attempt, whose
`run` creates child Calls in the current Run instead of new Runs.

```python theme={null}
OuterProductClient(api_key: str, base_url: str = 'https://api.outerproduct.com')
```

```python theme={null}
base_url
call_id: str | None
attempt: int | None
```

## `run_id`

<sub>property</sub>

```python theme={null}
run_id: UUID | None
```

The Run this client is scoped to, or None outside a Run.

## `me`

<sub>method</sub>

```python theme={null}
async def me() -> UserInfo
```

Fetch the authenticated user's profile and native user ID.

## `create_secret`

<sub>method</sub>

```python theme={null}
def create_secret(
    name: str,
    value: SecretValue,
    *,
    comment: str | None = None,
) -> Secret
```

Store a typed secret value and return its metadata.

## `get_secret`

<sub>method</sub>

```python theme={null}
def get_secret(name: str) -> Secret
```

Fetch secret metadata without accessing its value.

## `list_secrets`

<sub>method</sub>

```python theme={null}
def list_secrets(*, page_size: int | None = None) -> list[Secret]
```

List accessible secret metadata, following pagination automatically.

## `update_secret`

<sub>method</sub>

```python theme={null}
def update_secret(
    name: str,
    *,
    value: SecretValue | None = None,
    comment: str | None = None,
) -> Secret
```

Update a secret; omitting its value preserves the current version.

## `delete_secret`

<sub>method</sub>

```python theme={null}
def delete_secret(name: str) -> None
```

Delete a secret and its stored value.

## `access_secret`

<sub>method</sub>

```python theme={null}
def access_secret(name: str) -> AccessSecretResponse
```

Access a secret's stored value and version with read permission.

## `create_volume`

<sub>method</sub>

```python theme={null}
def create_volume(
    name: str,
    *,
    provider: VolumeProvider | None = None,
    description: str = '',
) -> VolumeHandle
```

Create a Volume, using OuterProduct storage by default.

## `get_volume`

<sub>method</sub>

```python theme={null}
def get_volume(name: str) -> VolumeHandle
```

Fetch a volume and open read access to its storage.

## `list_nodes`

<sub>method</sub>

```python theme={null}
def list_nodes() -> list[Node]
```

List the nodes that can run Calls now.

## `list_volumes`

<sub>method</sub>

```python theme={null}
def list_volumes(*, page_size: int | None = None) -> list[Volume]
```

List all accessible volumes, following pagination automatically.

## `update_volume`

<sub>method</sub>

```python theme={null}
def update_volume(
    name: str | Volume | VolumeHandle,
    *,
    new_name: str | None = None,
    description: str | None = None,
) -> Volume
```

Rename a volume or update its description without changing its identity.

## `delete_volume`

<sub>method</sub>

```python theme={null}
def delete_volume(name: str | Volume | VolumeHandle) -> None
```

Delete the volume, and the files of an OuterProduct-managed one;
external storage keeps its files.

## `generate_temporary_volume_credentials`

<sub>method</sub>

```python theme={null}
def generate_temporary_volume_credentials(
    volume_name: str,
    *,
    read_only: bool = True,
) -> tuple[int, dict[str, str]]
```

Vend volume credentials and their expiration in Unix milliseconds.

## `run`

<sub>method</sub>

```python theme={null}
def run(
    *,
    fn: Callable[..., _Result | Awaitable[_Result]],
    name: str | None = None,
    args: tuple[object, ...] = (),
    kwargs: Mapping[str, object] | None = None,
    image: Image,
    cpu: int = 1,
    memory_bytes: int | None = None,
    gpu: int | None = None,
    gpu_type: str | None = None,
    volumes: Mapping[str, VolumeHandle | str] | None = None,
    env_vars: Mapping[str, str | Secret] | None = None,
    retry_strategy: RetryStrategy | None = None,
    port: int | None = None,
    timeout: float | None = None,
) -> Run[_Result] | Call[_Result]
```

Start `fn` without waiting and return its handle.

Outside a Run this creates a Run; a client scoped to an Attempt creates
a child Call of it instead. `memory_bytes` defaults to 2 GiB per CPU,
`gpu` to one when `gpu_type` is set, and `retry_strategy` to three
attempts. `env_vars` values are
literals or stored Secrets. `name` labels the Run or child Call.
`port` is a port `fn` serves while it runs, which its URL
(`Run.get_url`, or `Call.get_url` for a child Call) serves to
anyone. `timeout` is how many seconds each Attempt may run, up to 24
hours, the default. Volume mounts stop working an hour after an Attempt
starts, so `run` warns when it mounts volumes without a `timeout` of
an hour or less.

Each Attempt imports `fn` by name from a file mount of its top-level
package, or else its module's file, so `fn` must be
defined at module level, and its module must not call `run` when
imported. A Run also publishes the local files of every
module-level Image in `fn`'s module, which its Attempts then submit
child Calls with by name; other Images upload their local files when
submitted. Children from the current source package reuse its published
snapshot. Volumes accept VolumeHandle objects, volume names, or UUIDs.

## `create_sandbox`

<sub>method</sub>

```python theme={null}
def create_sandbox(
    *,
    image: Image,
    name: str | None = None,
    args: Iterable[str] = ('sleep', 'infinity'),
    cpu: int = 1,
    memory_bytes: int | None = None,
    gpu: int | None = None,
    gpu_type: str | None = None,
    volumes: Mapping[str, VolumeHandle | str] | None = None,
    env: Mapping[str, str] | None = None,
    timeout: float | None = None,
    labels: Mapping[str, str] | None = None,
    port: int | None = None,
) -> Sandbox
```

Start a sandbox running `args` in `image`, once it runs.

It lives until terminated, or for `timeout` seconds. `name`, such
as `"dev"`, must be unique in the deployment; without one, the sandbox
is named for its id. `memory_bytes` defaults to 2 GiB per CPU, and
`gpu` to one when `gpu_type` is set. Volumes accept VolumeHandle
objects, volume names, or UUIDs. With `port`, the sandbox's `url`
serves that port to anyone, and it runs once the port answers.

## `get_sandbox`

<sub>method</sub>

```python theme={null}
def get_sandbox(name: str) -> Sandbox
```

## `list_sandboxes`

<sub>method</sub>

```python theme={null}
def list_sandboxes() -> list[Sandbox]
```

## `map`

<sub>method</sub>

```python theme={null}
def map(
    fn: Callable[..., _Result | Awaitable[_Result]],
    inputs: Iterable[object],
    *additional_inputs: Iterable[object] = (),
    image: Image,
    name: str | None = None,
    cpu: int = 1,
    memory_bytes: int | None = None,
    gpu: int | None = None,
    gpu_type: str | None = None,
    volumes: Mapping[str, VolumeHandle | str] | None = None,
    env_vars: Mapping[str, str | Secret] | None = None,
    retry_strategy: RetryStrategy | None = None,
    timeout: float | None = None,
) -> AsyncGenerator[_Result, None]
```

Run `fn` concurrently and yield results in input order.

Input iterables supply positional arguments, paired by position until
the shortest iterable ends.

First iteration submits every paired invocation before yielding.
Outside a Run these are independent Runs; inside
an Attempt they are child Calls. Terminal failures raise when their
input is reached. Closing the iterator leaves submitted work running,
subject to the Attempt's usual child cleanup. `name` is a shared
display label for every submitted Run or Call, and `timeout` applies
to each, as in `run`.

## `close`

<sub>method</sub>

```python theme={null}
async def close() -> None
```

Cancel this Attempt's child Calls still running.

## `get_run`

<sub>method</sub>

```python theme={null}
def get_run(id: str) -> Run[object]
```

Get one Run available to this user.

## `list_runs`

<sub>method</sub>

```python theme={null}
def list_runs(*, page_size: int | None = None) -> builtins.list[Run[object]]
```

List Runs available to this user.

## `cancel_run`

<sub>method</sub>

```python theme={null}
def cancel_run(id: str) -> Run[object]
```

Request cancellation of one active Run available to this user.

## `get_call`

<sub>method</sub>

```python theme={null}
async def get_call(name: str) -> Call[object]
```

Get one Call by canonical resource name.

## `list_calls`

<sub>method</sub>

```python theme={null}
async def list_calls(
    run: str | Run[object],
    *,
    page_size: int | None = None,
    parent_call: str | Call[object] | None = None,
) -> builtins.list[Call[object]]
```

List Calls in a Run, optionally restricted to direct children.

## `cancel_call`

<sub>method</sub>

```python theme={null}
async def cancel_call(name: str) -> Call[object]
```

Request cancellation of one Call and unfinished descendants.

## `get_attempt`

<sub>method</sub>

```python theme={null}
async def get_attempt(name: str) -> Attempt[object]
```

Get one Attempt by canonical resource name.

## `list_attempts`

<sub>method</sub>

```python theme={null}
async def list_attempts(
    call: str | Call[object],
    *,
    page_size: int | None = None,
) -> builtins.list[Attempt[object]]
```

List the dispatch Attempts of one Call.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.