# `SuperPi.Artifacts`
[🔗](https://github.com/oleksandr/super-pi-beam/blob/v0.1.0/lib/super_pi/artifacts.ex#L1)

Explicit storage for files that an agent wants to keep.

A scratch workspace disappears when its task ends or its node fails. An artifact does not:
it is stored by name in the database, scoped to one conversation, and survives restarts and
failover. The agent uses three tools:

| Tool | Purpose |
|---|---|
| `artifact_put` | Save text (`content`) or a workspace file (`path`) under `name`. A second put replaces it. |
| `artifact_get` | Return an artifact, or write it to a workspace file (`to_path`). |
| `artifact_list` | List the artifacts of the conversation. |

The backend is `SuperPi.Artifacts.Store`. The default stores blobs in the repo
(`SuperPi.Artifacts.Ecto`: PostgreSQL, or SQLite on a single node). Another backend (for
example an S3-compatible bucket) implements the behaviour and is set with
`config :super_pi, artifact_store: MyStore`.

Limits: `artifact_max_bytes` per artifact (default 10 MiB) and `artifact_max_count` per
conversation (default 200). Names are `A-Z a-z 0-9 . _ - /`, up to 200 characters, with no
`..` segment and no leading slash.

# `result`

```elixir
@type result() :: {:ok, term()} | {:error, term()}
```

# `delete`

```elixir
@spec delete(integer(), String.t()) :: :ok | {:error, term()}
```

# `get`

```elixir
@spec get(integer(), String.t()) :: result()
```

# `list`

```elixir
@spec list(integer()) :: [map()]
```

# `max_bytes`

# `max_count`

# `put`

```elixir
@spec put(integer(), String.t(), binary(), String.t()) :: result()
```

# `store`

# `tool_names`

# `tool_specs`

Tool specifications for the three artifact tools.

# `valid_name?`

```elixir
@spec valid_name?(term()) :: boolean()
```

Validates an artifact name.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
