Skip to main content
Files capability provides session-scoped file storage. Read, write, and manage files during agent execution without external storage services.

Key Features

  • Session-Scoped Storage - Files persist within a conversation/execution
  • Read/Write Operations - Full file I/O access
  • No External Dependency - Built-in, no configuration needed
  • Automatic Cleanup - Files deleted when session ends
  • Per-File Limit - Up to 10MB per file

How to Enable

Files is automatically available on all agents and gateways. No configuration needed.

Usage Examples

Write a File

# Write JSON to file
import json
data = {"name": "Alice", "age": 30}
with open("/tmp/user.json", "w") as f:
    json.dump(data, f)
print("File written")

Read a File

# Read and parse JSON
import json
with open("/tmp/user.json", "r") as f:
    data = json.load(f)
print(data["name"])

Append to File

# Append log entry
with open("/tmp/log.txt", "a") as f:
    f.write("Event: User login\n")

List Files

ls -la /tmp/

File Operations

# Write
with open("/tmp/file.txt", "w") as f:
    f.write("content")

# Read
with open("/tmp/file.txt", "r") as f:
    content = f.read()

# Append
with open("/tmp/file.txt", "a") as f:
    f.write("more content")

# Delete
import os
os.remove("/tmp/file.txt")

File Paths

Default Location

Use /tmp/ for session-scoped files:
/tmp/data.json
/tmp/results.csv
/tmp/script.py

Limitations

  • Cannot write outside /tmp/
  • Cannot access system directories
  • Session-isolated (each execution has separate storage)

File Scopes

Session Files

Files written during agent execution, available within the same session.
- Agent conversation 1
  - /tmp/analysis.json (available throughout conversation)

- Agent conversation 2
  - /tmp/analysis.json (different file, not shared)

Persistent Storage

For data that needs to persist beyond a session, use:
  • Knowledge Retrieval (vector index)
  • External storage (HTTP Client to upload)
  • Workflow state (between runs)

Common Recipes

Store Structured Data

import json
results = {
    "queries": ["search1", "search2"],
    "found": 5,
    "timestamp": "2025-03-20"
}
with open("/tmp/results.json", "w") as f:
    json.dump(results, f, indent=2)

Process CSV

import csv
with open("/tmp/data.csv", "w") as f:
    writer = csv.writer(f)
    writer.writerow(["name", "age"])
    writer.writerow(["Alice", 30])
    writer.writerow(["Bob", 25])

Generate Reports

report = """
# Analysis Report
Generated: 2025-03-20

## Summary
- Total items: 100
- Processed: 95
- Errors: 5
"""
with open("/tmp/report.md", "w") as f:
    f.write(report)

Cache Results

import json
import os

cache_file = "/tmp/cache.json"
if os.path.exists(cache_file):
    with open(cache_file, "r") as f:
        cache = json.load(f)
else:
    cache = {}
    # Build cache
    with open(cache_file, "w") as f:
        json.dump(cache, f)

Resource Limits

LimitValueNotes
Per-File Size10MBAll scopes
Files per Scope100Per scope
Agent Home Storage50MBPersistent agent storage

Cost

For current pricing details, see Pricing.

Limitations

  • Session-scoped only - Files deleted when session ends
  • No sharing - Each session has isolated storage
  • System directories restricted - Only /tmp/ accessible
  • No real-time sync - For persistence, export to external storage

Best Practices

Use Descriptive Names

# Good
/tmp/user_analysis_2025-03-20.json

# Bad
/tmp/data.json

Clean Up Large Files

import os
if os.path.exists("/tmp/large_file.bin"):
    os.remove("/tmp/large_file.bin")

Handle Missing Files

import os
if os.path.exists("/tmp/file.txt"):
    with open("/tmp/file.txt", "r") as f:
        content = f.read()
else:
    content = "File not found"

Use Appropriate Formats

  • JSON for structured data
  • CSV for tabular data
  • Plain text for logs
  • Markdown for reports

Troubleshooting

”File Not Found”

File was in different session or manually deleted. Create new file.

”Permission Denied”

Can only write to /tmp/. Cannot write to system directories.

”Disk Full”

Exceeded storage limit. Delete large files or break into smaller sessions.

Data Lost After Session

Expected behavior. Use HTTP Client to upload results, or save to Knowledge base.

Persistence Strategies

For Short-term (single session)

Use Files capability directly.

For Long-term

  1. Export to external storage via HTTP Client
  2. Save to Knowledge base
  3. Store in workflow execution context

For Shared Data

  1. Use HTTP Client to upload to shared service
  2. Create connector to external database
  3. Use workflow outputs

Next Steps