Skip to main content
Multi-modal inputs allow you to pass various types of content—text, images, videos, audio files, and documents—to agents in a consistent, type-safe format. The MessageContent type provides a unified interface for encoding different media types, whether you’re executing agents or using chat completions.

MessageContent Overview

MessageContent is a Pydantic model that encapsulates different types of input content with validation. It supports six content types: Import MessageContent and related types from the SDK:

Input Types

Text Input

Use text for plain text instructions, questions, or prompts:

Image Input

Use image_url for images accessible via HTTP/HTTPS URLs. The ImageUrl type supports an optional detail parameter to control image processing quality:
The detail parameter accepts:
  • "auto" (default): Automatically determines the appropriate detail level
  • "low": Lower resolution, faster processing
  • "high": Higher resolution, more detailed analysis

Video Input

Use video_url for videos accessible via HTTP/HTTPS URLs:

Audio Input

Use audio_url for audio files accessible via HTTP/HTTPS URLs:

Document / File Input (URL)

Use file_url for documents and other file types accessible via HTTP/HTTPS URLs:

Document / File Input (Upload)

Use input_file with a file ID for files uploaded via the Files API. This is the recommended approach for files you want to manage through VLM Run’s file storage:
When using input_file, you can provide either file_id (from Files API upload) or file_url (presigned URL or public URL). The SDK automatically handles file retrieval and processing.

Using Multi-modal Inputs

Agents can accept multiple inputs of different types. Define each input as a separate field in your input model:
Python

In an Agent Execution

When executing agents, define typed and compound input models using MessageContent for type safety and validation:

In a Chat Completion

For chat completions, use arrays of content objects in the OpenAI-compatible format. Each message can contain multiple content items:

Toolset Selection

The toolsets parameter allows you to explicitly specify which tool categories the agent should use for processing your request. This gives you fine-grained control over the agent’s capabilities and can improve performance by limiting the tools to only those needed for your task.

Available Tool Categories

Usage Examples

When you know exactly which capabilities your task requires, specifying toolsets can improve response time and reduce costs by avoiding unnecessary tool routing overhead.

Best Practices

When working with multi-modal inputs, follow these guidelines:
  • Use input_file for production: Upload files via the Files API and use file_id for better security, access control, and file management. URL-based inputs are convenient for development and testing.
  • Specify image detail levels: Use detail="high" for images requiring fine-grained analysis (e.g., medical imaging, document OCR). Use detail="low" for faster processing when high detail isn’t needed.
  • Validate URLs before use: Ensure all URLs are publicly accessible and use HTTPS when possible. The SDK validates URL format but cannot verify accessibility.
  • Use typed input models: Define Pydantic models for agent execution inputs to leverage type checking, IDE autocompletion, and automatic validation.
  • Handle large files appropriately: For large videos or documents, prefer uploading via the Files API rather than using public URLs, as the Files API provides better error handling and progress tracking.
  • Combine text with media: Always include text instructions alongside media inputs to provide context and specify the desired operation.
For chat completions, you can mix text and media in a single message’s content array. This allows you to provide both instructions and the media to process in one request.

URL Validation

All URL-based input types (image_url, video_url, audio_url, file_url) require valid HTTP or HTTPS URLs. The SDK automatically validates URLs:

Common Use Cases

Image Analysis

Process images with text instructions for classification, object detection, or transformation.

Document Processing

Extract structured data from PDFs, Word documents, and other file formats.

Video Analysis

Analyze video content for transcription, scene detection, or frame extraction.

Multi-modal Tasks

Combine multiple input types (text, images, documents) for complex processing workflows.

Artifacts

Learn how to retrieve generated artifacts from agent responses

Agent Execution

Execute agents with multi-modal inputs and retrieve structured results

Agent Creation

Create reusable agents that accept multi-modal inputs