Skip to main content
POST
/
computers
/
{id}
/
exec
Execute Python
curl --request POST \
  --url https://www.orgo.ai/api/computers/{id}/exec \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "code": "import os\nprint(os.getcwd())",
  "timeout": 10
}
'
{
  "output": "/home/user\n",
  "success": true
}

Documentation Index

Fetch the complete documentation index at: https://docs.orgo.ai/llms.txt

Use this file to discover all available pages before exploring further.

Executes Python code on the computer in a short-lived interpreter and returns its output.

Path parameters

id
string
required
Computer ID (UUID).

Body parameters

code
string
required
Python code to execute.
timeout
integer
default:"10"
Timeout in seconds (1-300).

Response

output
string
Captured stdout from the interpreter.
success
boolean
true if the code ran without raising an uncaught exception.
error
string
Error message, if execution failed.
error_type
string
Python exception class (e.g., SyntaxError, NameError).
timeout
boolean
true if execution was killed by the timeout.

Example

curl -X POST https://www.orgo.ai/api/computers/a3bb189e-8bf9-3888-9912-ace4e6543002/exec \
  -H "Authorization: Bearer $ORGO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "code": "import os\nprint(os.getcwd())",
    "timeout": 10
  }'

Successful response

{
  "output": "/home/user\n",
  "success": true,
  "action": "exec",
  "timeout": false
}

Error response

{
  "output": "",
  "success": false,
  "action": "exec",
  "error": "name 'undefined_var' is not defined",
  "error_type": "NameError"
}
For shell commands, use Execute bash instead.

Errors

StatusMeaning
400Missing or non-string code, or computer instance not available.
401Missing or invalid API key.
403You do not have access to this computer.
404Computer not found.
500Upstream desktop agent failure.

Authorizations

Authorization
string
header
required

API key authentication. Get your key at orgo.ai/workspaces

Path Parameters

id
string
required

Computer ID

Body

application/json
code
string
required

Python code to execute

timeout
integer
default:10

Timeout in seconds

Required range: 1 <= x <= 300

Response

Code executed

output
string

Code output

success
boolean

Whether execution succeeded

error
string

Error message if failed

error_type
string

Error type if failed

timeout
boolean

Whether execution timed out