Skip to main content
How ABP handles binary data (PDFs, images, audio) across different transports.

Overview

Many ABP capabilities produce or consume binary data: ABP defines standard formats for representing and transferring binary data across different transports.

Why Binary Handling Needs Standardization

Without standardization, each app implements binary handling differently, making agents unable to reliably consume binary responses.

Design Decisions

What We Explicitly Chose NOT to Do

  1. No streaming — Adds complexity, most browser operations produce complete files
  2. No chunked transfer — Can be added later if large file handling proves insufficient
  3. No compression requirement — Apps MAY compress, but it’s not mandated
  4. No binary WebSocket frames in v1 — Base64 is simpler and sufficient for most cases

BinaryData Format

Binary data in ABP responses uses a standard wrapper:

Example Response with Binary Data

Key points:
  • mimeType is REQUIRED — agents need this to handle data correctly
  • encoding is REQUIRED when content is a string — tells the agent how to decode
  • size is RECOMMENDED — helps agents allocate buffers and show progress
  • filename is OPTIONAL — provides a sensible default for saving

BinaryDataReference (Large Files)

For files larger than a reasonable threshold (recommended: 10MB), apps SHOULD provide a download URL instead of inline content:

Example Large File Response

Agent Handling

Transport-Specific Handling

Each transport has different capabilities for binary data:

Puppeteer/Playwright Transport

Puppeteer supports direct binary transfer via structured cloning:

postMessage Transport

postMessage supports structured cloning with transferable objects (zero-copy):

WebSocket Transport

WebSocket uses Base64 encoding for JSON compatibility:

Transport Comparison

Binary Input

Some capabilities accept binary input (e.g., image processing):

For Puppeteer/postMessage

Agents MAY send ArrayBuffer directly:

Capability Schema Conventions

Capabilities that produce binary output SHOULD document this in their schema:

Best Practices

For App Developers

  1. Always include mimeType — Agents need this to handle the data correctly
  2. Include size when known — Helps agents allocate buffers and show progress
  3. Use downloadUrl for files > 10MB — Avoids memory issues
  4. Set reasonable expiresAt for download URLs (1 hour minimum recommended)
  5. For WebSocket, always set encoding: 'base64' when content is Base64

Example: Size-Based Routing

For Agent/Client Developers

  1. Check for downloadUrl first — Handle large files appropriately
  2. Verify size matches actual content when provided
  3. Use filename for saving if provided, generate sensible default otherwise
  4. Handle both inline content and download URLs transparently

Union Type

For TypeScript implementations, use a union type:
This allows capabilities to return either inline binary data or a download reference.

Next Steps

Data Flow

MCP Bridge’s client-side routing logic

Building ABP Apps

Build your first ABP app

API Reference

Full API specification