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

# alibi_sdk.plugins.s3_plugin

> S3 plugin — generated from python/alibi_sdk source.

S3 / object-store plugin — bucket+prefix isolation + put/get/delete observation.

Default backend is an in-memory object map (tests + demos without AWS).
Pass `client_factory` (e.g. boto3 client) when wiring a real bucket.

Install::

from alibi\_sdk.plugins import create\_s3\_plugin
s3 = create\_s3\_plugin(bucket="alibi-sandbox", prefix="demo/")

*Source:* [`python/alibi_sdk/alibi_sdk/plugins/s3_plugin.py`](https://github.com/valid22/alibi-ai/blob/main/python/alibi_sdk/alibi_sdk/plugins/s3_plugin.py)

## `S3Plugin`

**Bases:** `Plugin`

#### `__init__`

```python theme={null}
def __init__(bucket: str = 'alibi', prefix: str = 'alibi/', endpoint_url: Optional[str] = None, store: Optional[_InMemoryS3] = None, client_factory: Optional[Callable[[], Any]] = None) -> None
```

**Parameters**

| Name | Type |
| - | - |
| `bucket` | `str` |
| `prefix` | `str` |
| `endpoint_url` | `Optional[str]` |
| `store` | `Optional[_InMemoryS3]` |
| `client_factory` | `Optional[Callable[[], Any]]` |

**Returns**

`None`

#### `active_prefix`

```python theme={null}
def active_prefix() -> str
```

**Returns**

`str`

#### `active_bucket`

```python theme={null}
def active_bucket() -> str
```

**Returns**

`str`

#### `connect`

```python theme={null}
async def connect() -> Any
```

**Returns**

`Any`

#### `close`

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

**Returns**

`None`

#### `put`

```python theme={null}
async def put(key: str, body: Any, content_type: str = 'application/octet-stream', metadata: Optional[dict[str, str]] = None) -> dict[str, Any]
```

**Parameters**

| Name | Type |
| - | - |
| `key` | `str` |
| `body` | `Any` |
| `content_type` | `str` |
| `metadata` | `Optional[dict[str, str]]` |

**Returns**

`dict[str, Any]`

#### `get`

```python theme={null}
async def get(key: str) -> Optional[dict[str, Any]]
```

**Parameters**

| Name | Type |
| - | - |
| `key` | `str` |

**Returns**

`Optional[dict[str, Any]]`

#### `delete`

```python theme={null}
async def delete(key: str) -> bool
```

**Parameters**

| Name | Type |
| - | - |
| `key` | `str` |

**Returns**

`bool`

#### `list_objects`

```python theme={null}
async def list_objects(prefix: str = '') -> list[str]
```

**Parameters**

| Name | Type |
| - | - |
| `prefix` | `str` |

**Returns**

`list[str]`

#### `snapshot`

```python theme={null}
async def snapshot(span: SpanContext) -> SnapshotHandle
```

**Parameters**

| Name | Type |
| - | - |
| `span` | `SpanContext` |

**Returns**

`SnapshotHandle`

#### `observe`

```python theme={null}
async def observe(span: SpanContext) -> dict[str, Any]
```

**Parameters**

| Name | Type |
| - | - |
| `span` | `SpanContext` |

**Returns**

`dict[str, Any]`

#### `restore`

```python theme={null}
async def restore(span: SpanContext, handle: SnapshotHandle) -> None
```

**Parameters**

| Name | Type |
| - | - |
| `span` | `SpanContext` |
| `handle` | `SnapshotHandle` |

**Returns**

`None`

### `create_s3_plugin`

```python theme={null}
def create_s3_plugin(bucket: str = 'alibi', prefix: str = 'alibi/', endpoint_url: Optional[str] = None, store: Optional[_InMemoryS3] = None, client_factory: Optional[Callable[[], Any]] = None) -> S3Plugin
```

**Parameters**

| Name | Type |
| - | - |
| `bucket` | `str` |
| `prefix` | `str` |
| `endpoint_url` | `Optional[str]` |
| `store` | `Optional[_InMemoryS3]` |
| `client_factory` | `Optional[Callable[[], Any]]` |

**Returns**

`S3Plugin`


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