JavaScript
import BrainbaseLabs from 'brainbase-labs';
const client = new BrainbaseLabs({
apiKey: process.env['BRAINBASE_LABS_API_KEY'], // This is the default and can be omitted
});
await client.workers.runtimeErrors.record('workerId', {
error: 'error',
service: 'service',
type: 'type',
});import os
from brainbase_labs import BrainbaseLabs
client = BrainbaseLabs(
api_key=os.environ.get("BRAINBASE_LABS_API_KEY"), # This is the default and can be omitted
)
client.workers.runtime_errors.record(
worker_id="workerId",
error="error",
service="service",
type="type",
)curl --request POST \
--url https://brainbase-monorepo-api.onrender.com/api/workers/{workerId}/runtime-errors \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"type": "<string>",
"service": "<string>",
"error": "<string>",
"traceback": "<string>",
"severity": "error",
"functionName": "<string>",
"lineNumber": 123,
"metadata": {},
"deploymentId": "<string>",
"flowId": "<string>",
"bbEngineSessionId": "<string>"
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://brainbase-monorepo-api.onrender.com/api/workers/{workerId}/runtime-errors",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'type' => '<string>',
'service' => '<string>',
'error' => '<string>',
'traceback' => '<string>',
'severity' => 'error',
'functionName' => '<string>',
'lineNumber' => 123,
'metadata' => [
],
'deploymentId' => '<string>',
'flowId' => '<string>',
'bbEngineSessionId' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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://brainbase-monorepo-api.onrender.com/api/workers/{workerId}/runtime-errors"
payload := strings.NewReader("{\n \"type\": \"<string>\",\n \"service\": \"<string>\",\n \"error\": \"<string>\",\n \"traceback\": \"<string>\",\n \"severity\": \"error\",\n \"functionName\": \"<string>\",\n \"lineNumber\": 123,\n \"metadata\": {},\n \"deploymentId\": \"<string>\",\n \"flowId\": \"<string>\",\n \"bbEngineSessionId\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://brainbase-monorepo-api.onrender.com/api/workers/{workerId}/runtime-errors")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"<string>\",\n \"service\": \"<string>\",\n \"error\": \"<string>\",\n \"traceback\": \"<string>\",\n \"severity\": \"error\",\n \"functionName\": \"<string>\",\n \"lineNumber\": 123,\n \"metadata\": {},\n \"deploymentId\": \"<string>\",\n \"flowId\": \"<string>\",\n \"bbEngineSessionId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://brainbase-monorepo-api.onrender.com/api/workers/{workerId}/runtime-errors")
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["Content-Type"] = 'application/json'
request.body = "{\n \"type\": \"<string>\",\n \"service\": \"<string>\",\n \"error\": \"<string>\",\n \"traceback\": \"<string>\",\n \"severity\": \"error\",\n \"functionName\": \"<string>\",\n \"lineNumber\": 123,\n \"metadata\": {},\n \"deploymentId\": \"<string>\",\n \"flowId\": \"<string>\",\n \"bbEngineSessionId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyRuntime Errors
Record a runtime error from the Based engine
POST
/
api
/
workers
/
{workerId}
/
runtime-errors
JavaScript
import BrainbaseLabs from 'brainbase-labs';
const client = new BrainbaseLabs({
apiKey: process.env['BRAINBASE_LABS_API_KEY'], // This is the default and can be omitted
});
await client.workers.runtimeErrors.record('workerId', {
error: 'error',
service: 'service',
type: 'type',
});import os
from brainbase_labs import BrainbaseLabs
client = BrainbaseLabs(
api_key=os.environ.get("BRAINBASE_LABS_API_KEY"), # This is the default and can be omitted
)
client.workers.runtime_errors.record(
worker_id="workerId",
error="error",
service="service",
type="type",
)curl --request POST \
--url https://brainbase-monorepo-api.onrender.com/api/workers/{workerId}/runtime-errors \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"type": "<string>",
"service": "<string>",
"error": "<string>",
"traceback": "<string>",
"severity": "error",
"functionName": "<string>",
"lineNumber": 123,
"metadata": {},
"deploymentId": "<string>",
"flowId": "<string>",
"bbEngineSessionId": "<string>"
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://brainbase-monorepo-api.onrender.com/api/workers/{workerId}/runtime-errors",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'type' => '<string>',
'service' => '<string>',
'error' => '<string>',
'traceback' => '<string>',
'severity' => 'error',
'functionName' => '<string>',
'lineNumber' => 123,
'metadata' => [
],
'deploymentId' => '<string>',
'flowId' => '<string>',
'bbEngineSessionId' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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://brainbase-monorepo-api.onrender.com/api/workers/{workerId}/runtime-errors"
payload := strings.NewReader("{\n \"type\": \"<string>\",\n \"service\": \"<string>\",\n \"error\": \"<string>\",\n \"traceback\": \"<string>\",\n \"severity\": \"error\",\n \"functionName\": \"<string>\",\n \"lineNumber\": 123,\n \"metadata\": {},\n \"deploymentId\": \"<string>\",\n \"flowId\": \"<string>\",\n \"bbEngineSessionId\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://brainbase-monorepo-api.onrender.com/api/workers/{workerId}/runtime-errors")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"<string>\",\n \"service\": \"<string>\",\n \"error\": \"<string>\",\n \"traceback\": \"<string>\",\n \"severity\": \"error\",\n \"functionName\": \"<string>\",\n \"lineNumber\": 123,\n \"metadata\": {},\n \"deploymentId\": \"<string>\",\n \"flowId\": \"<string>\",\n \"bbEngineSessionId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://brainbase-monorepo-api.onrender.com/api/workers/{workerId}/runtime-errors")
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["Content-Type"] = 'application/json'
request.body = "{\n \"type\": \"<string>\",\n \"service\": \"<string>\",\n \"error\": \"<string>\",\n \"traceback\": \"<string>\",\n \"severity\": \"error\",\n \"functionName\": \"<string>\",\n \"lineNumber\": 123,\n \"metadata\": {},\n \"deploymentId\": \"<string>\",\n \"flowId\": \"<string>\",\n \"bbEngineSessionId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyAuthorizations
API key authentication
Path Parameters
Body
application/json
Error type/class (e.g., "ValueError", "RuntimeError")
Service that generated the error (e.g., "based_engine", "sms")
Error message
Full stack trace
Available options:
warning, error, critical Function being executed when error occurred
Line number in Based code
Additional context
Deployment ID (optional)
Flow ID (used to lookup deployment if deploymentId not provided)
Session ID for trace correlation
Response
Runtime error recorded successfully
⌘I
