A previous release had provenance metadata, but this release does not. View details.
This release is a pre-release and may not be stable for production use.
archil
The Python SDK for Archil disks and sandboxes. Create disks, read and write their files, run commands against them, and start persistent sandboxes, from scripts, services, CI, or notebooks.
Every method runs synchronously, and .aio(...) runs it asynchronously:
disk.put_object(...) blocks, and await disk.put_object.aio(...) doesn't.
Full documentation is at docs.archil.com.
Install
pip install archil
archil runs on Python 3.10 or later. Install archil[openai-agents] or
archil[langchain] to use the agent tools with those frameworks.
Credentials
Set ARCHIL_API_KEY and ARCHIL_REGION (for example aws-us-east-1), or pass them to
configure:
import archil
archil.configure(api_key="key-...", region="aws-us-east-1")
To work with several accounts or regions in one process, create clients with
archil.Archil(api_key=..., region=...).
Quickstart
import archil
# Create a disk, or open an existing one with archil.get_disk("dsk-...")
disk = archil.create_disk(name="my-disk").disk
# Read and write files through the object API
disk.put_object("notes/hello.txt", "hello from python")
text = disk.get_object("notes/hello.txt").decode()
# Run a command with the disk mounted at /mnt/archil
result = disk.exec("cat notes/hello.txt && ls -la")
print(result.stdout, result.exit_code)
# Start a persistent sandbox and run a command in it
sandbox = archil.create_sandbox(name="dev")
print(sandbox.exec("uname -a").stdout)
sandbox.delete()
Git hosting
archil.git on the Archil client is git hosting where every repo is a disk in your own Archil account: repos, commits without git, forks, scoped tokens for git, push webhooks and a read API. It uses the client's API key. It is a preview and may change.
Set up
- Enable git hosting in the Archil console, on the Git hosting page. It runs in your account and keeps itself up to date.
- Copy the endpoint that page shows.
- Pass it as
Archil(git_endpoint=...)(or setARCHIL_GIT_URL), with an API key from the same workspace.
Without an endpoint, every archil.git call raises ArchilGitError with code not_configured, before any request.
import os
import subprocess
from archil import Archil
from archil.git import verify_webhook
archil = Archil(region="aws-us-west-2", git_endpoint=os.environ["ARCHIL_GIT_URL"]) # key from ARCHIL_API_KEY
repo = archil.git.repos.create(name="my-app")
# git and LFS take scoped, expiring tokens, never the API key. creds.env hands the
# token to git through its environment, so it never lands in .git/config.
creds = archil.git.tokens.credentials(repo, scope="write", ttl_seconds=600)
subprocess.run(["git", "clone", repo.remote_url], env={**os.environ, **creds.env}, check=True)
for r in archil.git.repos.list(): # follows pages
print(r.name, r.disk_id)
readme = repo.blob("main", "README.md") # bytes, without cloning
tree = repo.tree("main", "src")
log = repo.log(ref="main", limit=20)
secret = archil.git.webhook.set(url="https://example.com/hooks/git") # store it
# In your webhook handler, with the raw body as received:
event = verify_webhook(raw_body, headers["X-Archil-Signature"], secret) # raises if invalid
# Async: every method has .aio
repo = await archil.git.repos.get.aio(repo.id)
Every method also has .aio. verify_signature() returns a bool instead of raising, and git_env, authenticated_remote_url and credential_helper are the same helpers as in the TypeScript package.
Commit without git
repo.commit() makes one commit from a list of file changes and moves a branch to it, without a clone. str content is sent as UTF-8 and bytes as base64. It serializes with pushes to the same branch.
from archil.git import ArchilGitError, CommitFile, CommitIdentity
result = repo.commit(
branch="main",
message="Update README",
author=CommitIdentity(name="Agent", email="agent@example.com"), # or a {"name", "email"} dict
files=[
CommitFile(path="README.md", content="hello\n"),
CommitFile(path="bin/run.sh", content="#!/bin/sh\n", mode="100755"),
{"path": "logo.png", "content": png_bytes}, # dicts work too
CommitFile(path="old.txt", delete=True),
],
expected_head=previous.commit, # optional: refuse unless main is still here
)
result.commit, result.parent # parent is None for a root commit
try:
repo.commit(branch="main", message="m", author=author, files=files, expected_head=stale_sha)
except ArchilGitError as e:
if e.code == "head_mismatch":
print("main moved to", e.current_head) # None if the branch doesn't exist
committer defaults to author. A branch that doesn't exist yet starts at base_ref (a branch, tag, full ref or commit); without it, the commit is a root commit, which is allowed only in an empty repo. expected_head="0" * 40 asserts that the branch doesn't exist. Deletes apply before upserts. Other codes: path_conflict (a file where a directory is, or the reverse), path_not_found (a delete of a path that isn't a file), branch_not_found and base_ref_not_found. The limits are 10,000 files and 64 MiB per request.
Fork a repo
repo.fork() makes a new repo whose disk is a copy-on-write Archil branch of the source's, so it is ready in about a second whatever the repo's size. Writes to either never reach the other, and a token for one doesn't open the other.
fork = repo.fork(name="my-app-experiment") # ref="v1.2" points its default branch elsewhere
fork.fork_of # repo.id
fork.commit(branch="main", message="try it", author=author, files=[...])
fork.delete() # immediate: the fork disappears and its tokens stop working
repo.delete(cascade=True) # a repo with live forks needs cascade, which deletes them too
Deleting a fork is immediate for users; its storage is reclaimed when the family's root disk is deleted, since Archil can't delete a single branch yet. Deleting a repo that still has live forks raises ArchilGitError with status 409 and code has_forks, and e.forks lists them ([{"id", "name"}]). Pass cascade=True to delete the forks first, then the disk.
fork.disk_branch names the fork's Archil branch of the shared disk.
Retries
The git service pauses when idle and wakes on the next request, answering 502 or 503 meanwhile. The SDK makes up to 3 attempts for requests that are safe to repeat: every GET (the read API, get, list) and tokens.mint. It retries a dropped connection and a 502, 503 or 504, and waits as long as Retry-After says (at most 10 s), or 0.25 s and then 1 s.
It never resends a request that could apply twice: create, fork, delete and webhook.set are sent once. A commit is resent only when the server answers 503 unavailable, which means nothing was applied. After any other failure, a commit may or may not have landed: resend it yourself only with expected_head set, so a resend of a commit that landed fails with head_mismatch instead of committing twice.
Error codes
Every ArchilGitError has a code from the same set as the TypeScript SDK:
code |
Status | When |
|---|---|---|
bad_request |
400 | A malformed request or a field breaking the rules |
unauthorized |
401 | No credential, or one of another workspace |
forbidden |
403 | A read-only token used to write |
not_found |
404 | Unknown repo, ref or path, or a token that doesn't cover the repo |
conflict |
409 | The name is taken |
head_mismatch |
409 | A commit's expected_head is stale; see current_head |
has_forks |
409 | Deleting a repo with live forks without cascade; see forks |
payload_too_large |
413 | A request or result over the limits |
branch_not_found, base_ref_not_found, path_not_found, path_conflict |
422 | A commit that can't apply |
unprocessable |
422 | Any other request that can't apply, such as a fork ref that names no commit |
rate_limited |
429 | Too many requests |
server_error |
500 | An internal error |
not_implemented |
501 | The workspace's disks can't be branched, so it can't fork |
unavailable |
502, 503 | The service is waking from a pause or briefly unreachable |
timeout |
504 | A read took too long |
network_error |
0 | No response arrived |
not_configured |
0 | No endpoint; nothing was sent |
The service's routes report errors in different shapes. The SDK maps them all to this set: the commit API's invalid_request becomes the code for its status, too_large becomes payload_too_large and internal_error becomes server_error. A proxy's plain-text 502 or 503 is unavailable.
Agent tools
disk.agent_tools() gives an agent a filesystem toolset over a disk:
from agents import Agent
agent = Agent(name="analyst", tools=archil.get_disk("dsk-...").agent_tools().for_openai_agents())
Use .for_langchain() for LangChain.
Documentation
- SDK overview: packages, credentials, and regions
- Python SDK: clients, async, and errors
- Disks and data sources: create disks backed by S3, GCS, R2, and more
- Serverless execution: run commands against one or more disks
- Search files: grep a disk on the server
- Sandboxes: persistent microVMs, processes, ports, and files
- Sandbox images and firewall
- Branches and checkpoints and sharing disks
Support
Questions, feature requests, or issues? Reach us at support@archil.com.
Metadata
Release files for archil 0.25.1.dev20261202160135
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Loss of provenance
These files do not have provenance metadata, despite files in a prior release including this data.
We recommend further investigation before installing these files. View details.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| archil-0.25.1.dev20261202160135.tar.gz | 114.7 kB | Without provenance | Details for archil-0.25.1.dev20261202160135.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| archil-0.25.1.dev20261202160135-py3-none-any.whl | Python 3 | none | any | Details for archil-0.25.1.dev20261202160135-py3-none-any.whl |
Total release size: 244.4 kB
Release files / archil-0.25.1.dev20261202160135.tar.gz
Loss of provenance
This file belongs to a release without provenance metadata, despite a prior release including this data.
We recommend further investigation before installing this file. View details.
| Download URL | archil-0.25.1.dev20261202160135.tar.gz |
|---|---|
| Size | 114.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
306ebfce7e2d9d4cfc265360989cdef0ee7625008bee58c1258fb54500a0477f
|
|
BLAKE2b-256 checksum How to use checksums |
c17f16a45869dfbdc37f6909da3e20a0b2b742bf6ff0099d2633d2deca8ab0a8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.12 {"installer":{"name":"uv","version":"0.13.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / archil-0.25.1.dev20261202160135-py3-none-any.whl
Loss of provenance
This file belongs to a release without provenance metadata, despite a prior release including this data.
We recommend further investigation before installing this file. View details.
| Download URL | archil-0.25.1.dev20261202160135-py3-none-any.whl |
|---|---|
| Size | 129.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6e8c8c1033d75621508153bd6dea040b7f89874491c1fcff74674ec1705dedfe
|
|
BLAKE2b-256 checksum How to use checksums |
00f7d9a8e40032a622fea6823dd3ff95464326b882f900ccbedb33ab3d13248b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.12 {"installer":{"name":"uv","version":"0.13.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for archil 0.25.1.dev20261202160135
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Loss of provenance
A previous release of these files had provenance metadata, but this release does not.
While this could reflect a routine change by the project maintainers, it may also indicate that the release files have been compromised.
Release comparison
- Removed 0.23.0 2 files With provenance
- Added 0.25.1.dev20261202160135 2 files Without provenance
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.