Messages

The AgentOpera message system provides the communication infrastructure that powers agent interactions within the platform. Built on Pydantic models for type safety and serialization support, the system enables structured and versatile exchanges between agents, tools, and human users.

BaseMessage
β”œβ”€β”€ BaseChatMessage
β”‚   β”œβ”€β”€ TextMessage
β”‚   β”œβ”€β”€ MultiModalMessage
β”‚   β”œβ”€β”€ StopMessage
β”‚   β”œβ”€β”€ HandoffMessage
β”‚   └── ToolCallSummaryMessage
└── BaseAgentEvent
    β”œβ”€β”€ ToolCallRequestEvent
    β”œβ”€β”€ ToolCallExecutionEvent
    β”œβ”€β”€ MemoryQueryEvent
    β”œβ”€β”€ UserInputRequestedEvent
    β”œβ”€β”€ ModelClientStreamingChunkEvent
    └── ThoughtEvent

Core Concepts

Universal Message Properties

All messages in AgentOpera share these fundamental attributes:

  • Source: Identifies the agent that created the message

  • Model Usage: Tracks computational resources utilized

  • Metadata: Stores additional contextual information.

Communication Channels

AgentOpera distinguishes between two separate communication channels:

  1. External Channel: For agent-to-agent or agent-to-user communication

  2. Internal Channel: For recording operations within an agent's workflow

This separation maintains clear boundaries between what agents communicate externally and what they process or do internally.

External Communication (BaseChatMessage)

External messages represent the explicit, user-facing communication between agents.

TextMessage

The most basic communication unit containing plain text.

MultiModalMessage

A communication unit that contains both text and visual elements.

Control Messages

Special message types that direct the flow of conversation:

  • StopMessage: Terminates the current conversation flow

  • HandoffMessage: Transfers control to another agent with context

  • ToolCallSummaryMessage: Provides human-readable summaries of tool operations

Internal Operations (BaseAgentEvent)

Events record the internal operations of agents, tools, and systems.

Tool Interaction Events

  • ToolCallRequestEvent: Record tool invocation requests

  • ToolCallExecutionEvent: Capture tool execution results

Runtime Events

  • ModelClientStreamingChunkEvent: Tracks streaming model outputs

  • UserInputRequestedEvent: Signals when user input is needed

Example: Complete Interaction

This exchange shows how messages support complex workflows while keeping visible conversation and internal processing separate.

Last updated