Skip to content
2 min read · 399 words

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

ts
new Thought(raw: RawThought): Thought;

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 valueDescription
contentreadonlyTokenizableundefinedThe reasoning content as a @nhtio/adk!Tokenizable for inline token estimation.
createdAtreadonlyDateTimeundefinedWhen this thought was recorded.
idreadonlystringundefinedStable unique identifier for this thought.
identityreadonlyIdentityundefinedThe identity of the agent who produced this thought.
payloadreadonlyunknownundefinedOptional vendor-opaque payload that round-trips back to a matching model wire. See RawThought.payload.
replayCompatibilityreadonlystring | undefinedundefinedOptional wire-shape identifier describing which adapter can safely replay this thought. See RawThought.replayCompatibility.
updatedAtreadonlyDateTimeundefinedWhen this thought was last modified.
schemastaticObjectSchema<RawThought>rawThoughtSchemaValidator schema that accepts a RawThought object. Remarks Reusable fragment for any schema that needs to validate or nest a thought entry.

Methods

isThought()

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

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.