from meetkai_mka1 import SDK
with SDK(
bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as sdk:
res = sdk.llm.evals.upload_sample_trajectory(run_id="eval_run_aa87e2b1112a455b8deabed784372198", sample_index=0, steps=[
{
"step_id": 1,
"source": "agent",
"reasoning_content": "The test fails because the fixture directory is not writable.",
"tool_calls": [
{
"function_name": "bash",
"arguments": {
"command": "ls -la /workdir",
},
},
],
},
], schema_version="ATIF-v1.7")
# Handle response
print(res)import { SDK } from "@meetkai/mka1";
const sdk = new SDK({
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await sdk.llm.evals.uploadSampleTrajectory({
runId: "eval_run_aa87e2b1112a455b8deabed784372198",
sampleIndex: 0,
uploadEvalSampleTrajectoryRequest: {
steps: [
{
"step_id": 1,
"source": "agent",
"reasoning_content": "The test fails because the fixture directory is not writable.",
"tool_calls": [
{
"function_name": "bash",
"arguments": {
"command": "ls -la /workdir",
},
},
],
},
],
},
});
console.log(result);
}
run();using MeetKai.MKA1;
using MeetKai.MKA1.Types.Components;
using System.Collections.Generic;
var sdk = new SDK(bearerAuth: "<YOUR_BEARER_TOKEN_HERE>");
Types.Requests.UploadEvalSampleTrajectoryRequest req = new MeetKai.MKA1.Types.Requests.UploadEvalSampleTrajectoryRequest() {
RunId = "eval_run_aa87e2b1112a455b8deabed784372198",
SampleIndex = 0,
Body = new MeetKai.MKA1.Types.Components.UploadEvalSampleTrajectoryRequest() {
Steps = new List<object>() {
new Dictionary<string, object>() {
{ "step_id", 1 },
{ "source", "agent" },
{ "reasoning_content", "The test fails because the fixture directory is not writable." },
{ "tool_calls", new List<object>() {
new Dictionary<string, object>() {
{ "function_name", "bash" },
{ "arguments", new Dictionary<string, object>() {
{ "command", "ls -la /workdir" },
} },
},
} },
},
},
},
};
var res = await sdk.Llm.Evals.UploadSampleTrajectoryAsync(req);
// handle responsecurl --request PUT \
--url https://apigw.mka1.com/api/v1/llm/evals/runs/{run_id}/samples/{sample_index}/trajectory \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"schema_version": "ATIF-v1.7",
"steps": [
{
"step_id": 1,
"source": "agent",
"reasoning_content": "The test fails because the fixture directory is not writable.",
"tool_calls": [
{
"function_name": "bash",
"arguments": {
"command": "ls -la /workdir"
}
}
]
}
]
}
'const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
schema_version: 'ATIF-v1.7',
steps: [
{
step_id: 1,
source: 'agent',
reasoning_content: 'The test fails because the fixture directory is not writable.',
tool_calls: [{function_name: 'bash', arguments: {command: 'ls -la /workdir'}}]
}
]
})
};
fetch('https://apigw.mka1.com/api/v1/llm/evals/runs/{run_id}/samples/{sample_index}/trajectory', 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://apigw.mka1.com/api/v1/llm/evals/runs/{run_id}/samples/{sample_index}/trajectory",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'schema_version' => 'ATIF-v1.7',
'steps' => [
[
'step_id' => 1,
'source' => 'agent',
'reasoning_content' => 'The test fails because the fixture directory is not writable.',
'tool_calls' => [
[
'function_name' => 'bash',
'arguments' => [
'command' => 'ls -la /workdir'
]
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://apigw.mka1.com/api/v1/llm/evals/runs/{run_id}/samples/{sample_index}/trajectory"
payload := strings.NewReader("{\n \"schema_version\": \"ATIF-v1.7\",\n \"steps\": [\n {\n \"step_id\": 1,\n \"source\": \"agent\",\n \"reasoning_content\": \"The test fails because the fixture directory is not writable.\",\n \"tool_calls\": [\n {\n \"function_name\": \"bash\",\n \"arguments\": {\n \"command\": \"ls -la /workdir\"\n }\n }\n ]\n }\n ]\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.put("https://apigw.mka1.com/api/v1/llm/evals/runs/{run_id}/samples/{sample_index}/trajectory")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"schema_version\": \"ATIF-v1.7\",\n \"steps\": [\n {\n \"step_id\": 1,\n \"source\": \"agent\",\n \"reasoning_content\": \"The test fails because the fixture directory is not writable.\",\n \"tool_calls\": [\n {\n \"function_name\": \"bash\",\n \"arguments\": {\n \"command\": \"ls -la /workdir\"\n }\n }\n ]\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apigw.mka1.com/api/v1/llm/evals/runs/{run_id}/samples/{sample_index}/trajectory")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"schema_version\": \"ATIF-v1.7\",\n \"steps\": [\n {\n \"step_id\": 1,\n \"source\": \"agent\",\n \"reasoning_content\": \"The test fails because the fixture directory is not writable.\",\n \"tool_calls\": [\n {\n \"function_name\": \"bash\",\n \"arguments\": {\n \"command\": \"ls -la /workdir\"\n }\n }\n ]\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"object": "eval.sample.trajectory.uploaded",
"run_id": "eval_run_aa87e2b1112a455b8deabed784372198",
"sample_index": 0,
"task_id": "fix-permissions",
"model": "meetkai:functionary-urdu-mini-pak",
"step_count": 42,
"size_bytes": 94208
}Upload an eval sample trajectory
Stores one coding-agent trial’s session, in whatever interchange format the harness produced (record it in schema_version, e.g. ATIF-v1.7). steps is stored verbatim and never validated, so a harness format change needs no gateway release. Separate from the run import because a trajectory averages ~92 KB and a whole run’s worth would not fit in one request. Upserts, so re-sending after a timeout replaces the trajectory rather than failing. Sample indices are unique per (task, model), not per run, so pass task_id and/or model when the run covers more than one — an ambiguous index returns 400 rather than writing to the wrong trial. Rejects a payload whose steps and logs together exceed 16 MiB with 413.
from meetkai_mka1 import SDK
with SDK(
bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as sdk:
res = sdk.llm.evals.upload_sample_trajectory(run_id="eval_run_aa87e2b1112a455b8deabed784372198", sample_index=0, steps=[
{
"step_id": 1,
"source": "agent",
"reasoning_content": "The test fails because the fixture directory is not writable.",
"tool_calls": [
{
"function_name": "bash",
"arguments": {
"command": "ls -la /workdir",
},
},
],
},
], schema_version="ATIF-v1.7")
# Handle response
print(res)import { SDK } from "@meetkai/mka1";
const sdk = new SDK({
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await sdk.llm.evals.uploadSampleTrajectory({
runId: "eval_run_aa87e2b1112a455b8deabed784372198",
sampleIndex: 0,
uploadEvalSampleTrajectoryRequest: {
steps: [
{
"step_id": 1,
"source": "agent",
"reasoning_content": "The test fails because the fixture directory is not writable.",
"tool_calls": [
{
"function_name": "bash",
"arguments": {
"command": "ls -la /workdir",
},
},
],
},
],
},
});
console.log(result);
}
run();using MeetKai.MKA1;
using MeetKai.MKA1.Types.Components;
using System.Collections.Generic;
var sdk = new SDK(bearerAuth: "<YOUR_BEARER_TOKEN_HERE>");
Types.Requests.UploadEvalSampleTrajectoryRequest req = new MeetKai.MKA1.Types.Requests.UploadEvalSampleTrajectoryRequest() {
RunId = "eval_run_aa87e2b1112a455b8deabed784372198",
SampleIndex = 0,
Body = new MeetKai.MKA1.Types.Components.UploadEvalSampleTrajectoryRequest() {
Steps = new List<object>() {
new Dictionary<string, object>() {
{ "step_id", 1 },
{ "source", "agent" },
{ "reasoning_content", "The test fails because the fixture directory is not writable." },
{ "tool_calls", new List<object>() {
new Dictionary<string, object>() {
{ "function_name", "bash" },
{ "arguments", new Dictionary<string, object>() {
{ "command", "ls -la /workdir" },
} },
},
} },
},
},
},
};
var res = await sdk.Llm.Evals.UploadSampleTrajectoryAsync(req);
// handle responsecurl --request PUT \
--url https://apigw.mka1.com/api/v1/llm/evals/runs/{run_id}/samples/{sample_index}/trajectory \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"schema_version": "ATIF-v1.7",
"steps": [
{
"step_id": 1,
"source": "agent",
"reasoning_content": "The test fails because the fixture directory is not writable.",
"tool_calls": [
{
"function_name": "bash",
"arguments": {
"command": "ls -la /workdir"
}
}
]
}
]
}
'const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
schema_version: 'ATIF-v1.7',
steps: [
{
step_id: 1,
source: 'agent',
reasoning_content: 'The test fails because the fixture directory is not writable.',
tool_calls: [{function_name: 'bash', arguments: {command: 'ls -la /workdir'}}]
}
]
})
};
fetch('https://apigw.mka1.com/api/v1/llm/evals/runs/{run_id}/samples/{sample_index}/trajectory', 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://apigw.mka1.com/api/v1/llm/evals/runs/{run_id}/samples/{sample_index}/trajectory",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'schema_version' => 'ATIF-v1.7',
'steps' => [
[
'step_id' => 1,
'source' => 'agent',
'reasoning_content' => 'The test fails because the fixture directory is not writable.',
'tool_calls' => [
[
'function_name' => 'bash',
'arguments' => [
'command' => 'ls -la /workdir'
]
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://apigw.mka1.com/api/v1/llm/evals/runs/{run_id}/samples/{sample_index}/trajectory"
payload := strings.NewReader("{\n \"schema_version\": \"ATIF-v1.7\",\n \"steps\": [\n {\n \"step_id\": 1,\n \"source\": \"agent\",\n \"reasoning_content\": \"The test fails because the fixture directory is not writable.\",\n \"tool_calls\": [\n {\n \"function_name\": \"bash\",\n \"arguments\": {\n \"command\": \"ls -la /workdir\"\n }\n }\n ]\n }\n ]\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.put("https://apigw.mka1.com/api/v1/llm/evals/runs/{run_id}/samples/{sample_index}/trajectory")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"schema_version\": \"ATIF-v1.7\",\n \"steps\": [\n {\n \"step_id\": 1,\n \"source\": \"agent\",\n \"reasoning_content\": \"The test fails because the fixture directory is not writable.\",\n \"tool_calls\": [\n {\n \"function_name\": \"bash\",\n \"arguments\": {\n \"command\": \"ls -la /workdir\"\n }\n }\n ]\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apigw.mka1.com/api/v1/llm/evals/runs/{run_id}/samples/{sample_index}/trajectory")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"schema_version\": \"ATIF-v1.7\",\n \"steps\": [\n {\n \"step_id\": 1,\n \"source\": \"agent\",\n \"reasoning_content\": \"The test fails because the fixture directory is not writable.\",\n \"tool_calls\": [\n {\n \"function_name\": \"bash\",\n \"arguments\": {\n \"command\": \"ls -la /workdir\"\n }\n }\n ]\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"object": "eval.sample.trajectory.uploaded",
"run_id": "eval_run_aa87e2b1112a455b8deabed784372198",
"sample_index": 0,
"task_id": "fix-permissions",
"model": "meetkai:functionary-urdu-mini-pak",
"step_count": 42,
"size_bytes": 94208
}Authorizations
Gateway auth: send Authorization: Bearer <mka1-api-key>. For multi-user server-side integrations, you can also send X-On-Behalf-Of: <external-user-id>.
Headers
Optional external end-user identifier forwarded by the API gateway.
Path Parameters
0 <= x <= 2147483647Query Parameters
Disambiguate the sample index, which is unique per (task, model) and not per run. Required when the index matches trials from more than one task.
Disambiguate the sample index when the run covers more than one model.
Body
Steps exactly as the harness wrote them. Stored verbatim and never validated, so a format change needs no gateway release.
Interchange format of steps. Stored per row so a harness upgrade leaves older trajectories readable.
1 - 32Bounded tails of the trial's log files, keyed by their path in the trial dir — trial.log (the harness's own account of the trial), verifier/test-stdout.txt / test-stderr.txt, exception.txt. The harness tails each file before sending; the whole payload still counts against the trajectory size limit.
Show child attributes
Show child attributes
Response
OK
-9007199254740991 <= x <= 9007199254740991-9007199254740991 <= x <= 9007199254740991Measured from the stored payload, so it describes what was actually written.
-9007199254740991 <= x <= 9007199254740991Was this page helpful?