Files

Files in Julep allow agents to work with various types of data including documents, images, audio, and other media. Files are stored securely and can be accessed by agents and tasks as needed.

Overview

Julep’s file system provides:

  • Secure storage for various file types
  • Unique identifiers for consistent access
  • Metadata for organization and discovery
  • Content hashing for integrity verification
  • Project association for logical grouping

File Properties

Each file in Julep has the following properties:

FieldTypeDescriptionDefault
namestringName of the fileRequired
projectstringThe canonical name of the project this file belongs to"default"
contentstringBase64-encoded file contentRequired
descriptionstringDescription of the file""
mime_typestringMIME type of the filenull
sizenumberSize of the file in bytes (read-only)Auto-calculated
hashstringHash of the file content (read-only)Auto-calculated
created_atstringCreation timestamp (read-only)Auto-generated

Creating Files

You can create files using the Julep SDK in Python or JavaScript:

from julep import Julep
import base64

client = Julep(api_key="your_api_key")

# Read a local file and encode it as base64
with open("path/to/document.pdf", "rb") as file:
    content = base64.b64encode(file.read()).decode("utf-8")

# Create the file in Julep
file = client.files.create(
    name="document.pdf",
    project="knowledge-base",
    content=content,
    description="Important document for reference",
    mime_type="application/pdf"
)

print(f"Created file: {file.id}")

Managing Files

Retrieving Files

# Get a specific file by ID
file = client.files.get("file_id_here")
print(file)

# List all files
files = client.files.list()
for file in files:
    print(f"{file.name}: {file.description}")

# List files with filtering
files = client.files.list(metadata_filter={"category": "report"})

Deleting Files

# Delete a file
client.files.delete("file_id_here")

Relationship to Other Concepts

Projects

Files belong to exactly one project, which helps organize related resources together. When creating a file, you can specify which project it belongs to using the project parameter. If not specified, the file will be assigned to the “default” project.

Example:

# Create a file in a specific project
file = client.files.create(
    name="marketing-image.jpg",
    project="product-launch",
    content=base64_content,
    mime_type="image/jpeg"
)

For more information about projects, see Projects.

Agents and Tasks

Files can be used by both agents and tasks to access and process information. For example, an agent might analyze an image file, or a task might process a document file.

# Create a file
file = client.files.create(name="data.csv", content=base64_content)

# Reference the file in a task execution
execution = client.tasks.executions.create(
    task_id="task_id_here",
    input={"file_id": file.id}
)

Best Practices

File Organization

  • Group related files in the same project
  • Use consistent naming conventions
  • Include descriptive metadata for better discovery

Performance

  • Keep file sizes reasonable for faster processing
  • Consider chunking large files into smaller ones
  • Be mindful of the content limits when Base64 encoding

Security

  • Avoid storing sensitive information in files
  • Regularly audit and clean up unused files
  • Validate file types before uploading

Next Steps

  • Projects - Learn about organizing resources with projects
  • Agents - Learn how agents can work with files
  • Tasks - Learn how to use files in task workflows