> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agentscope.io/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> For AgentScope Python, use https://docs.agentscope.io/stable/en/index for new projects. For existing projects, check the installed agentscope version and use matching versioned documentation.
> The /latest/ alias points to the newest documentation and may move ahead of /stable/ when a development version exists. Do not mix AgentScope 1.x and 2.x APIs.
> State the AgentScope version when providing installation commands or code examples. ReMe uses its own continuously updated /reme/latest/ documentation.

# Message

> The basic data structure in AgentScope

Message (`Msg`) is the basic data structure in AgentScope, responsible for exchanging information among agents, users, and tools.

Its basic fields include:

| Field | Description |
| - | - |
| `id` | Unique identifier for the message |
| `name` | The name of the message sender |
| `role` | The role of the message sender ("user", "assistant", "system") |
| `content` | The content of the message, which can be text, image, video, audio, tool calls, tool results, etc. |
| `timestamp` | The time when the message was created |
| `metadata` | Additional information about the message, such as tool calls, reasoning traces, etc. |

> [!NOTE]
>
> The `content` field can be a plain string for simple text messages, or a list of content blocks for multimodal and tool call messages. Each content block is a dictionary with a `type` field indicating the content type.

**Supported content block types:**

| Type | Example |
| - | - |
| `text` | `{"type": "text", "text": "Hello AgentScope!"}` |
| `thinking` | `{"type": "thinking", "thinking": "Hmm, let me think..."}` |
| `image` | `{"type": "image", "source": {"type": "url", "url": "https://xxx/image.jpg"}}` |
| `video` | `{"type": "video", "source": {"type": "url", "url": "https://xxx/video.mp4"}}` |
| `audio` | `{"type": "audio", "source": {"type": "url", "url": "https://xxx/audio.mp3"}}` |
| `tool_use` | `{"type": "tool_use", "id": "xxxx", "name": "search", "input": {"query": "..."}}` |
| `tool_result` | `{"type": "tool_result", "id": "xxxx", "name": "search", "output": "..."}` |

**Quick examples:**

```python theme={null}
from agentscope.message import Msg

# A simple text message
msg = Msg(name="Friday", content="Hello, I'm your assistant!", role="assistant")

# Multimodal message
msg = Msg(
    name="Bob",
    content=[
        {"type": "text", "text": "How about this image?"},
        {"type": "image", "source": {"type": "url", "url": "https://example.com/image.jpg"}},
    ],
    role="user",
)

# Tool call message
msg = Msg(
    name="Alice",
    content=[
        {
            "type": "tool_use",
            "id": "xxxx",
            "name": "search",
            "input": {"query": "What's the weather today?"}
        }
    ],
    role="user",
)
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.