Skip to content
中文

Run, transfer files, and permissions

Both ways in reach the same agent, so this page applies to each of them. File transfer uses codemode; run modes and confirmations belong to the agent itself and apply across connections.

Transfer files between local and cloud

Enable codemode under Settings → Tools. Run JavaScript below in praxis_assume_codemode; run bash in your coding agent’s local shell, after codemode returns. Bytes bypass the model. Cloud bash cannot read your local paths. Signed URLs are bearer credentials: return them only to the requesting user/client, keep them in transient variables with shell tracing off, and never save them to files or logs.

Upload

Run wc -c < policy.pdf locally. Replace local_byte_count with that exact integer:

import { praxis } from "praxis";
export default async () => praxis.file.uploads.createSigned({ body: {
filename: "policy.pdf", bytes: local_byte_count, content_type: "application/pdf", purpose: "user_data"
} });

Use the returned url as upload_url in the local shell:

终端窗口
curl --fail-with-body -T policy.pdf -H 'Content-Type: application/pdf' "$upload_url"

Expect HTTP 201 and a file object; use its id, not upload_id. If state is processing, poll praxis.file.files.retrieve({ path: { file_id: "file_id" } }) in separate codemode calls with a bounded delay until active; stop on failure or timeout.

Above 104857600 bytes, creation returns part_size, parts[] and complete_url. Split locally with split -b "$part_size" -d policy.pdf policy.part., PUT each chunk to its numbered URL with exact Content-Length (final chunk may be shorter), then POST complete_url without a body. Parts return 200; completion returns 201. Identical parts can be retried; changed bytes or missing parts return 400.

Download

Replace file_id with an active file’s ID. Return the URL, then pass it as download_url to the local shell:

import { praxis } from "praxis";
export default async () => praxis.file.files.contentUrl.create({
path: { file_id: "file_id" }, body: { ttl_seconds: 3600 }
});
终端窗口
curl -fsSL -o result.json "$download_url"

Expect a local result.json containing the original bytes. GET supports a single Range header (206; unsatisfiable ranges return 416). To revoke, call praxis.file.files.contentLinks.revoke({ path: { file_id: "file_id" }, body: { token: "token_after_c_slash" } }) in codemode. Use only the token after /c/, not the whole URL.

Hand off by file ID

Upload does not ingest Knowledge. Attach the same-organization file to an existing store:

import { praxis } from "praxis";
export default async () => praxis.knowledge.vectorStores.files.create({
path: { vector_store_id: "store_id" }, body: { file_id: "file_id" }
});

Poll praxis.knowledge.vectorStores.files.retrieve until attachment status is completed before searching. Media accepts body.file: "file_id" through praxis.media.libraries.assets.create; Cut accepts body.source: { fileId: "MEDIA_file_id" } through praxis.cut.projects.media.import for supported image/audio/video files.

LimitBehavior
Signed upload sizeUp to 2147483648 bytes; single PUT up to 104857600 bytes; Knowledge attachment up to 100000000 bytes
Upload expiryDefault 900 seconds single PUT / 3600 multipart; maximum 604800 seconds
Download expiryDefault 900 seconds; integer 1–604800 seconds
ReplayA completion replay returns 201 with the same file; a replay of a successful single PUT returns 410 CAPABILITY_USED; download GETs can repeat until expiry
Invalid linksForged, revoked, invalid or foreign links return 404; an expired upload (record still present) answers 410 UPLOAD_EXPIRED on its status and complete links, so create a new upload
Wrong actionA validly signed link used for another action returns 403 CAPABILITY_MISMATCH, judged before expiry
RevocationWithin 15 minutes; leaves the file and other links intact
Inline MCPFileRef up to 5 MiB may appear in conversation; it does not save a local file. Sign a download link to save it.

Computer files are separate from File storage. For a cloud computer file up to 16 MiB, pass the Blob returned by praxis.agent.computers.files.retrieveContent to praxis.file.uploadFile, then sign its File ID. Hosted agents can give a human the same download link.

Continue with the complete PDF recipe.

Set execution permissions

Choose a mode under the agent’s Settings → Tools:

  • 自主模式 / Guarded (guarded, default): ordinary operations run immediately. Dangerous commands check the matching permission switch. All five switches start off.
  • 完全访问 / Full access (yolo): dangerous operations run immediately.

Modes and permission switches belong to the agent and apply across connections. A mode change takes effect on a connection’s next call. Individual tools also have on/off switches; disabled tools are not exposed.

SwitchConsole labelOperations covered
bulk_delete批量删除文件 — Bulk deleteRecursive, multi-target, or glob rm on ordinary targets; commands matching bulk-deletion rules, such as find or rsync deletion
delete_critical_path删除关键路径 — Delete critical pathsrm matching a deletion rule with root, home, /root, /home, system-directory, or statically indeterminate targets
force_push强制推送 — Force pushGit commands matching the force-push rule
discard_changes丢弃本地改动 — Discard local changesRules for hard resets, discarding a working tree, clearing stashes, and forcibly removing a worktree
clean_untracked清理未跟踪文件 — Clean untracked filesgit clean matching the forced-clean rule

These switches govern shell commands. The disk-level system-storage rule for dd, mount, umount, and mkfs has no permission group. Guarded mode refuses it even with all five switches on; it requires full access.

Handle confirmations and failures

When a guarded command hits a switch that is off:

  • Clients declaring elicitation support receive a prompt offering Allow once / Always allow / Deny. Allow once runs only this call. Always allow enables the agent’s switch for every connection.
  • Clients without elicitation support receive PERMISSION_REQUIRED. A permission request appears on the agent’s Console page and in tool settings. Allow enables the switch until turned off; retry the call afterward. Ignore dismisses only the request.
ResultCause and recovery
400 ASSUME_AGENT_REQUIREDThe URL identifies another agent kind. Create an assume agent and replace the URL.
403 ASSUME_KEY_GRANT_UNSUPPORTEDThe credential is neither a fully authorized key nor this agent’s own directory login. Use an OAuth grant, a fully authorized key, or this directory’s own login.
403 ASSUME_AGENT_MISMATCHThis credential belongs to another agent. Use the credential for the agent in the URL.
GET returns 405This endpoint does not provide a GET stream. Connect with a Streamable HTTP client.
PERMISSION_REQUIREDAsk the user to allow the permission in the Console, then retry.
CONFIRMATION_UNSUPPORTEDThe tool itself requires confirmation outside the dangerous-command switch flow. The user can choose full access before retrying.
TOOL_DENIEDA policy denied the call, or a rule has no permission group. Read the reason; ungrouped operations require full access.

Tool refusals carry isError in the tool result; they are separate from HTTP connection errors.

Next: Use skills · Agent API