---
title: Communication Agents
sidebarTitle: Overview
---

Bring your social platforms into your AG2 workflow with [`DiscordAgent`](/docs/api-reference/autogen/agents/experimental/DiscordAgent), [`SlackAgent`](/docs/api-reference/autogen/agents/experimental/SlackAgent), and [`TelegramAgent`](/docs/api-reference/autogen/agents/experimental/TelegramAgent).

<Tip>
If you're looking to add communication abilities to your existing AG2 agents, you can use the tools that underpin these agents, see [Discord Tools](/docs/user-guide/reference-tools/communication-platforms/discord), [Slack Tools](/docs/user-guide/reference-tools/communication-platforms/slack), and [Telegram Tools](/docs/user-guide/reference-tools/communication-platforms/telegram).
</Tip>

<Warning>
These agents are currently in our `experimental` namespace, indicating that we have tested the functionality but their interface may change. Please use them with that in mind and we appreciate any feedback on them.

If you do find any bugs please [log an issue](https://github.com/ag2ai/ag2/issues) in the AG2 repository. If you would like to add more tools or functionality, we would love your [contribution](https://docs.ag2.ai/latest/docs/contributor-guide/contributing).
</Warning>

## Installation

Install AG2 with the necessary extra for the platform(s) you need.

```bash
pip install ag2[openai,commsagent-discord]
```
```bash
pip install ag2[openai,commsagent-slack]
```
```bash
pip install ag2[openai,commsagent-telegram]
```

## Capabilities

The send functionality is consistent across agents, they take a message and post it to the configured channel/group/bot. If a message is longer than the platforms permitted message length, they will split the message into multiple messages.

The common retrieve functionality includes:
- Retrieve the latest X messages from a channel/group/bot.
- Retrieve messages since a given date.
- Retrieve messages since a given message ID.
- Retrieve a message given its ID.

TelegramAgent also has the ability to retrieve messages using a search string (and this can be done in combination with the retrieval options above).

The agent will automatically determine how to retrieve the messages based on the conversation.

## Platform configuration

Each agent is configured for a specific channel/group/bot. This configuration is applied when you create the agent.

Discord, Slack, and Telegram all have their own authentication and channel/group/bot identifiers. See this [notebook](/docs/use-cases/notebooks/notebooks/agentchat_tools_commsplatforms) for more guidance on establishing those authentication details and identifiers.

## Using the Agents

![Communication Agents and their Tools](../assets/commsagents_tools.png)

The three communication agents have two in-built tools for sending and retrieving messages, respectively. The agents will automatically determine which tool(s) to call based on the conversation (you can influence this by adjusting their system message).

| Agent | Send Tool | Retrieve Tool |
| --- | --- | --- |
| [`DiscordAgent`](/docs/api-reference/autogen/agents/experimental/DiscordAgent) | [`DiscordSendTool`](/docs/api-reference/autogen/tools/experimental/DiscordSendTool) | [`DiscordRetrieveTool`](/docs/api-reference/autogen/tools/experimental/DiscordRetrieveTool) |
| [`SlackAgent`](/docs/api-reference/autogen/agents/experimental/SlackAgent) | [`SlackSendTool`](/docs/api-reference/autogen/tools/experimental/SlackSendTool) | [`SlackRetrieveTool`](/docs/api-reference/autogen/tools/experimental/SlackRetrieveTool) |
| [`TelegramAgent`](/docs/api-reference/autogen/agents/experimental/TelegramAgent) | [`TelegramSendTool`](/docs/api-reference/autogen/tools/experimental/TelegramSendTool) | [`TelegramRetrieveTool`](/docs/api-reference/autogen/tools/experimental/TelegramRetrieveTool) |

As the agents are based on [`ConversableAgent`](/docs/api-reference/autogen/ConversableAgent) you can use them in any conversation pattern in AG2.

An important component of the new agents (as opposed to just using their tools) is that the platform's messaging requirements will be appended to their system message.

They cover aspects like maximum message length, preferred format (e.g. Markdown), and provide tips like using emojis.

| Agent | System Message guidance |
| --- | --- |
| [`DiscordAgent`](/docs/api-reference/autogen/agents/experimental/DiscordAgent) | 2,000 character limit, Markdown, bold/italic/code, use emojis |
| [`SlackAgent`](/docs/api-reference/autogen/agents/experimental/SlackAgent) | 40,000 character limit, Markdown, bold/italic/code, emojis, notification formats |
| [`TelegramAgent`](/docs/api-reference/autogen/agents/experimental/TelegramAgent) | 4,096 character limit, HTML, mentions and emojis |

These are enabled by default, but you can turn these off by setting `has_writing_instructions` to `False` when creating the agent.

## Agents

See the documentation on each of our agents, including code examples:

- [DiscordAgent](/docs/user-guide/reference-agents/communication-platforms/discordagent)
- [SlackAgent](/docs/user-guide/reference-agents/communication-platforms/slackagent)
- [TelegramAgent](/docs/user-guide/reference-agents/communication-platforms/telegramagent)

### More Code examples

See our [blog post](/docs/blog/2025-02-05-Communication-Agents/) for a demonstration of using the communication agents and this [notebook](/docs/use-cases/notebooks/notebooks/agentchat_tools_commsplatforms) for examples of using all the communication tools, and guidance on establishing the relevant authentication tokens and IDs.
