{ "components": { "schemas": { "CreateRuntimeRequest": { "properties": { "additional_python_imports": { "type": "string" }, "language": { "enum": [ "PYTHON", "JAVASCRIPT" ], "type": "string" }, "manifest_file": { "$ref": "#/components/schemas/ManifestFile" }, "name": { "type": "string" } }, "required": [ "name", "language", "manifest_file" ], "type": "object" }, "CreateRuntimeRevisionRequest": { "properties": { "additional_python_imports": { "type": "string" }, "manifest_file": { "$ref": "#/components/schemas/ManifestFile" } }, "required": [ "manifest_file" ], "type": "object" }, "CreateSecretRequest": { "properties": { "name": { "type": "string" }, "value": { "type": "string" } }, "required": [ "name", "value" ], "type": "object" }, "CreateToolRequest": { "properties": { "code": { "type": "string" }, "description": { "type": "string" }, "input_schema": {}, "language": { "enum": [ "PYTHON", "JAVASCRIPT", "TYPESCRIPT" ], "type": "string" }, "name": { "type": "string" } }, "required": [ "name", "code" ], "type": "object" }, "EnvVar": { "properties": { "name": { "type": "string" }, "secret_id": { "type": "string" }, "value": { "type": "string" } }, "required": [ "name" ], "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": { "deprecated": true, "type": "string" }, "runtime": { "deprecated": true, "description": "The runtime to use when executing code. Deprecated in favor of `runtime_revision_id`.", "type": "string" }, "runtime_revision_id": { "description": "The ID of the runtime revision 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" }, "ExecuteToolRequest": { "properties": { "env": { "items": { "$ref": "#/components/schemas/EnvVar" }, "type": "array" }, "http": { "$ref": "#/components/schemas/HTTPTool" }, "input": {}, "revision_id": { "type": "string" } }, "type": "object" }, "ExecuteToolResponse": { "properties": { "execution": { "$ref": "#/components/schemas/Execution" }, "output": {} }, "required": [ "execution" ], "type": "object" }, "Execution": { "properties": { "exit_code": { "format": "int32", "type": "integer" }, "stderr": { "type": "string" }, "stdout": { "type": "string" } }, "required": [ "exit_code", "stdout", "stderr" ], "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": { "description": "The hostname to allow.", "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" }, "header": { "$ref": "#/components/schemas/HTTPHeader" }, "query": { "$ref": "#/components/schemas/HTTPQuery" } }, "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" }, "HTTPHeader": { "nullable": true, "properties": { "name": { "type": "string" }, "value": { "type": "string" } }, "type": "object" }, "HTTPQuery": { "nullable": true, "properties": { "key": { "type": "string" }, "value": { "type": "string" } }, "type": "object" }, "HTTPTool": { "nullable": true, "properties": { "allow": { "description": "List of allowed HTTP hosts and associated authentication.", "items": { "$ref": "#/components/schemas/HTTPToolAllow" }, "type": "array" } }, "type": "object" }, "HTTPToolAllow": { "description": "List of allowed HTTP hosts and associated authentication.", "properties": { "auth": { "$ref": "#/components/schemas/HTTPToolAuth" }, "host": { "description": "The hostname to allow.", "type": "string" } }, "type": "object" }, "HTTPToolAuth": { "description": "Authentication configuration for outbound requests to this host.", "properties": { "basic": { "$ref": "#/components/schemas/HTTPToolBasic" }, "bearer": { "$ref": "#/components/schemas/HTTPToolBearer" }, "query": { "$ref": "#/components/schemas/HTTPToolQuery" } }, "type": "object" }, "HTTPToolBasic": { "nullable": true, "properties": { "password": { "type": "string" }, "secret_id": { "type": "string" }, "user_id": { "type": "string" } }, "type": "object" }, "HTTPToolBearer": { "description": "Configuration to add an 'Authorization' header using the 'Bearer' scheme.", "nullable": true, "properties": { "secret_id": { "type": "string" }, "token": { "description": "The token to set, e.g. 'Authorization: Bearer \u003ctoken\u003e'.", "type": "string" } }, "type": "object" }, "HTTPToolQuery": { "nullable": true, "properties": { "key": { "type": "string" }, "secret_id": { "type": "string" }, "value": { "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" }, "ListRuntimeRevisionsResponse": { "properties": { "revisions": { "items": { "$ref": "#/components/schemas/RuntimeRevision" }, "type": "array" } }, "required": [ "revisions" ], "type": "object" }, "ListRuntimesResponse": { "properties": { "runtimes": { "items": { "$ref": "#/components/schemas/Runtime" }, "type": "array" } }, "required": [ "runtimes" ], "type": "object" }, "ListSecretsResponse": { "properties": { "secrets": { "items": { "$ref": "#/components/schemas/Secret" }, "type": "array" } }, "required": [ "secrets" ], "type": "object" }, "ListToolsResponse": { "properties": { "tools": { "items": { "$ref": "#/components/schemas/Tool" }, "type": "array" } }, "required": [ "tools" ], "type": "object" }, "ManifestFile": { "properties": { "contents": { "type": "string" }, "name": { "enum": [ "requirements.txt" ], "type": "string" } }, "required": [ "name", "contents" ], "type": "object" }, "Runtime": { "properties": { "additional_python_imports": { "type": "string" }, "id": { "type": "string" }, "language": { "enum": [ "PYTHON", "JAVASCRIPT" ], "type": "string" }, "manifest_file": { "$ref": "#/components/schemas/ManifestFile" }, "name": { "type": "string" }, "revision_id": { "type": "string" }, "status": { "type": "string" } }, "required": [ "id", "name", "language", "revision_id", "status" ], "type": "object" }, "RuntimeRevision": { "properties": { "additional_python_imports": { "type": "string" }, "id": { "type": "string" }, "manifest_file": { "$ref": "#/components/schemas/ManifestFile" }, "runtime_id": { "type": "string" }, "status": { "enum": [ "unspecified", "pending", "building", "succeeded", "failed", "cancelled" ], "type": "string" } }, "required": [ "id", "runtime_id", "manifest_file", "status" ], "type": "object" }, "Secret": { "properties": { "id": { "type": "string" }, "name": { "type": "string" } }, "required": [ "id", "name" ], "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": { "code": { "type": "string" }, "description": { "type": "string" }, "id": { "type": "string" }, "input_schema": {}, "language": { "enum": [ "PYTHON", "JAVASCRIPT", "TYPESCRIPT" ], "type": "string" }, "name": { "type": "string" }, "revision_id": { "type": "string" } }, "required": [ "id", "name", "description", "code", "language", "input_schema", "revision_id" ], "type": "object" }, "UpdateToolRequest": { "properties": { "code": { "nullable": true, "type": "string" }, "description": { "nullable": true, "type": "string" }, "input_schema": { "nullable": true }, "language": { "enum": [ "PYTHON", "JAVASCRIPT", "TYPESCRIPT" ], "type": "string" }, "name": { "nullable": true, "type": "string" } }, "type": "object" } }, "securitySchemes": { "bearerHttpAuthentication": { "scheme": "bearer", "type": "http" } } }, "info": { "title": "Execute", "version": "0.0.6" }, "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" } }, "summary": "Execute code", "tags": [ "Sandbox" ] } }, "/v1/runtimes": { "get": { "description": "Returns a list of runtimes in your project.", "operationId": "listRuntimes", "responses": { "200": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ListRuntimesResponse" } } }, "description": "OK" }, "401": { "content": { "application/json": { "examples": { "unauthenticated": { "value": { "code": 16, "message": "unauthenticated" } } }, "schema": { "$ref": "#/components/schemas/Status" } } }, "description": "Unauthenticated error response" } }, "summary": "List runtimes", "tags": [ "Runtime" ] }, "post": { "description": "Creates a runtime.", "operationId": "createRuntime", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreateRuntimeRequest" } } }, "required": true }, "responses": { "200": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Runtime" } } }, "description": "OK" }, "401": { "content": { "application/json": { "examples": { "unauthenticated": { "value": { "code": 16, "message": "unauthenticated" } } }, "schema": { "$ref": "#/components/schemas/Status" } } }, "description": "Unauthenticated error response" } }, "summary": "Create runtime", "tags": [ "Runtime" ] } }, "/v1/runtimes/{id}": { "get": { "description": "Retrieves a runtime.", "operationId": "retrieveRuntime", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Runtime" } } }, "description": "OK" }, "401": { "content": { "application/json": { "examples": { "unauthenticated": { "value": { "code": 16, "message": "unauthenticated" } } }, "schema": { "$ref": "#/components/schemas/Status" } } }, "description": "Unauthenticated error response" } }, "summary": "Retrieve runtime", "tags": [ "Runtime" ] } }, "/v1/runtimes/{id}/revisions": { "get": { "description": "Lists all revisions for a runtime.", "operationId": "listRuntimeRevisions", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ListRuntimeRevisionsResponse" } } }, "description": "OK" }, "401": { "content": { "application/json": { "examples": { "unauthenticated": { "value": { "code": 16, "message": "unauthenticated" } } }, "schema": { "$ref": "#/components/schemas/Status" } } }, "description": "Unauthenticated error response" } }, "summary": "List runtime revisions", "tags": [ "Runtime" ] }, "post": { "description": "Creates a new runtime revision.", "operationId": "createRuntimeRevision", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string" } } ], "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreateRuntimeRevisionRequest" } } }, "required": true }, "responses": { "200": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/RuntimeRevision" } } }, "description": "OK" }, "401": { "content": { "application/json": { "examples": { "unauthenticated": { "value": { "code": 16, "message": "unauthenticated" } } }, "schema": { "$ref": "#/components/schemas/Status" } } }, "description": "Unauthenticated error response" } }, "summary": "Create runtime revision", "tags": [ "Runtime" ] } }, "/v1/runtimes/{runtime_id}/revisions/{revision_id}": { "get": { "description": "Retrieves a runtime revision.", "operationId": "retrieveRuntimeRevision", "parameters": [ { "in": "path", "name": "runtime_id", "required": true, "schema": { "type": "string" } }, { "in": "path", "name": "revision_id", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/RuntimeRevision" } } }, "description": "OK" }, "401": { "content": { "application/json": { "examples": { "unauthenticated": { "value": { "code": 16, "message": "unauthenticated" } } }, "schema": { "$ref": "#/components/schemas/Status" } } }, "description": "Unauthenticated error response" } }, "summary": "Retrieve runtime revision", "tags": [ "Runtime" ] } }, "/v1/secrets": { "get": { "description": "Returns a list of secrets in your project.", "operationId": "listSecrets", "responses": { "200": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ListSecretsResponse" } } }, "description": "OK" }, "401": { "content": { "application/json": { "examples": { "unauthenticated": { "value": { "code": 16, "message": "unauthenticated" } } }, "schema": { "$ref": "#/components/schemas/Status" } } }, "description": "Unauthenticated error response" } }, "summary": "List secrets", "tags": [ "Secret" ] }, "post": { "description": "Create a secret in your project.", "operationId": "createSecret", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreateSecretRequest" } } }, "required": true }, "responses": { "200": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Secret" } } }, "description": "OK" }, "401": { "content": { "application/json": { "examples": { "unauthenticated": { "value": { "code": 16, "message": "unauthenticated" } } }, "schema": { "$ref": "#/components/schemas/Status" } } }, "description": "Unauthenticated error response" } }, "summary": "Create secret", "tags": [ "Secret" ] } }, "/v1/tools": { "get": { "description": "Returns a list of tools in your project.", "operationId": "listTools", "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" } }, "summary": "List tools", "tags": [ "Tool" ] }, "post": { "description": "Create a tool in your project.", "operationId": "createTool", "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" } }, "summary": "Create tool", "tags": [ "Tool" ] } }, "/v1/tools/{id}": { "get": { "description": "Retrieves a tool.", "operationId": "retrieveTool", "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" } }, "summary": "Retrieve tool", "tags": [ "Tool" ] }, "post": { "description": "Update the source code and input schema of a tool.", "operationId": "modifyTool", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string" } } ], "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UpdateToolRequest" } } }, "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" } }, "summary": "Modify tool", "tags": [ "Tool" ] } }, "/v1/tools/{id}/execute": { "post": { "description": "Execute a tool with a given input. The input is validated against the tool's input schema.", "operationId": "executeTool", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string" } } ], "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ExecuteToolRequest" } } }, "required": true }, "responses": { "200": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ExecuteToolResponse" } } }, "description": "OK" }, "401": { "content": { "application/json": { "examples": { "unauthenticated": { "value": { "code": 16, "message": "unauthenticated" } } }, "schema": { "$ref": "#/components/schemas/Status" } } }, "description": "Unauthenticated error response" } }, "summary": "Execute tool", "tags": [ "Tool" ] } } }, "security": [ { "bearerHttpAuthentication": [] } ] }