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
}
Executes Python code on the computer.

Path parameters

id
string
required
Computer ID.

Request

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

Response

output
string
Code output (stdout).
success
boolean
true if code executed successfully.
error
string
Error message if execution failed.
error_type
string
Error type (e.g., SyntaxError, NameError).
timeout
boolean
true if execution timed out.

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
}

Error response

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

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