Features

Messaging

Human-like typing simulation with natural delays and typing indicators.

The messaging addon provides a send_message tool that makes your agent's responses feel natural. Instead of instant replies, messages appear with realistic typing delays.

Reading Delay

Pause before typing starts, simulating reading comprehension

Typing Indicator

Show "typing..." while the message is being composed

Smart Timing

Short replies are fast, longer messages take more time

Enable Messaging

const metadata = {
  className: 'ChatBot',
  personality: 'A friendly assistant.',
  instructions: 'Respond using send_message tool.',
  tools: [],
  addons: {
    enabled: ['messaging'],
  },
};

Handle Events

Listen for three event types:

socket.on('event', (data) => {
  if (data.type === 'messaging') {
    switch (data.event) {
      case 'typing_start':
        showTypingIndicator();
        break;
      case 'message_sent':
        hideTypingIndicator();
        displayMessage(data.message);
        break;
      case 'typing_end':
        hideTypingIndicator();  // Message was canceled
        break;
    }
  }
});

Configuration

Customize timing behavior. Use exponential mode for more realistic typing where short messages are quick and long messages take proportionally longer.

addons: {
  enabled: ['messaging'],
  messaging: {
    delays: {
      readingDelayMs: 2000,       // Pause before typing (default: 3000)
      typingMode: 'exponential',  // 'linear' or 'exponential'
      typingWpm: 70,              // Words per minute (default: 90)
      maxTypingDelayMs: 30000,    // Cap for long messages
    },
  },
}

Cancellation

When a new event arrives, any pending message is automatically canceled. Use skipCancelPendingMessage: true for background events that shouldn't interrupt typing.

socket.emit('message', {
  type: 'huma-0.1-event',
  content: {
    name: 'status-update',
    context: { ... },
    description: 'Background update',
    skipCancelPendingMessage: true,  // Won't interrupt typing
  },
});