curl --request POST \
--url https://api.egp.scale.com/v5/builds \
--header 'Content-Type: multipart/form-data' \
--header 'x-api-key: <api-key>' \
--form context_archive='@example-file' \
--form 'image_name=<string>' \
--form 'agent_name=<string>' \
--form 'agent_id=<string>' \
--form image_tag=latest \
--form 'build_args=<string>' \
--form 'source_repo=<string>' \
--form 'source_commit=<string>' \
--form 'source_ref=<string>' \
--form 'source_subpath=<string>' \
--form 'working_tree_hash=<string>' \
--form source_dirty=trueimport requests
url = "https://api.egp.scale.com/v5/builds"
files = { "context_archive": ("example-file", open("example-file", "rb")) }
payload = {
"image_name": "<string>",
"agent_name": "<string>",
"agent_id": "<string>",
"image_tag": "latest",
"build_args": "<string>",
"source_repo": "<string>",
"source_commit": "<string>",
"source_ref": "<string>",
"source_subpath": "<string>",
"working_tree_hash": "<string>",
"source_dirty": "true"
}
headers = {"x-api-key": "<api-key>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('context_archive', '<string>');
form.append('image_name', '<string>');
form.append('agent_name', '<string>');
form.append('agent_id', '<string>');
form.append('image_tag', 'latest');
form.append('build_args', '<string>');
form.append('source_repo', '<string>');
form.append('source_commit', '<string>');
form.append('source_ref', '<string>');
form.append('source_subpath', '<string>');
form.append('working_tree_hash', '<string>');
form.append('source_dirty', 'true');
const options = {method: 'POST', headers: {'x-api-key': '<api-key>'}};
options.body = form;
fetch('https://api.egp.scale.com/v5/builds', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.egp.scale.com/v5/builds",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"context_archive\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image_name\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"agent_name\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"agent_id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image_tag\"\r\n\r\nlatest\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"build_args\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"source_repo\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"source_commit\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"source_ref\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"source_subpath\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"working_tree_hash\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"source_dirty\"\r\n\r\ntrue\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Content-Type: multipart/form-data",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.egp.scale.com/v5/builds"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"context_archive\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image_name\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"agent_name\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"agent_id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image_tag\"\r\n\r\nlatest\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"build_args\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"source_repo\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"source_commit\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"source_ref\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"source_subpath\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"working_tree_hash\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"source_dirty\"\r\n\r\ntrue\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.egp.scale.com/v5/builds")
.header("x-api-key", "<api-key>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"context_archive\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image_name\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"agent_name\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"agent_id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image_tag\"\r\n\r\nlatest\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"build_args\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"source_repo\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"source_commit\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"source_ref\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"source_subpath\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"working_tree_hash\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"source_dirty\"\r\n\r\ntrue\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.egp.scale.com/v5/builds")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"context_archive\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image_name\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"agent_name\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"agent_id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image_tag\"\r\n\r\nlatest\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"build_args\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"source_repo\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"source_commit\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"source_ref\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"source_subpath\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"working_tree_hash\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"source_dirty\"\r\n\r\ntrue\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"cloud_provider_build_id": "<string>",
"agent_name": "<string>",
"image_name": "<string>",
"image_tag": "<string>",
"build_status": "queued",
"source_repo": "<string>",
"source_commit": "<string>",
"source_ref": "<string>",
"source_subpath": "<string>",
"working_tree_hash": "<string>",
"source_dirty": true,
"account_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"created_by": {
"id": "<string>",
"type": "user",
"object": "identity"
},
"object": "agentex_cloud_build",
"agent_id": "<string>",
"image_url": "<string>",
"build_start_time": "2023-11-07T05:31:56Z",
"build_end_time": "2023-11-07T05:31:56Z"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Submit container image build
Submit a container image build from an uploaded build context and return the created build record.
The request is multipart form data: a tar.gz context_archive with the Dockerfile at its root is
streamed to cloud object storage, along with the target image_name, an optional image_tag
(defaults to latest), optional Docker build_args supplied as a JSON string, and an optional
target platform. Exactly one of agent_name or agent_id must be provided: pass agent_name to
create a brand-new agent for a first-time build (rejected if an agent with that name already exists),
or agent_id to build for an agent that already exists. The build is handed to the configured cloud
build provider and runs asynchronously, so the returned record reflects the build’s initial status
(typically queued or running) rather than a finished image; poll Get Build or follow Stream Build
Logs to observe progression to a terminal state. The request is rejected if the archive is missing or
empty, exceeds 500MB, or if build_args is not valid JSON.
curl --request POST \
--url https://api.egp.scale.com/v5/builds \
--header 'Content-Type: multipart/form-data' \
--header 'x-api-key: <api-key>' \
--form context_archive='@example-file' \
--form 'image_name=<string>' \
--form 'agent_name=<string>' \
--form 'agent_id=<string>' \
--form image_tag=latest \
--form 'build_args=<string>' \
--form 'source_repo=<string>' \
--form 'source_commit=<string>' \
--form 'source_ref=<string>' \
--form 'source_subpath=<string>' \
--form 'working_tree_hash=<string>' \
--form source_dirty=trueimport requests
url = "https://api.egp.scale.com/v5/builds"
files = { "context_archive": ("example-file", open("example-file", "rb")) }
payload = {
"image_name": "<string>",
"agent_name": "<string>",
"agent_id": "<string>",
"image_tag": "latest",
"build_args": "<string>",
"source_repo": "<string>",
"source_commit": "<string>",
"source_ref": "<string>",
"source_subpath": "<string>",
"working_tree_hash": "<string>",
"source_dirty": "true"
}
headers = {"x-api-key": "<api-key>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('context_archive', '<string>');
form.append('image_name', '<string>');
form.append('agent_name', '<string>');
form.append('agent_id', '<string>');
form.append('image_tag', 'latest');
form.append('build_args', '<string>');
form.append('source_repo', '<string>');
form.append('source_commit', '<string>');
form.append('source_ref', '<string>');
form.append('source_subpath', '<string>');
form.append('working_tree_hash', '<string>');
form.append('source_dirty', 'true');
const options = {method: 'POST', headers: {'x-api-key': '<api-key>'}};
options.body = form;
fetch('https://api.egp.scale.com/v5/builds', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.egp.scale.com/v5/builds",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"context_archive\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image_name\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"agent_name\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"agent_id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image_tag\"\r\n\r\nlatest\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"build_args\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"source_repo\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"source_commit\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"source_ref\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"source_subpath\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"working_tree_hash\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"source_dirty\"\r\n\r\ntrue\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Content-Type: multipart/form-data",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.egp.scale.com/v5/builds"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"context_archive\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image_name\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"agent_name\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"agent_id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image_tag\"\r\n\r\nlatest\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"build_args\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"source_repo\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"source_commit\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"source_ref\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"source_subpath\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"working_tree_hash\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"source_dirty\"\r\n\r\ntrue\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.egp.scale.com/v5/builds")
.header("x-api-key", "<api-key>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"context_archive\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image_name\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"agent_name\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"agent_id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image_tag\"\r\n\r\nlatest\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"build_args\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"source_repo\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"source_commit\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"source_ref\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"source_subpath\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"working_tree_hash\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"source_dirty\"\r\n\r\ntrue\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.egp.scale.com/v5/builds")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"context_archive\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image_name\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"agent_name\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"agent_id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image_tag\"\r\n\r\nlatest\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"build_args\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"source_repo\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"source_commit\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"source_ref\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"source_subpath\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"working_tree_hash\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"source_dirty\"\r\n\r\ntrue\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"cloud_provider_build_id": "<string>",
"agent_name": "<string>",
"image_name": "<string>",
"image_tag": "<string>",
"build_status": "queued",
"source_repo": "<string>",
"source_commit": "<string>",
"source_ref": "<string>",
"source_subpath": "<string>",
"working_tree_hash": "<string>",
"source_dirty": true,
"account_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"created_by": {
"id": "<string>",
"type": "user",
"object": "identity"
},
"object": "agentex_cloud_build",
"agent_id": "<string>",
"image_url": "<string>",
"build_start_time": "2023-11-07T05:31:56Z",
"build_end_time": "2023-11-07T05:31:56Z"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authorizations
Headers
Body
tar.gz archive containing the build context (Dockerfile and any files needed for the build)
Name for the built image
Name of the brand-new agent to create from this build
ID of the existing agent this build targets
Tag for the built image
JSON string of build arguments
Target platform for the Docker build. Defaults to the build host's native architecture when not specified.
linux/amd64, linux/arm64, linux/arm/v7 Normalized git remote the build context came from.
2048Git commit the build context was at.
64^(?:[0-9a-fA-F]{40}|[0-9a-fA-F]{64})$Git branch or tag for source_commit.
4096Build-context path relative to the repo root.
4096Deterministic SHA-256 content hash of the build inputs.
64^[0-9a-fA-F]{64}$Whether the work tree had uncommitted changes at build time.
Response
Successful Response
The unique identifier of the entity.
The unique identifier of the build from the cloud provider, or an internal UUID when an existing image is copied without a provider build.
The name of the agent that this build belongs to
The name of the container image to build.
The tag for the container image.
The current build lifecycle status
queued, running, success, failed, cancelling, cancelled, deleting, delete_failed, timed_out, error, unknown Normalized git remote the build context came from (host/path, no credentials).
Git commit the build context was at, when a git work tree.
Git branch or tag for source_commit, when resolvable.
Build-context path relative to the repo root (which agent, in a monorepo).
Deterministic SHA-256 content hash of the build inputs (not the tarball).
Whether the work tree had uncommitted changes at build time (null outside git).
The ID of the account that owns the given entity.
The date and time when the entity was created in ISO format.
The identity that created the entity.
Show child attributes
Show child attributes
"agentex_cloud_build"The UUID of the agent that this build belongs to
The URL of the container image. This is not guaranteed to be present until the build is complete.
When the cloud provider started the build
When the cloud provider finished the build

