molroo docs
SDK ReferenceTypes

Emotion Types

VAD, AppraisalVector, State, AgentResponse, and emotion sub-system types.

Emotion Types

Core emotion types returned by the molroo API. These represent the heart of molroo's psychology-based emotion simulation.

import type {
  VAD,
  AppraisalVector,
  AgentResponse,
  State,
  Episode,
} from '@molroo-io/sdk';

VAD

Valence-Arousal-Dominance vector -- the core emotion representation. All emotional states in molroo are represented in this 3D space.

interface VAD {
  V: number;
  A: number;
  D: number;
}
DimensionDescription
V (Valence)Negative to positive
A (Arousal)Calm to activated
D (Dominance)Submissive to dominant

AppraisalVector

Cognitive appraisal vector. Describes how a persona evaluates an incoming stimulus. The LLM generates these values during chat, or you provide them manually in emotion-only mode.

interface AppraisalVector {
  goal_relevance: number;
  goal_congruence: number;
  expectedness: number;
  controllability: number;
  agency: number;
  norm_compatibility: number;
  internal_standards: number;
  adjustment_potential: number;
  urgency: number;
}
DimensionDescription
goal_relevanceHow relevant to the persona's current goals
goal_congruenceWhether this helps or hinders goals
expectednessHow expected/predictable this was
controllabilityHow much control the persona has over the situation
agencyWho is responsible: self or other
norm_compatibilityWhether this fits the persona's moral/social norms
internal_standardsSelf-standard evaluation
adjustment_potentialCoping/acceptance ability
urgencyTime pressure for action

AgentResponse

Response from the emotion engine for a single entity interaction. This is the primary result type returned within PersonaChatResult.

interface AgentResponse {
  emotion: {
    vad: VAD;
    discrete: {
      primary: string;
      secondary?: string;
      intensity: number;
    };
  };
  mood?: {
    vad: VAD;
    valence: 'negative' | 'neutral' | 'positive';
    arousal: 'calm' | 'moderate' | 'activated';
    dominance: 'submissive' | 'balanced' | 'dominant';
  };
  somatic?: string[];
  narrative?: {
    tone: number;
    agency: number;
    coherence: number;
  };
  text?: string;
  action?: string;
  memoryEpisode?: Episode;
  socialUpdates?: SocialUpdate[];
  reflectionPrompt?: ReflectionPrompt;
  goalChanges?: { achieved: string[]; blocked: string[] };
  behaviorModifiers?: Record<string, number>;
}

emotion

FieldTypeDescription
emotion.vadVADCurrent emotion in VAD space
emotion.discrete.primarystringPrimary discrete emotion label (e.g., 'joy', 'anger', 'fear')
emotion.discrete.secondarystring?Optional secondary emotion label
emotion.discrete.intensitynumberEmotion intensity (0 to 1)

mood

Background mood:

FieldTypeDescription
mood.vadVADMood in VAD space
mood.valence'negative' | 'neutral' | 'positive'Valence category
mood.arousal'calm' | 'moderate' | 'activated'Arousal category
mood.dominance'submissive' | 'balanced' | 'dominant'Dominance category

somatic

Array of body sensation strings (e.g., ['chest_warmth', 'stomach_butterflies']).

narrative

Self-narrative perception metrics. Included automatically when available.

Side effects

FieldTypeDescription
textstring?LLM-generated response text (empty in emotion-only mode)
actionstring?Suggested action
memoryEpisodeEpisodeMemory episode recorded during this interaction
socialUpdatesSocialUpdate[]Relationship changes triggered by this interaction
reflectionPromptReflectionPromptPrompt for LLM-generated reflection (used with MemoryAdapter)
goalChanges{ achieved, blocked }Goals that changed status this turn
behaviorModifiersRecord<string, number>?Relationship-stage behavioral hints (e.g., approach tendency, disclosure level)

State

Emotion state of a persona. Returned when includeState: true is set in chat options.

FieldTypeDescription
emotionVADCurrent emotion coordinates

The State object also includes additional internal engine fields. These are managed automatically and should be treated as opaque.


SoulStage

Psychological development stage. The persona progresses through stages reflecting psychological growth or decline. Returned as part of State.

FieldTypeDescription
idnumberCurrent stage number
namestringStage name

Other fields are internal engine state and should be treated as opaque.


NeedState

Psychological needs state. Each dimension reflects how well the persona's needs are being met.

FieldTypeDescription
autonomynumberSense of agency and choice
competencenumberSense of effectiveness
relatednessnumberSense of social connection

Additional internal types

The engine tracks additional internal state types for emotion dynamics. These are returned as opaque objects and managed automatically — you do not need to interact with them directly.


Episode

A memory episode representing a single interaction or event. Episodes are stored in the persona's memory and can be recalled during future conversations.

interface Episode {
  id: string;
  type?: string;
  content?: string;
  context?: string;
  sourceEntity?: string;
  appraisal?: AppraisalVector;
  emotionSnapshot: VAD;
  intensity?: number;
  importance: number;
  timestamp: number;
}
FieldTypeDescription
idstringUnique episode identifier
typestring?Episode type (e.g., 'chat_message', 'world_event')
contentstring?Text content of the interaction
contextstring?Additional context about the episode
sourceEntitystring?Name of the entity that triggered this episode
appraisalAppraisalVectorAppraisal at the time of the episode
emotionSnapshotVADEmotional state at the time of the episode
intensitynumber?Emotional intensity
importancenumberImportance score for memory consolidation
timestampnumberEpoch timestamp (milliseconds)

SocialUpdate

A relationship change triggered during an interaction.

interface SocialUpdate {
  entityId: string;
  field: string;
  oldValue: number;
  newValue: number;
}

PersonaSnapshot

See PersonaSnapshot in Result Types.

On this page