molroo docs
Guides

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:

FieldDescription
emotion.vadPosition in Valence-Arousal-Dominance space
emotion.discreteHuman-readable label (joy, anger, sadness, etc.) with intensity
moodSlow-moving emotional baseline (changes gradually over many interactions)
somaticPhysical sensations tied to the emotion (racing heart, tension, warmth)
narrativeStory 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)

ComponentRole
LLMEvaluates how the character would appraise a stimulus (generates appraisal vector) and produces the text response
molroo engineComputes 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.

Next steps

On this page