---
title: NameRecord
description: "One named VM: everything Sandbox.adopt needs, under a name."
---

```python
@final
class NameRecord
```

One named VM: everything `Sandbox.adopt` needs, under a name.

Holds a secret. `agent_token` is readable so the VM can be adopted, but it stays out of
`repr`; keep records (and `to_dict()` output) in private storage.

## Constructor

```python
NameRecord(name: str, microvm_id: str, endpoint: str, agent_token: str, region: Region)
```

A record for a VM this process can already address. Refuses an illegal name or an
empty id, endpoint, or token.

## Properties

### `agent_token`

```python
agent_token: str
```

The VM's bearer credential. Store only privately; never in repr.

### `at`

```python
at: int
```

Seconds since the epoch when the name was registered.

### `egress_posture`

```python
egress_posture: str | None
```

The launch's egress posture label, or `None` when the registering process did not
know it.

### `endpoint`

```python
endpoint: str
```

### `microvm_id`

```python
microvm_id: str
```

### `name`

```python
name: str
```

### `region`

```python
region: str
```

The region the VM runs in, as the record spells it.

### `tunnel_identity`

```python
tunnel_identity: TunnelIdentity | None
```

The VM's tunnel identity, when it was launched with `identity=True`; `None` otherwise.

Raises when the record carries one half of the pair, or a half that doesn't decode: the
record claims a verifiable VM, and reading it as unverifiable would hide that it's
broken. Holds the host's secret half, which stays out of this record's repr.

## Methods

### `for_sandbox`

```python
@staticmethod
def for_sandbox(name: str, sandbox: Sandbox) -> NameRecord
```

A record naming the VM `sandbox` addresses — launched or adopted.

### `from_dict`

```python
@staticmethod
def from_dict(record: dict) -> NameRecord
```

A record from `to_dict()` output (or a CLI registry file's JSON), checked.

### `to_dict`

```python
def to_dict() -> Any
```

The record as a JSON-safe dict with the CLI registry's camelCase keys, **agent token
included** — the form to store privately and read back with `from_dict`.

## Special methods

### `__eq__`

```python
def __eq__(other: object, /) -> bool
```

### `__repr__`

```python
def __repr__() -> str
```

## Provenance

This page is generated from `bindings/microvms-py/microvms.pyi` by Griffe 2.3.0, run from `site/scripts/gen-reference.mjs` on every `pnpm run sync`, so an edit made here is overwritten by the next run.

To change the page, change the doc comment in the binding's Rust source, then regenerate the declarations with `mise run stubs`. `mise run stubs:check` fails when the committed file no longer matches the source.