Emotion Pipeline
How molroo computes emotions for your AI characters.
Emotion Pipeline
molroo handles all emotion computation server-side. You send interactions, we return psychologically grounded emotional responses. No prompt engineering, no emotion logic on your end.
How it works
Your app sends a message
|
v
molroo API
+----------------------+
| Emotion Engine | Evaluates, computes, and updates state
+----------------------+
|
v
AgentResponse
(emotion, mood, somatic markers)All emotion math is deterministic and reproducible. The same input always produces the same emotional output, regardless of which LLM provider you use.
What you get back
Every interaction returns an AgentResponse with:
| Field | Description |
|---|---|
emotion.vad | Position in Valence-Arousal-Dominance space |
emotion.discrete | Human-readable label (joy, anger, sadness, etc.) with intensity |
mood | Slow-moving emotional baseline (changes gradually over many interactions) |
somatic | Physical sensations tied to the emotion (racing heart, tension, warmth) |
narrative | Story coherence metrics (tone, agency, coherence) |
For the complete AgentResponse type definition, see the Emotion Types Reference.
The appraisal input
The only part you can control is the appraisal vector — an evaluation of how the character perceives a stimulus. See the Emotion Types Reference for the full definition.
With an LLM adapter, the SDK generates this appraisal automatically from the conversation context. Without an LLM adapter, you provide the appraisal values directly.
Personality shapes everything
Each character's personality profile influences how they process and express emotions. Characters with different traits react differently to the same stimulus. You define personality once when creating the character. The engine handles the rest.
What the LLM does (and doesn't do)
| Component | Role |
|---|---|
| LLM | Evaluates how the character would appraise a stimulus (generates appraisal vector) and produces the text response |
| molroo engine | Computes all emotion math, updates state, manages personality effects, tracks memory |
The LLM never decides what emotion the character feels. It only provides the cognitive evaluation. The engine handles everything else.
This means you can swap LLM providers freely — the emotional behavior stays consistent.