curl: point an agent at a workspace, give it a task, watch the run, and collect the files it produced.
@arg-ai/sdk.
Use a user-owned API key for this quickstart. Creating a workspace with
POST /api/workspaces requires a user principal and returns 403 for
service-account keys — see Step 2 for the
unattended alternative.Prerequisites
Create a user-owned key at arg.ai/platform/api-keys, then export it. The plaintext key (arg_live_…) is shown only once.
1
Create a workspace
A workspace is the container an agent does work inside — its files persist across runs.Save the
id:2
Upload an input file
Upload a file the agent can work on. The upload is
multipart/form-data; the optional path query sets the destination folder.3
Start an agent run
A run is a chat plus a turn. First create the chat, then send the task. Pass A If a turn is already running on this chat, you get a
workspace_id so the agent can see your files.200 means the turn started executing — keep call_id and job_id:202 instead — the new turn was queued behind it:4
Poll until the run finishes
Poll the status endpoint until The
status is completed or error. It reports pending while the run is in flight (it does not stream intermediate events).toolOutputs array names every file the agent wrote — a quick way to find your artifacts.5
Collect the output artifacts
List the workspace tree, then download what the agent produced.For text files you can read the content inline instead of downloading bytes:
6
(Optional) iterate, then clean up
Send another turn to the same chat to build on the work:Release the finished job, and delete the chat when you’re done:
Error format
Every error is a JSON object with adetail string and the matching HTTP status:
401 (bad/missing key), 403 (authenticated but not permitted — e.g. a service-account key creating a workspace), 404 (not found), 429 (rate limited).
Next steps
- Skip the plumbing.
@arg-ai/sdkwraps this exact flow (auth, retries, typed errors, theRunlifecycle, and resilient file uploads), so the golden path is a handful of typed calls instead of rawcurl. - Go deeper on runs. Agent runs covers queueing a follow-up, steering a turn already in flight, and stopping one that has gone wrong.
- Run code yourself. Execute shell commands and edit files directly with the tools API, no model in the loop.
- Make it recurring. Unattended runs covers service accounts, schedules, and being told when something breaks.
- Browse the full surface in the API Reference.