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β
- Python
- JavaScript
drive = client.drives.create(
name="Q1 Reports",
description="Financial reports for Q1 analysis"
)
const drive = await client.drives.create({
name: "Q1 Reports",
description: "Financial reports for Q1 analysis"
});
Uploading Filesβ
- Python
- JavaScript
# 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")
)
await client.drives.uploadFile({
driveId: drive.id,
path: "reports/revenue.csv",
file: fs.createReadStream("revenue.csv")
});
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 contentdrive_readβ read file contentsdrive_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β
- Versioning β manage agent versions
- Building Your First Agent β complete tutorial