---
sidebar:
  hidden: true
title: roboto.action_runtime.action_input.input_resolver
---
## Module Contents

### ActionInputResolver

```python
class roboto.action_runtime.action_input.input_resolver.ActionInputResolver(
    file_resolver: roboto.action_runtime.action_input.file_resolver.InputFileResolver,
    session_resolver: roboto.action_runtime.action_input.session_resolver.InputSessionResolver,
    topic_resolver: roboto.action_runtime.action_input.topic_resolver.InputTopicResolver,
    file_service: roboto.storage.FileService,
)
```

`from roboto.action_runtime import ActionInputResolver`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/action_runtime/action_input/input_resolver.py#L36-L287)

Service that resolves an invocation's input selectors to the files, sessions, and topics they match.

Roboto runs it while it prepares an invocation, before the action's code starts, and the action reads the result as [`ActionInput`](/docs/reference/python-sdk/roboto/action_runtime/action_input/action_input#roboto.action_runtime.action_input.action_input.ActionInput), from [`get_input()`](/docs/reference/python-sdk/roboto/action_runtime/invocation_context#roboto.action_runtime.invocation_context.InvocationContext.get_input). You can also run it yourself, to see what an [`InvocationInput`](/docs/reference/python-sdk/roboto/domain/actions/invocation_record#roboto.domain.actions.invocation_record.InvocationInput) resolves to while you test an action outside Roboto. Build one with `from_env`.

**Parameters**

- **file_resolver** (`roboto.action_runtime.action_input.file_resolver.InputFileResolver`): [`InputFileResolver`](/docs/reference/python-sdk/roboto/action_runtime/action_input/file_resolver#roboto.action_runtime.action_input.file_resolver.InputFileResolver) that resolves the input's file selectors.
- **session_resolver** (`roboto.action_runtime.action_input.session_resolver.InputSessionResolver`): [`InputSessionResolver`](/docs/reference/python-sdk/roboto/action_runtime/action_input/session_resolver#roboto.action_runtime.action_input.session_resolver.InputSessionResolver) that resolves the input's session selectors.
- **topic_resolver** (`roboto.action_runtime.action_input.topic_resolver.InputTopicResolver`): [`InputTopicResolver`](/docs/reference/python-sdk/roboto/action_runtime/action_input/topic_resolver#roboto.action_runtime.action_input.topic_resolver.InputTopicResolver) that resolves the input's topic selectors.
- **file_service** (`roboto.storage.FileService`): Service that downloads the resolved files when `resolve_input_spec` is called with `download=True`.

#### ActionInputResolver.from_env()

```python
@classmethod
def from_env(
    roboto_client: Optional[roboto.http.RobotoClient] = None,
    roboto_search: Optional[roboto.roboto_search.RobotoSearch] = None,
) -> ActionInputResolver
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/action_runtime/action_input/input_resolver.py#L57-L79)

Build a resolver whose lookups and downloads go through `roboto_client`.

**Parameters**

- **roboto_client** (`Optional[roboto.http.RobotoClient]`): Client to make requests to Roboto with. Defaults to one configured from the environment, by [`from_env()`](/docs/reference/python-sdk/roboto/http/roboto_client#roboto.http.roboto_client.RobotoClient.from_env).
- **roboto_search** (`Optional[roboto.roboto_search.RobotoSearch]`): [`RobotoSearch`](/docs/reference/python-sdk/roboto/roboto_search#roboto.roboto_search.RobotoSearch) that runs the selectors' RoboQL queries, including the queries that look inputs up by name. Defaults to one that sends its queries through `roboto_client`.

**Returns**

- `ActionInputResolver`

#### ActionInputResolver.resolve_input_spec()

```python
def resolve_input_spec(
    input_spec: roboto.domain.actions.InvocationInput,
    download: bool = False,
    download_path: Optional[pathlib.Path] = None,
) -> roboto.action_runtime.action_input.action_input.ActionInputRecord
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/action_runtime/action_input/input_resolver.py#L93-L197)

Fetch the records that an input's file, session, and topic selectors match.

Each file, session, and topic appears once, even when several selectors match it. When the input selects files, sessions, or topics and none match, that kind comes back empty, with a logged warning rather than an exception.

With `download=True`, each file is saved to `<download_path>/<file_id>/<version>/<file_name>`, and a file already at that path with the stored file's size is not downloaded again. A link is saved under its own ID and version, with the contents of its target. Only files are downloaded: when topics or sessions also match, a warning says to read their data from the action's code.

**Parameters**

- **input_spec** (`roboto.domain.actions.InvocationInput`): Input whose selectors to resolve.
- **download** (`bool`): Whether to download the resolved files.
- **download_path** (`Optional[pathlib.Path]`): Directory to download the files to. `None` creates a temporary directory. Ignored when `download` is `False`.

**Returns**

- `roboto.action_runtime.action_input.action_input.ActionInputRecord`: [`ActionInputRecord`](/docs/reference/python-sdk/roboto/action_runtime/action_input/action_input#roboto.action_runtime.action_input.action_input.ActionInputRecord) of the matched records. Each entry of its `files` pairs a file's record with the local path it was downloaded to, or with `None` when `download` is `False`.

**Raises**

- [`RobotoNotFoundException`](/docs/reference/python-sdk/roboto/exceptions/domain#roboto.exceptions.domain.RobotoNotFoundException): A selector names a dataset, file, session, or topic by an ID that matches nothing, or, with `download=True`, a resolved file is a link whose target no longer exists.
- `ExceptionGroup`: With `download=True`, one or more files still failed to download after three attempts.

**Usage**

Resolve the files a RoboQL query matches, without downloading them:

```python
from roboto.action_runtime import ActionInputResolver
from roboto.domain.actions import InvocationInput
resolver = ActionInputResolver.from_env()
input_spec = InvocationInput.file_query('dataset_id = "ds_12345" AND path LIKE "%.mcap"')
result = resolver.resolve_input_spec(input_spec)
for file_record, local_path in result.files:
    print(file_record.relative_path, local_path)
```

Resolve the same files and download them to a directory:

```python
import pathlib
result = resolver.resolve_input_spec(input_spec, download=True, download_path=pathlib.Path("/tmp/data"))
```

Resolve files and topics together:

```python
from roboto.domain.actions import DataSelector, FileSelector
input_spec = InvocationInput(
    files=FileSelector(query='dataset_id = "ds_12345" AND path LIKE "%.mcap"'),
    topics=DataSelector(names=["battery_status", "gps"]),
)
result = resolver.resolve_input_spec(input_spec)
```

### OptionallyDownloadedFile

```python
type roboto.action_runtime.action_input.input_resolver.OptionallyDownloadedFile = tuple[File, pathlib.Path | None]
```

`from roboto.action_runtime.action_input.input_resolver import OptionallyDownloadedFile`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/action_runtime/action_input/input_resolver.py#L32-L32)

A file paired with the local path it was downloaded to, or with `None` when it was not downloaded.

### log

```python
roboto.action_runtime.action_input.input_resolver.log
```

`from roboto.action_runtime.action_input.input_resolver import log`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/action_runtime/action_input/input_resolver.py#L30-L30)
