# Attachments

## Introduction

Sending attachments is particularly useful if you want your agent backend to send some images or any other files to your users.

AgentLabs SDK allows you to effortlessly send attachments along with your messages.

Some attachments like Images will be displayed with a lightbox preview, others like zip files will be displayed as simple downloadable files.

<figure><img src="https://2332253210-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9YXfNoIzbidkaC4JWWjU%2Fuploads%2FsWnNyS2JxUaIMfXyPoRO%2FScreenshot%202023-10-26%20at%2016.23.46.png?alt=media&#x26;token=60007215-8ff3-425e-ab98-3209ae3aea31" alt=""><figcaption><p>Example of 3 attachments sent in a message</p></figcaption></figure>

<figure><img src="https://2332253210-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9YXfNoIzbidkaC4JWWjU%2Fuploads%2F6NZxYoOo8BhqC4CAyPqm%2FScreenshot%202023-10-26%20at%2016.46.03.png?alt=media&#x26;token=9d0146f9-8c63-422f-9880-b45b90691728" alt=""><figcaption><p>Example of zip files</p></figcaption></figure>

## How to send an attachment

Sending attachments is super easy. You only have to instantiate an Attachment and then pass it to the `send` method as an argument.

{% tabs %}
{% tab title="Python" %}

```python
from agentlabs.attachment import Attachment

attachment = Attachment.from_local_file("path-to-your-file")
    
agent.send(
    conversation_id=message.conversation_id,
    text="Here is your zip file",
    attachments=[attachment],
)
```

{% endtab %}

{% tab title="Typescript" %}

```typescript
import {Attachment} from "@agentlabs/node-sdk";

const attachment = Attachment.fromLocalFile('path-to-your-file')

await agent.send({
    text: 'Here is an image for you...',
    conversationId: '<your-conversation-id>',
    attachments: [attachment],
});
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
You can pass as many attachments as you want. We also support all mime types as long as each file does not exceed 10MB.
{% endhint %}

## Going further

If you want to go further with attachments, you can check[ this example](https://github.com/agentlabs-inc/agent-examples/tree/main/nodejs-examples/ts-midjourney-clone-basic) where we show you how to create a basic midjourney clone.

Here's the result:

{% embed url="<https://youtu.be/hf2yARAHsog>" %}
A basic midjourney clone
{% endembed %}
