---
url: 'https://adk.nht.io/api/@nhtio/adk/common/classes/Identity.md'
description: >-
  An immutable, validated participant identity attached to a {@link
  @nhtio/adk!Message}.
---

# Class: Identity

Defined in: [lib/classes/identity.ts:71](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/classes/identity.ts#L71)

An immutable, validated participant identity attached to a [@nhtio/adk!Message](Message.md).

## Remarks

Carries two distinct representations of the same participant: `identifier` is the
system-facing key (e.g. a database ID) used to correlate messages programmatically;
`representation` is what the model sees when it needs to distinguish between participants
sharing the same role. The `representation` is always a [@nhtio/adk!Tokenizable](Tokenizable.md) so token cost
can be estimated inline.

## Constructors

### Constructor

```ts
new Identity(raw: RawIdentity): Identity;
```

Defined in: [lib/classes/identity.ts:113](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/classes/identity.ts#L113)

#### Parameters

| Parameter | Type                                          | Description                                                   |
| --------- | --------------------------------------------- | ------------------------------------------------------------- |
| `raw`     | [`RawIdentity`](../interfaces/RawIdentity.md) | The raw identity input validated against `rawIdentitySchema`. |

#### Returns

`Identity`

#### Throws

[@nhtio/adk!E\_INVALID\_INITIAL\_IDENTITY\_VALUE](../../exceptions/variables/E_INVALID_INITIAL_IDENTITY_VALUE.md) when `raw` does not satisfy the schema.

## Properties

| Property                                              | Modifier   | Type                                                            | Default value       | Description                                                                                                                                                                                                                             | Defined in                                                                                                      |
| ----------------------------------------------------- | ---------- | --------------------------------------------------------------- | ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
|  `identifier`         | `readonly` | `string` | `number`                                            | `undefined`         | The system-facing identifier for this participant — never sent to the model directly.                                                                                                                                                   | [lib/classes/identity.ts:98](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/classes/identity.ts#L98)   |
|  `representation` | `readonly` | [`Tokenizable`](Tokenizable.md)                                 | `undefined`         | How this participant is presented to the model, as a [@nhtio/adk!Tokenizable](Tokenizable.md) for inline token estimation.                                                                                                              | [lib/classes/identity.ts:104](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/classes/identity.ts#L104) |
|  `schema`                 | `static`   | `ObjectSchema`<[`RawIdentity`](../interfaces/RawIdentity.md)> | `rawIdentitySchema` | Validator schema that accepts a [RawIdentity](../interfaces/RawIdentity.md) object. **Remarks** Reusable fragment for any schema that needs to validate or nest an identity — for example, as a required field inside a message schema. | [lib/classes/identity.ts:79](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/classes/identity.ts#L79)   |

## Methods

### isIdentity()

```ts
static isIdentity(value: unknown): value is Identity;
```

Defined in: [lib/classes/identity.ts:91](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/classes/identity.ts#L91)

Returns `true` if `value` is an Identity instance.

#### Parameters

| Parameter | Type      | Description        |
| --------- | --------- | ------------------ |
| `value`   | `unknown` | The value to test. |

#### Returns

`value is Identity`

`true` when `value` is an Identity instance.

#### Remarks

Uses [@nhtio/adk!isInstanceOf](../../guards/functions/isInstanceOf.md) for cross-realm safety — `instanceof` would fail for instances
created in a different module copy or VM context.
