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

# Standalone asset usage

Use the asset APIs outside a flow, such as in admin scripts, CI cleanup jobs, or notebooks.

Use `Asset` directly outside flow context (deployments, notebooks, scripts):

```python theme={null}
from obproject.assets import Asset

asset = Asset(
    project="fraud-detection",
    branch="main",
    read_only=True  # for read-only access
)

ref = asset.consume_model_asset("fraud_classifier")
```

Parameter

Type

Description

`project`

str

Project name

`branch`

str

Branch name

`entity_ref`

dict

Pass for writes outside a flow; e.g. `{"entity_kind": "user", "entity_id": "cleanup-script"}`. The default resolves from `current.pathspec`, which is `None` outside a Metaflow run and is rejected by the backend.

`read_only`

bool

Set `True` for read-only access (skips entity tracking)

When `read_only=True`:

* Registration methods are no-ops
* Consume methods use GET (no lineage tracking) instead of PUT
* Delete methods raise `RuntimeError`

For writes from a standalone script (register, consume, delete), pass an explicit `entity_ref`—`current.pathspec` isn't available outside a flow.

### Cleanup scripts

Writable standalone clients are the right path for admin or CI cleanup. The script constructs an `Asset` with an explicit user-entity ref, then loops over names to delete:

```python theme={null}
from obproject.assets import Asset

asset = Asset(
    project="my-project",
    branch="main",
    entity_ref={"entity_kind": "user", "entity_id": "cleanup-script"},
)
for name in ("obsolete_dataset", "old_features"):
    result = asset.delete_data_asset(name)
    print(f"{name}: catalog={result.catalog_deleted} metadata={result.metadata_updated}")
```

Each call removes the asset from both the catalog and the flowproject metadata. `DeleteResult` lets the script render meaningful progress (for example, `already absent` vs `metadata only (catalog already absent)` vs `deleted (catalog+metadata)`). Reruns are safe—names that are already gone return `DeleteResult(False, False)`.
