import os
from meibel import MeibelClient
from meibel.models import (
CreateBatchExecutionRequest,
LegacyBatchSpecJson,
LegacyBatchInputConfig,
LegacyBatchOutputConfig,
LegacyBatchExecutionParams,
)
client = MeibelClient(api_key=os.environ["MEIBEL_API_KEY"])
batch_spec_json = LegacyBatchSpecJson(
name="invoice-extraction-run",
version="1.0.0",
agent="agent_def_7f3a9c2b",
user_message="Extract line items and totals from each invoice.",
input=LegacyBatchInputConfig(
datasource_id="ds_invoices_2024",
),
output=LegacyBatchOutputConfig(
datasource_id="ds_invoice_results",
),
execution=LegacyBatchExecutionParams(
concurrency=5,
retry_limit=2,
),
)
execution = client.batches.executions.create(
CreateBatchExecutionRequest(batch_spec_json=batch_spec_json)
)
print(f"Execution ID: {execution.id}, status: {execution.status}")import { MeibelClient } from "meibel";
const client = new MeibelClient({ apiKey: process.env.MEIBEL_API_KEY });
const execution = await client.batches.executions.create({
batch_spec_json: {
name: "invoice-extraction-batch",
version: "1.0.0",
agent: "agent_def_7f3a9c",
user_message: "Extract line items and totals from each invoice.",
input: {
datasource_id: "ds_invoices_2024",
filters: {
media_types: ["application/pdf"],
regex: "^invoice_.*\\.pdf$",
},
},
output: {
datasource_id: "ds_extracted_results",
},
execution: {
concurrency: 5,
retry_limit: 2,
},
},
});
console.log(`Batch execution ${execution.id} status: ${execution.status}`);package main
import (
"context"
"fmt"
"os"
v2 "github.com/meibel-ai/meibel-go/v2"
)
func main() {
client := v2.NewClient(v2.WithAPIKey(os.Getenv("MEIBEL_API_KEY")))
execution, err := client.Batches.Executions.Create(context.Background(), v2.CreateBatchExecutionRequest{
BatchSpecJson: v2.LegacyBatchSpecJson{
Name: "invoice-extraction-run",
Agent: "agent_8f3d2a1c",
UserMessage: v2.String("Extract line items and totals from each invoice"),
Input: v2.LegacyBatchInputConfig{
DatasourceId: "ds_9b7e1234",
Filters: &v2.LegacyBatchInputFilters{
MediaTypes: []string{"application/pdf"},
},
},
Output: &v2.LegacyBatchOutputConfig{
DatasourceId: v2.String("ds_output_4d2f0a"),
},
Execution: &v2.LegacyBatchExecutionParams{
Concurrency: v2.Int(5),
RetryLimit: v2.Int(3),
},
},
})
if err != nil {
fmt.Println("error creating batch execution:", err)
return
}
fmt.Printf("execution id: %s, status: %s\n", execution.Id, execution.Status)
}curl --request POST \
--url https://api.meibel.ai/v2/batch-executions \
--header 'Content-Type: application/json' \
--header 'Meibel-API-Key: <api-key>' \
--data '
{
"batch_spec_json": {
"name": "<string>",
"agent": "<string>",
"input": {
"datasource_id": "<string>",
"filters": {
"regex": "<string>",
"media_types": [
"<string>"
],
"element_ids": [
"<string>"
],
"additional_properties": {}
}
},
"version": "<string>",
"user_message": "<string>",
"output": {
"datasource_id": "<string>"
},
"execution": {
"concurrency": 10,
"retry_limit": 2
},
"additional_properties": {}
}
}
'const options = {
method: 'POST',
headers: {'Meibel-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
batch_spec_json: {
name: '<string>',
agent: '<string>',
input: {
datasource_id: '<string>',
filters: {
regex: '<string>',
media_types: ['<string>'],
element_ids: ['<string>'],
additional_properties: {}
}
},
version: '<string>',
user_message: '<string>',
output: {datasource_id: '<string>'},
execution: {concurrency: 10, retry_limit: 2},
additional_properties: {}
}
})
};
fetch('https://api.meibel.ai/v2/batch-executions', 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.meibel.ai/v2/batch-executions",
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([
'batch_spec_json' => [
'name' => '<string>',
'agent' => '<string>',
'input' => [
'datasource_id' => '<string>',
'filters' => [
'regex' => '<string>',
'media_types' => [
'<string>'
],
'element_ids' => [
'<string>'
],
'additional_properties' => [
]
]
],
'version' => '<string>',
'user_message' => '<string>',
'output' => [
'datasource_id' => '<string>'
],
'execution' => [
'concurrency' => 10,
'retry_limit' => 2
],
'additional_properties' => [
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"Meibel-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.post("https://api.meibel.ai/v2/batch-executions")
.header("Meibel-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"batch_spec_json\": {\n \"name\": \"<string>\",\n \"agent\": \"<string>\",\n \"input\": {\n \"datasource_id\": \"<string>\",\n \"filters\": {\n \"regex\": \"<string>\",\n \"media_types\": [\n \"<string>\"\n ],\n \"element_ids\": [\n \"<string>\"\n ],\n \"additional_properties\": {}\n }\n },\n \"version\": \"<string>\",\n \"user_message\": \"<string>\",\n \"output\": {\n \"datasource_id\": \"<string>\"\n },\n \"execution\": {\n \"concurrency\": 10,\n \"retry_limit\": 2\n },\n \"additional_properties\": {}\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.meibel.ai/v2/batch-executions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Meibel-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"batch_spec_json\": {\n \"name\": \"<string>\",\n \"agent\": \"<string>\",\n \"input\": {\n \"datasource_id\": \"<string>\",\n \"filters\": {\n \"regex\": \"<string>\",\n \"media_types\": [\n \"<string>\"\n ],\n \"element_ids\": [\n \"<string>\"\n ],\n \"additional_properties\": {}\n }\n },\n \"version\": \"<string>\",\n \"user_message\": \"<string>\",\n \"output\": {\n \"datasource_id\": \"<string>\"\n },\n \"execution\": {\n \"concurrency\": 10,\n \"retry_limit\": 2\n },\n \"additional_properties\": {}\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"batch_definition_id": "<string>",
"customer_id": "<string>",
"project_id": "<string>",
"start_time": "2023-11-07T05:31:56Z",
"status": "<string>",
"agent_urn": "<string>",
"batch_spec_json": {},
"agent_spec_json": {},
"input_datasource_id": "<string>",
"output_datasource_id": "<string>",
"input_overrides": {},
"total_items": 123,
"succeeded": 123,
"failed": 123,
"end_time": "2023-11-07T05:31:56Z",
"error": "<string>",
"items": [
{
"input_data_element_id": "<string>",
"filename": "<string>",
"status": "<string>",
"error": "<string>",
"output_artifacts": [
{}
],
"attempts": 1
}
]
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Create Batch Execution
import os
from meibel import MeibelClient
from meibel.models import (
CreateBatchExecutionRequest,
LegacyBatchSpecJson,
LegacyBatchInputConfig,
LegacyBatchOutputConfig,
LegacyBatchExecutionParams,
)
client = MeibelClient(api_key=os.environ["MEIBEL_API_KEY"])
batch_spec_json = LegacyBatchSpecJson(
name="invoice-extraction-run",
version="1.0.0",
agent="agent_def_7f3a9c2b",
user_message="Extract line items and totals from each invoice.",
input=LegacyBatchInputConfig(
datasource_id="ds_invoices_2024",
),
output=LegacyBatchOutputConfig(
datasource_id="ds_invoice_results",
),
execution=LegacyBatchExecutionParams(
concurrency=5,
retry_limit=2,
),
)
execution = client.batches.executions.create(
CreateBatchExecutionRequest(batch_spec_json=batch_spec_json)
)
print(f"Execution ID: {execution.id}, status: {execution.status}")import { MeibelClient } from "meibel";
const client = new MeibelClient({ apiKey: process.env.MEIBEL_API_KEY });
const execution = await client.batches.executions.create({
batch_spec_json: {
name: "invoice-extraction-batch",
version: "1.0.0",
agent: "agent_def_7f3a9c",
user_message: "Extract line items and totals from each invoice.",
input: {
datasource_id: "ds_invoices_2024",
filters: {
media_types: ["application/pdf"],
regex: "^invoice_.*\\.pdf$",
},
},
output: {
datasource_id: "ds_extracted_results",
},
execution: {
concurrency: 5,
retry_limit: 2,
},
},
});
console.log(`Batch execution ${execution.id} status: ${execution.status}`);package main
import (
"context"
"fmt"
"os"
v2 "github.com/meibel-ai/meibel-go/v2"
)
func main() {
client := v2.NewClient(v2.WithAPIKey(os.Getenv("MEIBEL_API_KEY")))
execution, err := client.Batches.Executions.Create(context.Background(), v2.CreateBatchExecutionRequest{
BatchSpecJson: v2.LegacyBatchSpecJson{
Name: "invoice-extraction-run",
Agent: "agent_8f3d2a1c",
UserMessage: v2.String("Extract line items and totals from each invoice"),
Input: v2.LegacyBatchInputConfig{
DatasourceId: "ds_9b7e1234",
Filters: &v2.LegacyBatchInputFilters{
MediaTypes: []string{"application/pdf"},
},
},
Output: &v2.LegacyBatchOutputConfig{
DatasourceId: v2.String("ds_output_4d2f0a"),
},
Execution: &v2.LegacyBatchExecutionParams{
Concurrency: v2.Int(5),
RetryLimit: v2.Int(3),
},
},
})
if err != nil {
fmt.Println("error creating batch execution:", err)
return
}
fmt.Printf("execution id: %s, status: %s\n", execution.Id, execution.Status)
}curl --request POST \
--url https://api.meibel.ai/v2/batch-executions \
--header 'Content-Type: application/json' \
--header 'Meibel-API-Key: <api-key>' \
--data '
{
"batch_spec_json": {
"name": "<string>",
"agent": "<string>",
"input": {
"datasource_id": "<string>",
"filters": {
"regex": "<string>",
"media_types": [
"<string>"
],
"element_ids": [
"<string>"
],
"additional_properties": {}
}
},
"version": "<string>",
"user_message": "<string>",
"output": {
"datasource_id": "<string>"
},
"execution": {
"concurrency": 10,
"retry_limit": 2
},
"additional_properties": {}
}
}
'const options = {
method: 'POST',
headers: {'Meibel-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
batch_spec_json: {
name: '<string>',
agent: '<string>',
input: {
datasource_id: '<string>',
filters: {
regex: '<string>',
media_types: ['<string>'],
element_ids: ['<string>'],
additional_properties: {}
}
},
version: '<string>',
user_message: '<string>',
output: {datasource_id: '<string>'},
execution: {concurrency: 10, retry_limit: 2},
additional_properties: {}
}
})
};
fetch('https://api.meibel.ai/v2/batch-executions', 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.meibel.ai/v2/batch-executions",
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([
'batch_spec_json' => [
'name' => '<string>',
'agent' => '<string>',
'input' => [
'datasource_id' => '<string>',
'filters' => [
'regex' => '<string>',
'media_types' => [
'<string>'
],
'element_ids' => [
'<string>'
],
'additional_properties' => [
]
]
],
'version' => '<string>',
'user_message' => '<string>',
'output' => [
'datasource_id' => '<string>'
],
'execution' => [
'concurrency' => 10,
'retry_limit' => 2
],
'additional_properties' => [
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"Meibel-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.post("https://api.meibel.ai/v2/batch-executions")
.header("Meibel-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"batch_spec_json\": {\n \"name\": \"<string>\",\n \"agent\": \"<string>\",\n \"input\": {\n \"datasource_id\": \"<string>\",\n \"filters\": {\n \"regex\": \"<string>\",\n \"media_types\": [\n \"<string>\"\n ],\n \"element_ids\": [\n \"<string>\"\n ],\n \"additional_properties\": {}\n }\n },\n \"version\": \"<string>\",\n \"user_message\": \"<string>\",\n \"output\": {\n \"datasource_id\": \"<string>\"\n },\n \"execution\": {\n \"concurrency\": 10,\n \"retry_limit\": 2\n },\n \"additional_properties\": {}\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.meibel.ai/v2/batch-executions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Meibel-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"batch_spec_json\": {\n \"name\": \"<string>\",\n \"agent\": \"<string>\",\n \"input\": {\n \"datasource_id\": \"<string>\",\n \"filters\": {\n \"regex\": \"<string>\",\n \"media_types\": [\n \"<string>\"\n ],\n \"element_ids\": [\n \"<string>\"\n ],\n \"additional_properties\": {}\n }\n },\n \"version\": \"<string>\",\n \"user_message\": \"<string>\",\n \"output\": {\n \"datasource_id\": \"<string>\"\n },\n \"execution\": {\n \"concurrency\": 10,\n \"retry_limit\": 2\n },\n \"additional_properties\": {}\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"batch_definition_id": "<string>",
"customer_id": "<string>",
"project_id": "<string>",
"start_time": "2023-11-07T05:31:56Z",
"status": "<string>",
"agent_urn": "<string>",
"batch_spec_json": {},
"agent_spec_json": {},
"input_datasource_id": "<string>",
"output_datasource_id": "<string>",
"input_overrides": {},
"total_items": 123,
"succeeded": 123,
"failed": 123,
"end_time": "2023-11-07T05:31:56Z",
"error": "<string>",
"items": [
{
"input_data_element_id": "<string>",
"filename": "<string>",
"status": "<string>",
"error": "<string>",
"output_artifacts": [
{}
],
"attempts": 1
}
]
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authorizations
Body
Legacy request body for POST /batch-execution/ (pre-DEL-1376 compat shim).
LegacyBatchSpecJson
Show child attributes
Show child attributes
Response
Successful Response
Response shape for a single batch execution. The legacy batch_spec_json / agent_spec_json / agent_urn / input_datasource_id fields are kept for client compatibility (DEL-1376 §5.5) — they are reconstructed from the linked BatchDefinition by the router, not stored on the execution row.
Execution ID — also the Temporal workflow ID for direct queries
FK to the BatchDefinition this execution ran against
Optional override for the tool's parameters schema
Optional override for the tool's parameters schema
Overall error message
Per-item results (populated on completion by status callback)
Show child attributes
Show child attributes
Was this page helpful?