Skip to main content

Message System Overview

Flo AI uses a flexible message system to handle communication between users, agents, and tools. Messages support text, images, documents, and structured content, making it easy to build rich conversational experiences.

Message Types

Flo AI supports several message types, each serving a specific purpose in conversations:

BaseMessage

The base class for all messages. All message types inherit from BaseMessage.

UserMessage

Messages from the user to the agent. Supports text, images, and documents.

AssistantMessage

Messages from the agent to the user. These are typically generated by the LLM.

SystemMessage

System-level instructions for the agent. Used for system prompts.

FunctionMessage

Messages representing function/tool call results. Used when agents call tools.

Message Content Types

Messages can contain different types of content:

Text Content

Simple string content (default):

Image Content

Send images to agents for vision tasks:

Document Content

Send documents (PDFs, text files, etc.) to agents:

Using Messages with Agents

Basic Text Messages

Messages with Images

Messages with Documents

Mixed Content Messages

You can combine text, images, and documents in a single conversation:

Message Metadata

All messages support optional metadata for additional context:

Working with Message Responses

Accessing Response Messages

Agents return lists of messages representing the conversation history:

Extracting Content

Message History

Agents maintain conversation history across multiple calls:

Using Messages in Workflows

Messages work seamlessly in Arium workflows:

Message Type Reference

MessageType Constants

Message Classes

Content Classes

Best Practices

1. Use Appropriate Content Types

2. Handle Base64 Encoding Properly

3. Specify MIME Types

4. Use Metadata for Context

5. Handle Message Lists Properly

Examples

Multi-Modal Conversation

Function Message Handling

Message Validation

The message system provides a flexible foundation for building rich, multi-modal AI applications with Flo AI!