File Sharing
This guide shows you how to share files and data between agents using Artifact Hub.
Uploading Files
Section titled “Uploading Files”From Bytes
Section titled “From Bytes”from acenta import AcentaClient
client = AcentaClient(api_key="...")
# Upload from byteswith open("report.pdf", "rb") as f: data = f.read()
artifact = await client.artifact.create( name="quarterly-report.pdf", content_type="application/pdf", data=data, metadata={ "quarter": "Q4", "year": 2025, "department": "engineering" })
print(f"Created: {artifact.id}")From File Path
Section titled “From File Path”artifact = await client.artifact.upload_file( path="/path/to/large-file.zip", name="backup.zip", metadata={"type": "backup"})Snippets (Small JSON Data)
Section titled “Snippets (Small JSON Data)”artifact = await client.artifact.create_snippet( name="config.json", content={ "model": "gpt-4", "temperature": 0.7, "max_tokens": 2000 })Downloading Files
Section titled “Downloading Files”To Memory
Section titled “To Memory”data = await client.artifact.download(artifact_id="art_xxx")
# Process the dataresult = process(data)To File
Section titled “To File”await client.artifact.download_file( artifact_id="art_xxx", path="/path/to/output.pdf")Get Metadata Only
Section titled “Get Metadata Only”artifact = await client.artifact.get(artifact_id="art_xxx")print(f"Name: {artifact.name}")print(f"Size: {artifact.size_bytes}")print(f"Type: {artifact.content_type}")print(f"Created: {artifact.created_at}")Signed URLs
Section titled “Signed URLs”Generate temporary URLs for direct access:
# Get download URL (valid for 1 hour by default)url = await client.artifact.get_signed_url( artifact_id="art_xxx", expires_in=3600)
# Use in external systemsprint(f"Download URL: {url}")Upload URLs
Section titled “Upload URLs”For large files, get a signed upload URL:
upload = await client.artifact.get_upload_url( name="large-file.bin", content_type="application/octet-stream", size_bytes=1073741824 # 1 GB)
# Upload directly to the URLimport httpxasync with httpx.AsyncClient() as http: with open("large-file.bin", "rb") as f: await http.put(upload.url, content=f)
# Confirm uploadartifact = await client.artifact.confirm_upload(upload.id)Versioning
Section titled “Versioning”Update an Artifact
Section titled “Update an Artifact”# Original versionartifact = await client.artifact.create( name="model.pt", data=model_v1_bytes)
# Update creates a new versionartifact = await client.artifact.update( artifact_id=artifact.id, data=model_v2_bytes, metadata={"version": "2.0"})List Versions
Section titled “List Versions”versions = await client.artifact.list_versions(artifact_id=artifact.id)
for v in versions: print(f"Version {v.version}") print(f" Created: {v.created_at}") print(f" Size: {v.size_bytes}")Download Specific Version
Section titled “Download Specific Version”data = await client.artifact.download( artifact_id=artifact.id, version=1 # Get version 1)Sharing
Section titled “Sharing”Share with Agents
Section titled “Share with Agents”await client.artifact.share( artifact_id="art_xxx", with_agents=["agent-a", "agent-b", "agent-c"])Share with Groups
Section titled “Share with Groups”await client.artifact.share( artifact_id="art_xxx", with_groups=["data-science-team", "ml-team"])Check Access
Section titled “Check Access”access = await client.artifact.get_access(artifact_id="art_xxx")print(f"Shared with agents: {access.agents}")print(f"Shared with groups: {access.groups}")Unshare
Section titled “Unshare”await client.artifact.unshare( artifact_id="art_xxx", agents=["agent-a"], groups=["data-science-team"])Listing Artifacts
Section titled “Listing Artifacts”All Artifacts
Section titled “All Artifacts”artifacts = await client.artifact.list()
for a in artifacts: print(f"{a.id}: {a.name} ({a.size_bytes} bytes)")With Filters
Section titled “With Filters”# Filter by metadataartifacts = await client.artifact.list( metadata_filter={"department": "engineering"})
# Filter by content typeartifacts = await client.artifact.list( content_type="application/pdf")
# Paginationartifacts = await client.artifact.list( limit=10, offset=20)Shared With You
Section titled “Shared With You”shared = await client.artifact.list_shared()
for a in shared: print(f"{a.name} (from {a.owner})")Deleting Artifacts
Section titled “Deleting Artifacts”Delete Artifact
Section titled “Delete Artifact”await client.artifact.delete(artifact_id="art_xxx")Delete Specific Version
Section titled “Delete Specific Version”await client.artifact.delete_version( artifact_id="art_xxx", version=1)Workflow Integration
Section titled “Workflow Integration”Use artifacts in Coordination Hub workflows:
{ "id": "download_data", "type": "agent", "agent": "data-loader", "input": { "artifact_id": "{{ input.artifact_id }}" }},{ "id": "process", "type": "agent", "agent": "processor", "depends_on": ["download_data"], "input": { "data": "{{ steps.download_data.output.data }}" }},{ "id": "save_result", "type": "agent", "agent": "artifact-saver", "depends_on": ["process"], "input": { "result": "{{ steps.process.output }}", "name": "processed-{{ input.artifact_id }}.json" }}Next Steps
Section titled “Next Steps”- Monitoring - Track artifact operations
- Security - Secure file handling
- API Reference - Complete API documentation