xpander-sdk
Agent.Messages
Messages API reference for the xpander SDK
Message Properties and Methods
The Messages API provides access to conversation history and methods for modifying messages in xpander agents.
agent.messages
Array of conversation messages in OpenAI-compatible format.
Returns: Array of message objects with the following structure:
Messages are automatically populated when agent.add_task()
is called. The array is in OpenAI-compatible format and can be used directly with any supported LLM provider without manual conversion.
add_messages() / addMessages()
Adds one or more messages to the conversation history.
Parameter | Type | Required | Description |
---|---|---|---|
messages | LLM response or Message(s) | Yes | Messages to add (accepts raw LLM responses, single messages, or arrays) |
Returns: void
Type Definitions
Message
Standard message object in OpenAI-compatible format.
Usage Examples
Passing Messages to LLM API
Analyzing Messages
Complete Agent Loop with Messages
Integration with Tasks API
The Messages API is tightly integrated with the Tasks API:
- Messages are initialized when
agent.add_task()
is called - Message history is loaded when a
thread_id
is provided toadd_task()
- The execution ends when the LLM calls the
xpfinish-agent-execution-finished
tool
For task management functionality, see the Tasks API documentation.