forge-sandbox POST /v1/compute request and reply v1
Forge API 1
request
| Name | Type | Required |
|---|---|---|
| request_id | string | Required |
| script | object | Required |
| inputs | object | Required |
| bars | object | Required |
| start | integer | Required |
| limits | object | Required |
reply_ok
| Name | Type | Required |
|---|---|---|
| request_id | string | Required |
| ok | any | Required |
| outputs | object | Required |
| drawings | array | Required |
| logs | array | Required |
| warmup | integer | Required |
| usage | object | Required |
Schema
json
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "forge-sandbox POST /v1/compute request and reply v1",
"oneOf": [
{
"$ref": "#/$defs/request"
},
{
"$ref": "#/$defs/reply_ok"
},
{
"$ref": "#/$defs/reply_error"
}
],
"$defs": {
"sha256": {
"type": "string",
"pattern": "^[0-9a-f]{64}$"
},
"request": {
"type": "object",
"additionalProperties": false,
"required": [
"request_id",
"script",
"inputs",
"bars",
"start",
"limits"
],
"properties": {
"request_id": {
"type": "string",
"format": "uuid"
},
"script": {
"type": "object",
"additionalProperties": false,
"required": [
"id",
"version",
"sha256",
"forge_api",
"source"
],
"properties": {
"id": {
"type": "string"
},
"version": {
"type": "integer",
"minimum": 1
},
"sha256": {
"$ref": "#/$defs/sha256"
},
"forge_api": {
"type": "integer",
"minimum": 1
},
"source": {
"type": "string",
"minLength": 1,
"maxLength": 1048576
}
}
},
"inputs": {
"type": "object"
},
"bars": {
"type": "object",
"additionalProperties": false,
"required": [
"primary"
],
"properties": {
"primary": {
"$ref": "bar-page.schema.json"
},
"extra": {
"type": "object",
"additionalProperties": {
"$ref": "bar-page.schema.json"
}
}
}
},
"start": {
"type": "integer",
"minimum": 0
},
"limits": {
"type": "object",
"additionalProperties": false,
"required": [
"cpu_ms",
"wall_ms",
"mem_mb",
"max_outputs",
"max_drawings",
"max_log_lines"
],
"properties": {
"cpu_ms": {
"type": "integer",
"minimum": 1
},
"wall_ms": {
"type": "integer",
"minimum": 1
},
"mem_mb": {
"type": "integer",
"minimum": 16
},
"max_outputs": {
"type": "integer",
"minimum": 1,
"maximum": 64
},
"max_drawings": {
"type": "integer",
"minimum": 0
},
"max_log_lines": {
"type": "integer",
"minimum": 0
}
}
}
}
},
"reply_ok": {
"type": "object",
"additionalProperties": false,
"required": [
"request_id",
"ok",
"outputs",
"drawings",
"logs",
"warmup",
"usage"
],
"properties": {
"request_id": {
"type": "string"
},
"ok": {
"const": true
},
"outputs": {
"type": "object",
"maxProperties": 64
},
"drawings": {
"type": "array"
},
"logs": {
"type": "array",
"items": {
"type": "object",
"required": [
"level",
"message"
],
"properties": {
"level": {
"enum": [
"info",
"warning",
"error"
]
},
"message": {
"type": "string"
},
"bar": {
"type": [
"integer",
"null"
]
}
}
}
},
"warmup": {
"type": "integer",
"minimum": 0
},
"usage": {
"type": "object",
"additionalProperties": false,
"required": [
"cpu_ms",
"wall_ms",
"peak_mem_mb"
],
"properties": {
"cpu_ms": {
"type": "number"
},
"wall_ms": {
"type": "number"
},
"peak_mem_mb": {
"type": "number"
}
}
}
}
},
"reply_error": {
"type": "object",
"additionalProperties": false,
"required": [
"request_id",
"ok",
"error"
],
"properties": {
"request_id": {
"type": "string"
},
"ok": {
"const": false
},
"error": {
"type": "object",
"additionalProperties": false,
"required": [
"code",
"message",
"detail"
],
"properties": {
"code": {
"enum": [
"cap_cpu",
"cap_wall",
"cap_memory",
"cap_outputs",
"cap_drawings",
"user_exception",
"forbidden_call",
"forge_api_unsupported",
"bad_request",
"internal"
]
},
"message": {
"type": "string"
},
"detail": {
"type": "object",
"properties": {
"cap": {
"type": "string"
},
"used": {
"type": "number"
},
"allowed": {
"type": "number"
},
"file": {
"type": "string"
},
"line": {
"type": "integer"
}
}
}
}
}
}
}
}
}