Defined in: [src/types/messages.ts:1036](https://github.com/strands-agents/harness-sdk/blob/main/strands-ts/src/types/messages.ts#L1036)

**`Experimental`**

Text the app adds to a user turn, such as a reminder or recalled memories, kept apart from the user’s own words. Use it instead of a [TextBlock](/pr-cms-5569/docs/api/typescript/TextBlock/index.md) when the text comes from the app, not the user. It belongs in a user message, after the existing content. In any other message it is left out, with a warning.

`ContextInjector` and `MemoryManager` write their text as injected blocks, so code that should only see the user’s own words can skip them.

It stays in the message like any other content, so every later request sends that message the same way. The agent sends it to the model as plain text in that message. A direct call to a model, such as `model.stream()`, leaves it out.

The text is kept under `injected`, the same shape as the saved data, so an InjectedBlock is never read as a [TextBlock](/pr-cms-5569/docs/api/typescript/TextBlock/index.md).

## Example

```typescript
const message = new Message({
  role: 'user',
  content: [new TextBlock('Refactor the tokenizer.'), new InjectedBlock({ text: 'cwd: /repo', source: 'env' })],
})
```

## Implements

-   `JSONSerializable`<{ `injected`: [`InjectedBlockData`](/pr-cms-5569/docs/api/typescript/InjectedBlockData/index.md); }>

## Constructors

### Constructor

```ts
new InjectedBlock(data): InjectedBlock;
```

Defined in: [src/types/messages.ts:1047](https://github.com/strands-agents/harness-sdk/blob/main/strands-ts/src/types/messages.ts#L1047)

**`Experimental`**

#### Parameters

| Parameter | Type |
| --- | --- |
| `data` | [`InjectedBlockData`](/pr-cms-5569/docs/api/typescript/InjectedBlockData/index.md) |

#### Returns

`InjectedBlock`

## Properties

### type

```ts
readonly type: "injectedBlock";
```

Defined in: [src/types/messages.ts:1040](https://github.com/strands-agents/harness-sdk/blob/main/strands-ts/src/types/messages.ts#L1040)

**`Experimental`**

Discriminator for injected content.

---

### injected

```ts
readonly injected: InjectedBlockData;
```

Defined in: [src/types/messages.ts:1045](https://github.com/strands-agents/harness-sdk/blob/main/strands-ts/src/types/messages.ts#L1045)

**`Experimental`**

The injected data: the text the app adds to the user turn and the component that added it.

## Methods

### toJSON()

```ts
toJSON(): {
  injected: InjectedBlockData;
};
```

Defined in: [src/types/messages.ts:1055](https://github.com/strands-agents/harness-sdk/blob/main/strands-ts/src/types/messages.ts#L1055)

**`Experimental`**

Serializes the InjectedBlock to a JSON-compatible ContentBlockData object. Called automatically by JSON.stringify().

#### Returns

```ts
{
  injected: InjectedBlockData;
}
```

| Name | Type | Defined in |
| --- | --- | --- |
| `injected` | [`InjectedBlockData`](/pr-cms-5569/docs/api/typescript/InjectedBlockData/index.md) | [src/types/messages.ts:1055](https://github.com/strands-agents/harness-sdk/blob/main/strands-ts/src/types/messages.ts#L1055) |

#### Implementation of

`JSONSerializable.toJSON`

---

### fromJSON()

```ts
static fromJSON(data): InjectedBlock;
```

Defined in: [src/types/messages.ts:1065](https://github.com/strands-agents/harness-sdk/blob/main/strands-ts/src/types/messages.ts#L1065)

**`Experimental`**

Creates an InjectedBlock instance from its wrapped data format.

#### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| `data` | { `injected`: [`InjectedBlockData`](/pr-cms-5569/docs/api/typescript/InjectedBlockData/index.md); } | Wrapped InjectedBlockData to deserialize |
| `data.injected` | [`InjectedBlockData`](/pr-cms-5569/docs/api/typescript/InjectedBlockData/index.md) | \- |

#### Returns

`InjectedBlock`

InjectedBlock instance