Skip to main content
Planned Feature β€” Coming Soon

🚧 This feature is not yet released. The documentation below describes planned behavior and may change before launch.

Drives

Drives are persistent file storage workspaces for agents. Upload input data, let agents read and write files during execution, and retrieve results.

How Drives Work​

When you bind a drive to an agent, the agent automatically gets tools to:

  • Search files in the drive
  • Read file contents
  • Write files to the drive
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”       β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”       β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Upload │──────▢│ Drive │◀─────▢│ Agent β”‚
β”‚ Files β”‚ β”‚ (Storage) β”‚ β”‚ (Run) β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚
β”Œβ”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”
β”‚ Download β”‚
β”‚ Results β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Creating a Drive​

drive = client.drives.create(
name="Q1 Reports",
description="Financial reports for Q1 analysis"
)

Uploading Files​

# Upload a single file
client.drives.upload_file(
drive_id=drive.id,
path="reports/revenue.csv",
file=open("revenue.csv", "rb")
)

# Upload multiple files
for filename in ["q1_summary.pdf", "expenses.csv", "projections.xlsx"]:
client.drives.upload_file(
drive_id=drive.id,
path=f"reports/{filename}",
file=open(filename, "rb")
)

Limits: Maximum 100 MB per file upload.

Binding Drives to Agents​

agent = client.agents.create(
name="Financial Analyst",
goal="Analyze financial reports and produce a summary with key metrics.",
tools=["code_interpreter"],
drives=[drive.id]
)

The agent automatically receives these drive-specific tools:

  • drive_search β€” search for files by name or content
  • drive_read β€” read file contents
  • drive_write β€” create or update files

Listing Files​

items = client.drives.list_items(drive_id=drive.id)

for item in items:
print(f"{item.path} ({item.size} bytes)")

Downloading Files​

# Download a file created by an agent
content = client.drives.get_file(
drive_id=drive.id,
path="reports/analysis_output.pdf"
)

with open("analysis_output.pdf", "wb") as f:
f.write(content)

Managing Drives​

# List all drives
drives = client.drives.list()

# Delete a specific file
client.drives.delete_file(drive_id=drive.id, path="reports/old_report.csv")

# Delete an entire directory tree
client.drives.delete_tree(drive_id=drive.id, path="reports/archive/")

# Delete a drive
client.drives.delete(drive_id=drive.id)

Example: Data Processing Pipeline​

# 1. Create drive and upload data
drive = client.drives.create(name="Customer Data")
client.drives.upload_file(
drive_id=drive.id,
path="raw/customers.csv",
file=open("customers.csv", "rb")
)

# 2. Create agent that processes the data
processor = client.agents.create(
name="Data Processor",
goal="""Read the CSV file from the drive, clean the data by:
- Removing duplicates
- Normalizing email addresses
- Filling missing values
Save the cleaned data as 'processed/customers_clean.csv' in the drive.""",
tools=["code_interpreter"],
drives=[drive.id]
)

# 3. Run the agent
result = client.runs.wait(
client.runs.create(agent_id=processor.id, input={}).id
)

# 4. Download the processed file
clean_data = client.drives.get_file(
drive_id=drive.id,
path="processed/customers_clean.csv"
)

Next Steps​