agent2drive
One command connects an agent to your Google Drive. One command per upload. That's the whole product.
An agent writes files locally; you review them in Drive. No video-generation model, no stock footage, no public redirect server, no broad Drive access — just a narrow drive.file scope and a paste-back OAuth code.
Install
pipx install agent2drive # recommended
# or
python3 -m pip install --user agent2drive
One-line bootstrap for an agent to run for you:
curl -fsSL https://raw.githubusercontent.com/Bilal140202/agent2drive/main/install.sh | sh
See AGENT_SETUP.md for the exact prompt to give an agent; skills/agent2drive/SKILL.md is a drop-in skill for OpenCode/Claude-style agents.
Connect (one time)
Using your own OAuth client is strongly recommended — rclone's shared public client is being retired during 2026. Create a Desktop OAuth client in Google Cloud with redirect URI http://127.0.0.1:53682/, then:
agent2drive client <client_id> <client_secret> # stored chmod 600, gitignored
agent2drive url
- Give the user the printed consent URL.
- They click Allow. Google may warn " hasn't verified this app" → Advanced → Go to rclone (unsafe) → Allow.
- The browser fails to load
127.0.0.1:53682. That failure is expected — it only runs on the user's machine. They copy the full address-bar URL and paste it back. - You exchange it immediately (single-use, ~10-minute TTL):
agent2drive connect '<PASTED_URL>'
# or: agent2drive connect --stdin (safer: keeps the code out of shell history)
agent2drive status
If you skip client, the tool falls back to deriving rclone's published default client from its own binary. It works today but is rate-limit-prone and will stop working when Google retires that client.
Commands
| Command | What it does |
|---|---|
status |
Live token check (AUTH_OK / AUTH_MISSING, exit 0/2) |
url |
Print the consent URL and store a one-time state nonce |
client [ID] [SECRET] |
Set your own OAuth client (prompts if omitted) |
connect [URL] / connect --stdin |
Exchange the pasted redirect URL |
init <slot> |
Create a slot root and MANIFEST.md |
upload <slot> <file> [folder] [--replace] |
Upload, verify, and log to the manifest |
ls <slot> |
List everything in a slot |
manifest <slot> |
Print the delivery manifest |
Verified uploads — not just size
The original release claimed "byte-exact verification" but only compared file sizes. Now every upload is checked three ways:
- size from
rclone lsjson - MD5 and SHA-1 from
rclone hashsum(both natively supported by Google Drive)
A mismatch deletes the remote copy, fails loudly, and writes nothing to the manifest. If hashes can't be read, the manifest records SIZE-ONLY and the command exits non-zero. These hashes detect accidental corruption; they are not a cryptographic authenticity guarantee.
Same-name uploads fail by default. Pass --replace to overwrite deliberately, so a reviewer isn't silently robbed of an earlier draft.
Slots and the manifest
Everything lives under one root (default AgentDeliveries, override with GDRIVE_ROOT), one folder per project:
AgentDeliveries/
<slot>/
MANIFEST.md
<your folders>/ created on demand; one component, no traversal
init creates only the slot root and manifest — no imposed category tree. Every successful upload appends a row with UTC time, filename, folder, bytes, MD5, SHA-1, and result. That gives you an audit trail of what the agent delivered and when. Slot names are restricted to lowercase letters, digits and hyphens; path traversal is rejected.
Self-restoring, cross-platform
A missing or wrong-architecture rclone binary is re-downloaded for the current platform (linux-amd64, linux-arm64, osx-*, windows-*), architecture-checked, and smoke-tested before use. Override with RCLONE_ZIP=<url> for unusual platforms.
The refresh token in state/rclone/rclone.conf (chmod 600, gitignored) is the only thing that can't be rebuilt. Lose it and one fresh consent click restores everything; nothing already on Drive is affected.
State lives beside the source in a checkout, and in ~/.config/agent2drive/ for a pip/pixi install (override with A2D_HOME, or XDG_CONFIG_HOME). Nothing is ever written into site-packages.
Security
- Scope is
drive.file: the agent can only see files it created itself. state/,bin/, and.tmp/are gitignored; tokens and OAuth client secrets are chmod 600 and never printed.- The OAuth
statenonce is random, stored locally, and checked onconnect(15-minute TTL). - Prefer
connect --stdinso single-use codes don't land in shell history. - Revoke access any time at https://myaccount.google.com/ → Security → Third-party apps → rclone.
MCP server
Available from 0.4.0:
pipx install 'agent2drive[mcp]'
opencode mcp add agent2drive -- agent2drive-mcp
Eight tools (a2d_status, a2d_set_client, a2d_consent_url, a2d_connect, a2d_init_slot, a2d_upload, a2d_list, a2d_manifest), two resources, and a deliver-file prompt. stdio only; path allowlisting (A2D_ALLOWED_ROOTS), overwrite confirmation, and secret redaction are built in. Full setup and security details: docs/MCP.md.
Development
python3 -m pip install -r requirements-dev.txt
python3 -m pytest -q
Tests cover pure logic plus injected-rclone failure paths (hash mismatch, missing hashes, collisions, retries, state replay, and the post-connect crash regression).
License
MIT. rclone is MIT-licensed; its published OAuth constants are used and credited per its license.
Metadata
Release files for agent2drive 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| agent2drive-0.4.0.tar.gz | 19.2 kB | Without provenance | Details for agent2drive-0.4.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| agent2drive-0.4.0-py3-none-any.whl | Python 3 | none | any | Details for agent2drive-0.4.0-py3-none-any.whl |
Total release size: 36.3 kB
Release files / agent2drive-0.4.0.tar.gz
| Download URL | agent2drive-0.4.0.tar.gz |
|---|---|
| Size | 19.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
16893214b10986f3ce7b13a87c875db7f3e6f448e40c618496d52d6a0d7756da
|
|
BLAKE2b-256 checksum How to use checksums |
82b80012b7fc2ed089204ff736cad18abcf179dcaf99a10384f60e191c0a1fc3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / agent2drive-0.4.0-py3-none-any.whl
| Download URL | agent2drive-0.4.0-py3-none-any.whl |
|---|---|
| Size | 17.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d0a264b56ebfaa01f041b42ddae1898aa754e0c7d271f5fbafdc99b346483d6c
|
|
BLAKE2b-256 checksum How to use checksums |
96b413c6a06a4272e931f2d88213057b953b10c59fe19351a367f9ee2fe73ee0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Security for agent2drive 0.4.0
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.