The File Object

FilesThe File Object

Your workflows make files from very different places: an email attachment, a generated image, synthesized speech, a parsed document. Inside the workflow, every one of them travels as the same thing: a file object.

What you will learn

Different payloads, identical package

A PDF, an image, and an audio clip arrive from different blocks, each delivered exactly the same way.

Read the file metadata

The common fields include an ID, name, URL, size, and MIME type. File content is not always embedded in the object.

Producers are swappable

Because every producer speaks the same format, you can change which one feeds an agent and the agent side never changes.

Consumers compose

The same object rides to any consumer, into an agent, out as an email attachment, or straight into storage.

The common shape

A file object identifies a file through fields such as id, name, url, size, and type. The bytes may be stored separately; content is not always included inline. Pass the file object to a compatible block, or use the File block to read its content. See Passing files between blocks.

The video follows an invoice attachment through parsing and extraction:

Passing files between blocks

Use a connection tag such as <file.files[0]> in a compatible block's file input. The shared object format lets blocks pass file references without copying the file's content into every parameter. The receiving block still determines which file types it can read.

Common Questions

Common fields include id, name, url, size, and MIME type. Content may be stored separately rather than embedded in the object.
Blocks can pass the same file reference through compatible file inputs. Check that the receiving block supports the file type.
Through the Files field on the Agent block, usually referenced with a connection tag such as <file.files[0]>. The agent reads the document content directly.
Yes. An image from a generator, an audio clip from text-to-speech, and an email attachment all travel as the same object, so downstream blocks treat them identically.