AgentLabs - Docs
  • Introduction
    • What is AgentLabs?
    • Get Started with AgentLabs
    • Pricing
  • Getting Started
    • Installation
    • Secret Key
    • Using the SDK
  • Core Concepts
    • Frontend as a service
    • User Authentication
    • Project
    • Agents
    • Messages
      • Messages Format
      • One-off vs Stream
      • Typewriter animation
    • Attachments
  • Recipes
    • Before we start
    • Ping-Pong
    • ChatGPT with LangChain
    • Code Interpreter
    • Mutli-Agent with AutoGen
  • 🧙Community
    • Github
    • Discord
    • Support team
Powered by GitBook
On this page
  • Introduction
  • How to send an attachment
  • Going further
  1. Core Concepts

Attachments

PreviousTypewriter animationNextBefore we start

Last updated 1 year ago

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.

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.

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],
)
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],
});

You can pass as many attachments as you want. We also support all mime types as long as each file does not exceed 10MB.

Going further

Here's the result:

If you want to go further with attachments, you can check where we show you how to create a basic midjourney clone.

this example
A basic midjourney clone
Example of 3 attachments sent in a message
Example of zip files