Skip to content
2 min read · 429 words

Class: Thought

Defined in: lib/classes/thought.ts:156

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

ts
new Thought(raw: RawThought): Thought;

Defined in: lib/classes/thought.ts:212

Parameters

ParameterTypeDescription
rawRawThoughtThe raw thought input validated against rawThoughtSchema.

Returns

Thought

Throws

@nhtio/adk!E_INVALID_INITIAL_THOUGHT_VALUE when raw does not satisfy the schema.

Properties

PropertyModifierTypeDefault valueDescriptionDefined in
contentreadonlyTokenizableundefinedThe reasoning content as a @nhtio/adk!Tokenizable for inline token estimation.lib/classes/thought.ts:182
createdAtreadonlyDateTimeundefinedWhen this thought was recorded.lib/classes/thought.ts:196
idreadonlystringundefinedStable unique identifier for this thought.lib/classes/thought.ts:180
identityreadonlyIdentityundefinedThe identity of the agent who produced this thought.lib/classes/thought.ts:184
payloadreadonlyunknownundefinedOptional vendor-opaque payload that round-trips back to a matching model wire. See RawThought.payload.lib/classes/thought.ts:189
replayCompatibilityreadonlystring | undefinedundefinedOptional wire-shape identifier describing which adapter can safely replay this thought. See RawThought.replayCompatibility.lib/classes/thought.ts:194
updatedAtreadonlyDateTimeundefinedWhen this thought was last modified.lib/classes/thought.ts:198
schemastaticObjectSchema<RawThought>rawThoughtSchemaValidator schema that accepts a RawThought object. Remarks Reusable fragment for any schema that needs to validate or nest a thought entry.lib/classes/thought.ts:163

Methods

isThought()

ts
static isThought(value: unknown): value is Thought;

Defined in: lib/classes/thought.ts:175

Returns true if value is a Thought instance.

Parameters

ParameterTypeDescription
valueunknownThe 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.