Files and multimodal input

Pass managed Slack and Teams attachments to multimodal agents and post supported files back to the conversation.

Managed Channels can download provider attachments into message.contentParts. The SDK carries text, images, audio, video, and PDF documents in one provider-neutral prompt shape.

Pass attachments to the agent

On managed Channels, the agent history already holds the current message. When the message has files, the SDK adds them to that message as content parts. Call runAgent() without a prompt to send both:

channel.ts
channel.onMessage(async ({ thread }) => {
  await thread.runAgent();
});

message.contentParts holds the same parts: the message text first, then one part for each file. Read it when your handler must check the files before the run.

Understand the content mapping

Provider fileAgentContentPart
Image MIME type{ type: "image", source: { type: "data", value, mimeType } }
Audio MIME type{ type: "audio", source: ... }
Video MIME type{ type: "video", source: ... }
PDF{ type: "document", source: ... }
text/*UTF-8 { type: "text", text }
Other binary typeA text note naming the attachment and MIME type

The binary value is base64. Whether the agent actually understands a media part depends on its selected model and framework. Choose a multimodal model and test the exact media types you accept.

File download is best-effort. A provider-ingest failure can omit the attachment before the SDK receives a file handle. If Intelligence sends a file handle but the SDK cannot download the file, the SDK adds a short failure note ([attached file <name> could not be retrieved]) instead of failing the whole turn.

Managed file-size ceiling

Intelligence currently accepts individual inbound and outbound Channel files up to 25 MiB. Provider limits can be lower.

Slack file access

Intelligence downloads files using the managed Slack bot token. The app must be in the conversation and have permission to read the file. Slack documents files:read as the scope that allows an app to download files from conversations it can access.

The current Intelligence-generated manifest requests both files:read and files:write. If the app predates that manifest:

  1. Open the Channel in Intelligence, return to its Slack setup instructions, and apply the generated manifest so both bot token scopes are present. See Configure the Channel in Intelligence.
  2. Reinstall the app so the workspace grants the scopes.
  3. Copy the current Bot User OAuth token into Intelligence if Slack reissued it.
  4. Invite the app to the source conversation.
  5. Send a new file and verify the model receives it.

If attachments are omitted or arrive as failure notes:

  1. Confirm the reinstalled bot token includes files:read.
  2. Confirm the app is a member of the source conversation.
  3. Send a new file and inspect the real agent turn.

Post a file

thread.postFile() takes bytes and returns a result instead of throwing for an unsupported provider capability:

export-report.ts
const csv = new TextEncoder().encode(
  ["id,status", "INC-421,investigating"].join("\n"),
);

const result = await thread.postFile({
  bytes: csv,
  filename: "incident-report.csv",
  title: "Incident report",
  altText: "CSV export of the incident report",
});

if (!result.ok) {
  await thread.post(`The report could not be attached: ${result.error}`);
}

On managed Channels, result.ok means Intelligence stored the managed asset, the provider acknowledged the file or image effect, and the SDK recorded the asset in canonical Thread history.

Managed Slack uses Slack's external-upload flow and can send general file types. The generated manifest includes the files:write bot scope. Apply the current manifest and reinstall if the Slack app predates it. Check result.ok, then verify the real Slack message when provider-side display matters.

Treat attachments as untrusted input

  • Validate declared MIME type and file signature before application-side processing.
  • Put limits on decompression, parsing, page count, and extracted text.
  • Do not execute macros or uploaded code.
  • Resolve the provider user to an authenticated application identity before a file can trigger a consequential write.
  • Avoid logging base64 content, signed download URLs, or document text.

See the IncomingMessage reference and AgentContentPart reference for the exact public shapes.

How is this guide?