Prerequisites
Example 1: Check for Attached Files
First, check if a prompt has any files attached:Expected output
Expected output
Example 2: Download a Single File
Download a file and save it to disk:Example 3: Download All Files
Download all files attached to a prompt:Example 4: Download and Process Text Files
Download and read text-based files:Example 5: Download CSV Files
Download and parse CSV files:Example 6: Download JSON Files
Download and parse JSON files:Example 7: Download Images
Download image files:Example 8: Get File Information
Examine file metadata before downloading:Example 9: Download with Progress
Show download progress for large files:Example 10: Conditional Downloads
Only download files that meet certain criteria:Example 11: Use Signed URLs
Get signed URLs for direct download access:Signed URLs are temporary and expire after a certain period. Always download files when needed rather than storing URLs.
Example 12: Handle Download Errors
Robust error handling for file downloads:Next Steps
Basic Usage
Learn basic SDK operations
Pagination
Iterate through all prompts
Error Handling
Handle errors gracefully
Context Guide
Detailed context documentation