---
sidebar:
  label: roboto.config
  order: 7
title: roboto.config
---
## Module Contents

### DEFAULT_ROBOTO_CONFIG_DIR

```python
roboto.config.DEFAULT_ROBOTO_CONFIG_DIR
```

`from roboto.config import DEFAULT_ROBOTO_CONFIG_DIR`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/config.py#L25-L25)

### DEFAULT_ROBOTO_DIR

```python
roboto.config.DEFAULT_ROBOTO_DIR
```

`from roboto.config import DEFAULT_ROBOTO_DIR`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/config.py#L24-L24)

### DEFAULT_ROBOTO_PROFILE_NAME

```python
roboto.config.DEFAULT_ROBOTO_PROFILE_NAME = 'default'
```

`from roboto.config import DEFAULT_ROBOTO_PROFILE_NAME`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/config.py#L26-L26)

### ROBOTO_API_ENDPOINT

```python
roboto.config.ROBOTO_API_ENDPOINT = 'https://api.roboto.ai'
```

`from roboto.config import ROBOTO_API_ENDPOINT`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/config.py#L21-L21)

### RobotoConfig

```python
class roboto.config.RobotoConfig(/, **data: Any)
```

`from roboto import RobotoConfig`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/config.py#L59-L177)

Bases: `pydantic.BaseModel`

RobotoConfig captures an `api_key` and `endpoint` required to programmatically interact with Roboto. Multiple profiles can be configured if desired.

**Parameters**

- **data** (`Any`)

**Attributes**

- **RobotoConfig.api_key** (`str`)
- **RobotoConfig.cache_dir** (`pathlib.Path | None`) = `None`
- **RobotoConfig.default_http_timeout** (`roboto.env.Timeout`)
- **RobotoConfig.endpoint** (`str`) = `'https://api.roboto.ai'`
- **RobotoConfig.org_id** (`str | None`) = `None`: Organization to act in when the caller names none and `ROBOTO_ORG_ID` is unset. The CLI and [`from_env()`](/reference/python-sdk/roboto/roboto_search#roboto.roboto_search.RobotoSearch.from_env) read it. Only a member of several organizations needs it. `roboto setup` saves it to the config file profile; a config built from `ROBOTO_API_KEY` or `ROBOTO_BEARER_TOKEN` has none.

#### RobotoConfig.from_env()

```python
@classmethod
def from_env(
    profile_override: Optional[str] = None,
    env: Optional[roboto.env.RobotoEnv] = None,
) -> RobotoConfig
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/config.py#L77-L171)

Build a config from the access token in the environment, or else from a profile in the Roboto config file.

A token in `ROBOTO_API_KEY` or `ROBOTO_BEARER_TOKEN` takes precedence, and is sent to the endpoint in `ROBOTO_SERVICE_ENDPOINT`, or to `https://api.roboto.ai` when that is unset. Without a token, the config comes from the file at `ROBOTO_CONFIG_FILE`, or `~/.roboto/config.json` when that is unset. Either way, `ROBOTO_CACHE_DIR` and `ROBOTO_DEFAULT_HTTP_TIMEOUT`, when set, override the profile's `cache_dir` and `default_http_timeout`.

**Parameters**

- **profile_override** (`Optional[str]`): Config file profile to read, ahead of `ROBOTO_PROFILE` and the file's default profile.
- **env** (`Optional[roboto.env.RobotoEnv]`): Roboto environment variables to read. Defaults to the process's own, through `RobotoEnv.default()`.

**Raises**

- `FileNotFoundError`: No access token is set and the config file doesn't exist.
- `OSError`: The config file exists but can't be read.
- `ValueError`: The config file isn't a JSON object, or has no usable profile by the chosen name.

**Returns**

- `RobotoConfig`

#### RobotoConfig.get_cache_dir()

```python
def get_cache_dir() -> pathlib.Path
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/config.py#L173-L177)

**Returns**

- `pathlib.Path`

### RobotoConfigFileProfileV0

```python
class roboto.config.RobotoConfigFileProfileV0(/, **data: Any)
```

`from roboto.config import RobotoConfigFileProfileV0`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/config.py#L180-L187)

Bases: `pydantic.BaseModel`

V0 Roboto configuration file

**Parameters**

- **data** (`Any`)

**Attributes**

- **RobotoConfigFileProfileV0.default_endpoint** (`str`) = `'https://api.roboto.ai'`
- **RobotoConfigFileProfileV0.token** (`str`)

#### RobotoConfigFileProfileV0.to_config()

```python
def to_config() -> RobotoConfig
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/config.py#L186-L187)

**Returns**

- `RobotoConfig`

### RobotoConfigFileV1

```python
class roboto.config.RobotoConfigFileV1(/, **data: Any)
```

`from roboto.config import RobotoConfigFileV1`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/config.py#L190-L205)

Bases: `pydantic.BaseModel`

V1 Roboto configuration file

**Parameters**

- **data** (`Any`)

**Attributes**

- **RobotoConfigFileV1.default_profile** (`str | None`) = `'default'`
- **RobotoConfigFileV1.profiles** (`dict[str, RobotoConfig]`)
- **RobotoConfigFileV1.version** (`Literal['v1']`)

#### RobotoConfigFileV1.validate()

```python
def validate()
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/config.py#L198-L205)

### logger

```python
roboto.config.logger
```

`from roboto.config import logger`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/config.py#L18-L18)

### resolve_cache_dir()

```python
def roboto.config.resolve_cache_dir(
    env: roboto.env.RobotoEnv,
    ensure_exists: bool,
) -> pathlib.Path
```

`from roboto.config import resolve_cache_dir`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/config.py#L35-L45)

Resolve the base directory under which the SDK caches files it fetches from Roboto.

Prefers `ROBOTO_CACHE_DIR` from `env`; absent that, the platform-conventional per-user cache directory. `ensure_exists` applies only to the platform default: when true, resolving it also creates the directory on disk. A directory supplied through `ROBOTO_CACHE_DIR` is returned as-is and never created here.

**Parameters**

- **env** (`roboto.env.RobotoEnv`)
- **ensure_exists** (`bool`)

**Returns**

- `pathlib.Path`

### resolve_config_file()

```python
def roboto.config.resolve_config_file(env: roboto.env.RobotoEnv) -> pathlib.Path
```

`from roboto.config import resolve_config_file`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/config.py#L48-L56)

Resolve the path of the Roboto config file: `ROBOTO_CONFIG_FILE` from `env`, else `~/.roboto/config.json`.

The file at the returned path may not exist.

**Parameters**

- **env** (`roboto.env.RobotoEnv`)

**Returns**

- `pathlib.Path`
