Class: Thought
An immutable, validated internal reasoning trace produced by an agent.
Remarks
Represents an agent's internal thinking — distinct from @nhtio/adk!Message (which is part of the visible conversation) and never shown to end users directly. Carries an identity so reasoning traces can be attributed to a specific agent in multi-agent conversations. Constructed from a RawThought via rawThoughtSchema. The content field is always a @nhtio/adk!Tokenizable so token cost can be estimated inline.
Constructors
Constructor
new Thought(raw: RawThought): Thought;Parameters
| Parameter | Type | Description |
|---|---|---|
raw | RawThought | The raw thought input validated against rawThoughtSchema. |
Returns
Thought
Throws
@nhtio/adk!E_INVALID_INITIAL_THOUGHT_VALUE when raw does not satisfy the schema.
Properties
| Property | Modifier | Type | Default value | Description |
|---|---|---|---|---|
content | readonly | Tokenizable | undefined | The reasoning content as a @nhtio/adk!Tokenizable for inline token estimation. |
createdAt | readonly | DateTime | undefined | When this thought was recorded. |
id | readonly | string | undefined | Stable unique identifier for this thought. |
identity | readonly | Identity | undefined | The identity of the agent who produced this thought. |
payload | readonly | unknown | undefined | Optional vendor-opaque payload that round-trips back to a matching model wire. See RawThought.payload. |
replayCompatibility | readonly | string | undefined | undefined | Optional wire-shape identifier describing which adapter can safely replay this thought. See RawThought.replayCompatibility. |
updatedAt | readonly | DateTime | undefined | When this thought was last modified. |
schema | static | ObjectSchema<RawThought> | rawThoughtSchema | Validator schema that accepts a RawThought object. Remarks Reusable fragment for any schema that needs to validate or nest a thought entry. |
Methods
isThought()
static isThought(value: unknown): value is Thought;Returns true if value is a Thought instance.
Parameters
| Parameter | Type | Description |
|---|---|---|
value | unknown | The value to test. |
Returns
value is Thought
true when value is a Thought instance.
Remarks
Uses @nhtio/adk!isInstanceOf for cross-realm safety — instanceof would fail for instances created in a different module copy or VM context.