{ "components": { "schemas": { "CreateToolRequest": { "properties": { "code": { "type": "string" }, "input_schema": {}, "name": { "type": "string" } }, "type": "object" }, "ExecuteRequest": { "properties": { "allow_http_hosts": { "deprecated": true, "description": "List of allowed hosts for HTTP requests.", "items": { "deprecated": true, "type": "string" }, "type": "array" }, "args": { "description": "List of command line arguments to pass to the script.", "items": { "type": "string" }, "type": "array" }, "code": { "description": "The code to execute.", "type": "string" }, "env": { "additionalProperties": { "type": "string" }, "description": "Set of key-value pairs to add to the script's execution environment.", "type": "object" }, "files": { "description": "List of input files.", "items": { "$ref": "#/components/schemas/File" }, "type": "array" }, "http": { "$ref": "#/components/schemas/HTTP" }, "language": { "description": "The interpreter to use when executing code.", "enum": [ "PYTHON", "JAVASCRIPT", "TYPESCRIPT", "RUBY", "PHP" ], "type": "string" }, "limits": { "$ref": "#/components/schemas/Limits" }, "revision": { "type": "string" }, "runtime": { "description": "The runtime to use when executing code.", "type": "string" }, "stdin": { "description": "Input made available to the script via 'stdin'.", "type": "string" } }, "required": [ "code" ], "type": "object" }, "ExecuteResponse": { "properties": { "exit_code": { "description": "The exit code returned by the script. Will often be '0' on success and non-zero on failure.", "format": "int32", "type": "integer" }, "stderr": { "description": "The contents of 'stderr' after executing the script.", "type": "string" }, "stdout": { "description": "The contents of 'stdout' after executing the script.", "type": "string" } }, "type": "object" }, "File": { "properties": { "contents": { "description": "The contents of the file.", "type": "string" }, "path": { "description": "The relative path of the file.", "type": "string" } }, "type": "object" }, "HTTP": { "description": "Configuration for HTTP requests and authentication.", "nullable": true, "properties": { "allow": { "description": "List of allowed HTTP hosts and associated authentication.", "items": { "$ref": "#/components/schemas/HTTPAllow" }, "type": "array" } }, "type": "object" }, "HTTPAllow": { "description": "List of allowed HTTP hosts and associated authentication.", "properties": { "auth": { "$ref": "#/components/schemas/HTTPAuth" }, "host desc:": { "type": "string" } }, "type": "object" }, "HTTPAuth": { "description": "Authentication configuration for outbound requests to this host.", "properties": { "basic": { "$ref": "#/components/schemas/HTTPBasic" }, "bearer": { "$ref": "#/components/schemas/HTTPBearer" } }, "type": "object" }, "HTTPBasic": { "nullable": true, "properties": { "password": { "type": "string" }, "user_id": { "type": "string" } }, "type": "object" }, "HTTPBearer": { "description": "Configuration to add an 'Authorization' header using the 'Bearer' scheme.", "nullable": true, "properties": { "token": { "description": "The token to set, e.g. 'Authorization: Bearer \u003ctoken\u003e'.", "type": "string" } }, "type": "object" }, "Limits": { "description": "Configuration for execution environment limits.", "nullable": true, "properties": { "execution_timeout": { "description": "The maximum time allowed for execution (in seconds). Default is 30.", "maximum": 18446744073709552000, "minimum": 0, "type": "integer" }, "memory_size": { "description": "The maximum memory allowed for execution (in MiB). Default is 128.", "maximum": 18446744073709552000, "minimum": 0, "type": "integer" } }, "type": "object" }, "ListToolsResponse": { "properties": { "tools": { "items": { "$ref": "#/components/schemas/Tool" }, "type": "array" } }, "type": "object" }, "Status": { "properties": { "code": { "description": "The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code].", "format": "int32", "type": "integer" }, "message": { "description": "A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client.", "type": "string" } }, "type": "object" }, "Tool": { "properties": { "id": { "type": "string" } }, "type": "object" } }, "securitySchemes": { "bearerHttpAuthentication": { "scheme": "bearer", "type": "http" } } }, "info": { "title": "Execute", "version": "0.0.5" }, "openapi": "3.0.3", "paths": { "/v1/execute": { "post": { "description": "Run a script in a secure, isolated environment. Scripts can read from `stdin` and write to `stdout` or `stderr`. They can access input files, environment variables and command line arguments.", "operationId": "Sandbox_Execute", "requestBody": { "content": { "application/json": { "examples": { "Python": { "value": { "language": "PYTHON", "code": "print(\"Hello world!\")" } } }, "schema": { "$ref": "#/components/schemas/ExecuteRequest" } } }, "required": true }, "responses": { "200": { "content": { "application/json": { "examples": { "hello": { "value": { "exit_code": 0, "stdout": "Hello, World!", "stderr": "" } } }, "schema": { "$ref": "#/components/schemas/ExecuteResponse" } } }, "description": "OK" }, "401": { "content": { "application/json": { "examples": { "unauthenticated": { "value": { "code": 16, "message": "unauthenticated" } } }, "schema": { "$ref": "#/components/schemas/Status" } } }, "description": "Unauthenticated error response" }, "default": { "description": "" } }, "summary": "Execute code", "tags": [ "Sandbox" ] } }, "/v1/tools": { "get": { "responses": { "200": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ListToolsResponse" } } }, "description": "OK" }, "401": { "content": { "application/json": { "examples": { "unauthenticated": { "value": { "code": 16, "message": "unauthenticated" } } }, "schema": { "$ref": "#/components/schemas/Status" } } }, "description": "Unauthenticated error response" }, "default": { "description": "" } } }, "post": { "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreateToolRequest" } } }, "required": true }, "responses": { "200": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Tool" } } }, "description": "OK" }, "401": { "content": { "application/json": { "examples": { "unauthenticated": { "value": { "code": 16, "message": "unauthenticated" } } }, "schema": { "$ref": "#/components/schemas/Status" } } }, "description": "Unauthenticated error response" }, "default": { "description": "" } } } }, "/v1/tools/{id}": { "get": { "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Tool" } } }, "description": "OK" }, "401": { "content": { "application/json": { "examples": { "unauthenticated": { "value": { "code": 16, "message": "unauthenticated" } } }, "schema": { "$ref": "#/components/schemas/Status" } } }, "description": "Unauthenticated error response" }, "default": { "description": "" } } } } }, "security": [ { "bearerHttpAuthentication": [] } ] }