What you’ll build
In this quickstart, you’ll learn how to:- Create a disk for storing files
- Upload files with custom metadata
- Retrieve files with presigned URLs
- Organize files using paths
- Update metadata and manage artifacts
Prerequisites
Before you begin, ensure you have:- A running Acontext server (run locally)
- An Acontext API key (default is
sk-ac-your-root-api-bearer-token)
Initialize the client
First, create a client instance with your API key and base URL.Step-by-step tutorial
1
Create a disk
Create a new disk to store your artifacts. Each disk is an isolated storage container with a unique ID.The disk object contains:
id: Unique disk identifierproject_id: Your project IDcreated_at: ISO 8601 timestampupdated_at: ISO 8601 timestamp
Save the disk ID - you’ll need it to upload and retrieve files.
2
Upload a file
Upload your first file to the disk. You can specify a path to organize files and add custom metadata.
The
upsert method creates a new artifact or updates an existing one if a file with the same path and filename already exists.3
Retrieve a file with URL
Get an artifact and generate a presigned URL for secure downloading. You can also retrieve the file content directly.The response includes:
artifact: Full artifact object with metadatapublic_url: Presigned URL for downloading (if requested)content: Parsed file content for text, JSON, CSV, or code files (if requested)
Presigned URLs are temporary and expire after a default duration. You can customize expiration using the
expire parameter (in seconds).4
List artifacts in a path
View all files and subdirectories at a specific path.
Use this to browse your file structure and discover what’s stored in each directory.
5
Update file metadata
Modify an artifact’s metadata without re-uploading the file.
Metadata updates are efficient - you don’t need to re-upload the entire file.
6
Clean up
Delete artifacts and disks when you’re done.
You can skip this clean-up step and goto dashboard to view the artifacts (screenshot).
Complete example
Here’s a complete working example that demonstrates the full workflow:Advanced features
File upload formats
File upload formats
Both SDKs support multiple file upload formats for convenience:
Pagination for listing disks
Pagination for listing disks
When you have many disks, use pagination to retrieve them in batches:
Async/await in Python
Async/await in Python
The Python SDK includes full async support for non-blocking operations:
System metadata in artifacts
System metadata in artifacts
Each artifact includes system-generated metadata in the You can access this information alongside your custom metadata.
__artifact_info__ key:Common use cases
Agent artifacts
Store files generated by AI agents, such as reports, diagrams, or code snippets, with metadata tracking generation parameters.
User uploads
Handle user-uploaded files with custom metadata for categorization, access control, and searchability.
Document management
Build a document repository with version tracking, metadata tagging, and organized folder structures.
Build artifacts
Store build outputs, logs, and assets from CI/CD pipelines with metadata for traceability.
Troubleshooting
File not found error
File not found error
Problem: Getting a 404 error when retrieving an artifact.Solution:
- Verify the disk ID is correct
- Ensure the file path exactly matches (including leading/trailing slashes)
- Check that the filename is spelled correctly
- Use
artifacts.list()to see what files actually exist