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

# Discord Agent With Media

> Runs a Discord bot that can analyze user-provided media.

```python agent_with_media.py theme={null}
"""
Discord Agent With Media
========================

Runs a Discord bot that can analyze user-provided media.
"""

from agno.agent import Agent
from agno.integrations.discord import DiscordClient
from agno.models.google import Gemini

# ---------------------------------------------------------------------------
# Create Agent
# ---------------------------------------------------------------------------
media_agent = Agent(
    name="Media Agent",
    model=Gemini(id="gemini-3.5-flash"),
    description="A Media processing agent",
    instructions="Analyze images, audios and videos sent by the user",
    add_history_to_context=True,
    num_history_runs=3,
    add_datetime_to_context=True,
    markdown=True,
)

discord_agent = DiscordClient(media_agent)


# ---------------------------------------------------------------------------
# Run Discord Bot
# ---------------------------------------------------------------------------
if __name__ == "__main__":
    discord_agent.serve()
```

## Run the Example

<Steps>
  <Snippet file="create-venv-step.mdx" />

  <Step title="Install dependencies">
    ```bash theme={null}
    uv pip install -U agno discord discord.py google-genai
    ```
  </Step>

  <Step title="Export environment variables">
    <CodeGroup>
      ```bash Mac/Linux theme={null}
      export DISCORD_BOT_TOKEN="your_discord_bot_token_here"
      export GOOGLE_API_KEY="your_google_api_key_here"
      ```

      ```bash Windows theme={null}
      $Env:DISCORD_BOT_TOKEN="your_discord_bot_token_here"
      $Env:GOOGLE_API_KEY="your_google_api_key_here"
      ```
    </CodeGroup>
  </Step>

  <Step title="Run the example">
    Save the code above as `agent_with_media.py`, then run:

    ```bash theme={null}
    python agent_with_media.py
    ```
  </Step>
</Steps>

Full source: [cookbook/05\_agent\_os/interfaces/discord/agent\_with\_media.py](https://github.com/agno-agi/agno/blob/main/cookbook/05_agent_os/interfaces/discord/agent_with_media.py)
