{ "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": { "description": "The code of the tool. You must define a function named \"execute\" that takes in a single argument and returns a JSON-serializable value. The argument will be the \"input\" passed when executing the tool, and will match the input schema.", "type": "string" }, "description": { "description": "A description of the tool.", "type": "string" }, "input_schema": { "description": "The input schema of the tool. This must be a valid JSON Schema object." }, "language": { "description": "The language of the tool's code.", "enum": [ "python", "javascript", "typescript" ], "type": "string" }, "name": { "description": "The name of the tool.", "type": "string" }, "runtime_revision_id": { "description": "The ID of the runtime revision to use when executing the tool.", "type": "string" } }, "required": [ "name", "language", "code" ], "type": "object" }, "EnvVar": { "description": "Set of key-value pairs to add to the tool's execution environment.", "properties": { "name": { "type": "string" }, "secret_id": { "type": "string" }, "value": { "type": "string" } }, "required": [ "name" ], "type": "object" }, "ExecuteFunctionRequest": { "properties": { "code": { "description": "The function to execute. Your code must define a function named \"execute\" that takes in a single argument and returns a JSON-serializable value.", "type": "string" }, "env": { "additionalProperties": { "type": "string" }, "description": "Set of key-value pairs to add to the function's execution environment.", "type": "object" }, "files": { "description": "List of input files.", "items": { "$ref": "#/components/schemas/File" }, "type": "array" }, "http": { "$ref": "#/components/schemas/HTTP" }, "input": { "description": "The input to the function. This must be a valid JSON-serializable object. If you do not pass an input, your function will be called with None (Python) or null (JavaScript/TypeScript) as the argument." }, "language": { "description": "The interpreter to use when executing code.", "enum": [ "python", "javascript", "typescript" ], "type": "string" }, "limits": { "$ref": "#/components/schemas/Limits" }, "runtime_revision_id": { "description": "The ID of the runtime revision to use when executing code.", "type": "string" } }, "required": [ "language", "code" ], "type": "object" }, "ExecuteFunctionResponse": { "properties": { "execution": { "$ref": "#/components/schemas/ExecuteResponse" }, "output": { "description": "The output of the function." }, "output_status": { "description": "The status of the output. \"valid\" means your function executed successfully and returned a valid JSON-serializable object, or void. \"json_serialization_error\" means your function executed successfully, but returned a nonserializable object. \"error\" means your function failed to execute.", "enum": [ "error", "json_serialization_error", "valid" ], "type": "string" } }, "required": [ "output", "output_status", "execution" ], "type": "object" }, "ExecuteRequest": { "properties": { "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" }, "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": [ "language", "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.", "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" } }, "required": [ "exit_code", "stdout", "stderr" ], "type": "object" }, "ExecuteToolRequest": { "properties": { "env": { "description": "Set of key-value pairs to add to the tool's execution environment.", "items": { "$ref": "#/components/schemas/EnvVar" }, "type": "array" }, "http": { "$ref": "#/components/schemas/HTTPTool" }, "input": { "description": "The input to the tool. This must be a valid JSON-serializable object. It will be validated against the tool's input schema." }, "revision_id": { "description": "The Tool revision ID to execute. This optional parmeter is used to pin executions to specific versions of the Tool. If not provided, the latest (current) version of the Tool will be executed.", "type": "string" } }, "type": "object" }, "ExecuteToolResponse": { "properties": { "execution": { "$ref": "#/components/schemas/Execution" }, "output": { "description": "The returned value of the Tool's execute function." }, "output_status": { "description": "The status of the output. \"valid\" means your Tool executed successfully and returned a valid JSON-serializable object, or void. \"json_serialization_error\" means your Tool executed successfully, but returned a nonserializable object. \"error\" means your Tool failed to execute.", "enum": [ "error", "json_serialization_error", "valid" ], "type": "string" } }, "required": [ "output", "output_status", "execution" ], "type": "object" }, "Execution": { "description": "The execution details of the Tool.", "properties": { "exit_code": { "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.", "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": { "properties": { "password": { "type": "string" }, "user_id": { "type": "string" } }, "type": "object" }, "HTTPBearer": { "description": "Configuration to add an 'Authorization' header using the 'Bearer' scheme.", "properties": { "token": { "description": "The token to set, e.g. 'Authorization: Bearer \u003ctoken\u003e'.", "type": "string" } }, "type": "object" }, "HTTPHeader": { "properties": { "name": { "type": "string" }, "value": { "type": "string" } }, "type": "object" }, "HTTPQuery": { "properties": { "key": { "type": "string" }, "value": { "type": "string" } }, "type": "object" }, "HTTPTool": { "description": "Configuration for HTTP requests and authentication.", "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": { "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.", "properties": { "secret_id": { "type": "string" }, "token": { "description": "The token to set, e.g. 'Authorization: Bearer \u003ctoken\u003e'.", "type": "string" } }, "type": "object" }, "HTTPToolQuery": { "properties": { "key": { "type": "string" }, "secret_id": { "type": "string" }, "value": { "type": "string" } }, "type": "object" }, "Limits": { "description": "Configuration for execution environment limits.", "properties": { "execution_timeout": { "description": "The maximum time allowed for execution (in seconds). Default is 30.", "type": "integer" }, "memory_size": { "description": "The maximum memory allowed for execution (in MiB). Default is 128.", "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", "package.json" ], "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].", "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": { "description": "The code of the tool. You must define a function named \"execute\" that takes in a single argument and returns a JSON-serializable value. The argument will be the \"input\" passed when executing the tool, and will match the input schema.", "type": "string" }, "description": { "description": "A description of the tool.", "type": "string" }, "id": { "description": "The ID of the tool.", "type": "string" }, "input_schema": { "description": "The input schema of the tool. This must be a valid JSON Schema object." }, "language": { "description": "The language of the tool's code.", "enum": [ "python", "javascript", "typescript" ], "type": "string" }, "name": { "description": "The name of the tool.", "type": "string" }, "revision_id": { "description": "The ID of the tool's current revision. This is used to pin executions to a specific version of the tool, even if the tool is updated later.", "type": "string" }, "runtime_revision_id": { "description": "The ID of the custom runtime revision that the tool uses for executions. This pins executions to specific version of a custom runtime runtime, even if the runtime is updated later.", "type": "string" } }, "required": [ "id", "name", "description", "code", "language", "input_schema", "revision_id" ], "type": "object" }, "UpdateToolRequest": { "properties": { "code": { "description": "The code of the tool. You must define a function named \"execute\" that takes in a single argument and returns a JSON-serializable value. The argument will be the \"input\" passed when executing the tool, and will match the input schema.", "type": "string" }, "description": { "description": "A description of the tool.", "type": "string" }, "input_schema": { "description": "The input schema of the tool. This must be a valid JSON Schema object." }, "language": { "description": "The language of the tool's code.", "enum": [ "python", "javascript", "typescript" ], "type": "string" }, "name": { "description": "The name of the tool.", "type": "string" }, "runtime_revision_id": { "description": "The ID of the custom runtime revision that the tool uses for executions. This is used to pin executions to a specific version of a custom runtime, even if the runtime is updated later.", "type": "string" } }, "type": "object" } }, "securitySchemes": { "bearerHttpAuthentication": { "scheme": "bearer", "type": "http" } } }, "info": { "title": "Execute", "version": "0.1.4" }, "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/execute-function": { "post": { "description": "Run a function in a secure, isolated environment. Define a function named `execute`. The function will be passed `input` as an object.", "operationId": "Sandbox_ExecuteFunction", "requestBody": { "content": { "application/json": { "examples": { "Python": { "value": { "language": "python", "code": "def execute(input): return { \"name\": input[\"name\"], \"executed\": True }", "input": { "name": "John" } } } }, "schema": { "$ref": "#/components/schemas/ExecuteFunctionRequest" } } }, "required": true }, "responses": { "200": { "content": { "application/json": { "examples": { "Python": { "value": { "output": { "name": "John", "executed": true }, "output_status": "valid", "execution": { "exit_code": 0, "stdout": "", "stderr": "" } } } }, "schema": { "$ref": "#/components/schemas/ExecuteFunctionResponse" } } }, "description": "OK" }, "401": { "content": { "application/json": { "examples": { "unauthenticated": { "value": { "code": 16, "message": "unauthenticated" } } }, "schema": { "$ref": "#/components/schemas/Status" } } }, "description": "Unauthenticated error response" } }, "summary": "Execute function", "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": [] } ], "servers": [ { "url": "https://api.riza.io" } ] }