# compute

> What runs on NoClick for you now: your machines (with the conversations on each), every agent's sandbox that's up, and your live sandboxes, each with its price an hour.

```python
running = noclick.compute(user_filter="all")
per_hour = sum(c.usd_per_hour or 0 for c in running if c.status == "running")
```

## noclick.compute

```python
noclick.compute(*, user_filter=None, user=..., client=None) -> list[ComputeItem]
```

Your machines (any status, with the conversations on each), every agent's sandbox up now and every live
`Sandbox`, each with its price an hour. Each part needs its area's scope (`machines`, `agents`,
`sandboxes`); a key with only some gets those. Your own computers aren't in it.

Parameters:

- `user_filter` (`Any`, default `None`): Which users a read covers: `noclick.ALL_USERS`, `noclick.NO_USER`, a `User`, or your id for one. It filters without acting as that user.
- `user` (`Any`, default: the current user): Who the call acts for. Defaults to the user set by `noclick.as_user` (none: the account itself).
- `client` (`Client | None`, default `None`): The client to send with; defaults to the module client built from `NOCLICK_API_KEY`.

Returns: `list[ComputeItem]` Each machine or sandbox: its `kind`, status, size, price an hour and what runs on it.

Usage:

```python
for item in noclick.compute(user_filter="all"):
    print(item.kind, item.name, item.usd_per_hour, [r.agent_name for r in item.running])
```

## noclick.ComputeItem

```python
class ComputeItem
```

A machine, an agent's sandbox or a sandbox, as it runs now.

| Attribute | Type | Description |
| --- | --- | --- |
| `kind` | `str` | `machine` (a NoClick machine, any status), `agent_sandbox` (an agent's warm sandbox) or `sandbox`. |
| `id` | `str` | Its id (an agent's sandbox: its name). |
| `name` | `str | None` | The machine's name, the agent's, or a sandbox's image. |
| `status` | `str | None` |  |
| `user_id` | `str | None` |  |
| `region` | `str | None` |  |
| `cpu` | `float | None` |  |
| `memory_gb` | `float | None` |  |
| `started_at` | `Any` |  |
| `usd_per_hour` | `float | None` | What an hour of it costs (a machine: its month's price over 730 hours). |
| `usd_per_month` | `float | None` | A machine's price a month. |
| `spent_usd_today` | `float | None` | What an agent's sandbox charged since midnight UTC. |
| `running` | `list[ComputeRun]` |  |
| `raw` | `dict[str, Any]` | The response JSON exactly as the API sent it. |

## noclick.ComputeRun

```python
class ComputeRun
```

A conversation running on a machine or in an agent's sandbox.

| Attribute | Type | Description |
| --- | --- | --- |
| `agent_id` | `str | None` |  |
| `agent_name` | `str | None` |  |
| `conversation` | `str | None` | The agent's conversation, as `agent.message(conversation=...)` names it. |
| `harness` | `str | None` |  |
| `state` | `str` | `starting`, `live` or `running`. |
