Skip to main content

Source files and the editor

When you deploy an agent, the platform also stores your source files so you can read them later, edit them in the browser, and redeploy without re-uploading anything. This page covers the files API, the console editor, and what happens when no source is stored.

What gets stored

Deploying an agent uploads a .tar.gz of your code. The platform builds it into an image and keeps a copy of the files as editable source. Storage is best-effort and holds the latest version only — there is no history and no git. The API says so itself: every file listing carries the note latest version only - the platform keeps no history, so copy anything you want to keep. Keep your real source of truth in your own repository.

These are management routes: sign in, owner or project admin only.

The files API

MethodPathBehavior
GET/v1/agents/{name}/filesList stored files
GET/v1/agents/{name}/files/{path}Read one file
PUT/v1/agents/{name}/files/{path}Create or overwrite one file
DELETE/v1/agents/{name}/files/{path}Delete one file
POST/v1/agents/{name}/redeployRebuild the agent from the stored source

List files

curl -s "$CAI_API/v1/agents/research-buddy/files" \
-H "Authorization: Bearer $CAI_TOKEN"

You should see:

{
"agent": "research-buddy",
"agent_id": "…",
"files": [
{"path": "agent.py", "size": 512, "updated_at": "2026-08-10T09:12:00Z"},
{"path": "requirements.txt", "size": 64, "updated_at": "2026-08-10T09:12:00Z"}
],
"editable": true,
"note": "latest version only - the platform keeps no history, so copy anything you want to keep"
}

Read a file

curl -s "$CAI_API/v1/agents/research-buddy/files/agent.py" \
-H "Authorization: Bearer $CAI_TOKEN"

You should see:

{"path": "agent.py", "content": "from google.adk.agents import Agent\n…", "updated_at": "2026-08-10T09:12:00Z"}

Edit a file

curl -s -X PUT "$CAI_API/v1/agents/research-buddy/files/agent.py" \
-H "Authorization: Bearer $CAI_TOKEN" -H 'content-type: application/json' \
-d '{"content": "from google.adk.agents import Agent\n# updated\n…"}'

You should see:

{"path": "agent.py", "bytes": 118, "note": "saved - redeploy the agent for this to take effect"}

The note means what it says: saving a file changes stored source only. The running agent still runs the image it was built from.

Delete a file

curl -s -X DELETE "$CAI_API/v1/agents/research-buddy/files/old_helper.py" \
-H "Authorization: Bearer $CAI_TOKEN"

You should see:

{"deleted": "old_helper.py"}

Redeploy from stored source

When your edits are ready, rebuild the agent from what's stored — no tarball, no CLI upload:

curl -s -X POST "$CAI_API/v1/agents/research-buddy/redeploy" \
-H "Authorization: Bearer $CAI_TOKEN"

You should see:

{"agent": "research-buddy", "build_id": "…", "files": 2, "note": "rebuilding from the stored source"}

This kicks off the same build pipeline as a normal deploy (202, then poll GET /v1/agents/{name} through building and deploying to ready). This endpoint is also what the console editor's deploy button calls.

The console editor

On the agent's detail page in the console you can browse and edit the stored files directly in the browser, save changes, and deploy them with one click. The Deploy agent dialog also offers three ways to provide source in the first place: write code in the browser (with starter templates per framework — agent.py, crew.py, or graph.py plus requirements.txt), upload files or a folder, or upload a ready .tar.gz.

Binary files

The browser upload refuses binary files and names the offending path. The stored-source editor handles text only, too. If your agent needs binary assets, deploy with a .tar.gz (browser tarball mode or platformctl deploy) — binary content survives only on that path.

When no source is stored

Source storage is best-effort, so an agent can exist without stored files (for example, if the store write failed at deploy time). Redeploying such an agent fails with 400:

no source is stored for this agent - deploy it once from the CLI or upload files first

The fix is in the message: deploy once with platformctl deploy <dir> (which uploads and stores the source), or create the files with PUT /v1/agents/{name}/files/{path} first, then redeploy.

Limits

LimitValue
Per file1 MiB
Files per agent200
Uploaded archive, expanded64 MiB
History keptNone — latest version only
Symlinks / path traversal in archivesRejected
Binary contentOnly via the .tar.gz upload path

Next steps