Skip to main content
Artifacts are binary objects generated during agent interactions, such as images, videos, audio files, and documents. When agents perform operations like image generation, face blurring, video trimming, or document processing, the results are stored as artifacts that can be retrieved using object references.

Object References

Agent responses return object references (refs) instead of raw binary data. Each reference is a string identifier that follows a specific format: a 3-5 letter type prefix followed by an underscore and a 6-digit hexadecimal string (e.g., img_a1b2c3). Import reference types from the SDK:

Retrieving an Artifact

In a Chat Completion

To retrieve a chat completion artifact, use the session_id from the chat response and the object_id (returned as a Ref type) from the JSON result.

Common Use Cases

Multi-modal Artifacts

Generate multi-modal artifacts such as images and videos.

Multiple Artifacts

Generate multiple images of a scene (e.g. virtual try-on, video thumbnails, etc.).

Document Processing

Redact sensitive information from documents, and return the processed document as a PDF.

3D Reconstruction

Generate 3D models from images or videos, and return ply/spz files.

Best Practices

When working with artifacts, keep these guidelines in mind:
  • For large artifacts like videos, the Python and Node SDKs download files to disk rather than loading them into memory. This prevents memory issues when working with large files. Always check the file size before loading video content into memory.
  • Use structured response models with appropriate Ref types (ImageRef, VideoRef, etc.) to ensure type safety and enable IDE autocompletion. The Python and Node SDKs will automatically handle the conversion to the appropriate Python type when retrieving artifacts.

API Reference

View the complete API reference for artifact retrieval