Python
import os
from meibel import MeibelClient
from meibel.models import CreateBatchDefinitionRequest, BatchDefinitionFilters
client = MeibelClient(api_key=os.environ["MEIBEL_API_KEY"])
batch_definition = client.batches.create(
CreateBatchDefinitionRequest(
name="invoice-extraction-batch",
agent_id="agent_8f3a1c",
input_datasource_id="ds_input_7b2c9d",
output_datasource_id="ds_output_4e1f0a",
filters=BatchDefinitionFilters(
regex=r".*\.pdf$",
media_types=["application/pdf"],
),
user_message="Extract line items and totals from each invoice.",
concurrency=5,
retry_limit=3,
recurrence_cron="0 2 * * *",
description="Nightly batch extraction of vendor invoices.",
)
)
print(f"Created batch definition {batch_definition.id} v{batch_definition.version}")import { MeibelClient } from "meibel";
const client = new MeibelClient({ apiKey: process.env.MEIBEL_API_KEY });
const batchDefinition = await client.batches.create({
name: "invoice-extraction-batch",
agent_id: "agent_7f3a9c2b",
input_datasource_id: "ds_invoices_raw",
output_datasource_id: "ds_invoices_processed",
description: "Extracts structured fields from monthly invoice PDFs",
user_message: "Extract vendor, total, and due date from each invoice.",
concurrency: 5,
retry_limit: 3,
recurrence_cron: "0 2 * * 1",
filters: {
regex: "^invoice-.*\\.pdf$",
media_types: ["application/pdf"],
},
execution_policy: {
datasources: {
ds_invoices_raw: {
documents: {
filter: { "data_element.__name__": { $in: ["invoice-2024-01.pdf"] } },
},
},
},
tools: {
web_search: {
disabled: true,
},
},
},
});
console.log(`Created batch definition ${batchDefinition.id} (v${batchDefinition.version})`);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")))
batch, err := client.Batches.Create(context.Background(), v2.CreateBatchDefinitionRequest{
Name: "invoice-extraction-batch",
AgentID: "agent_abc123",
InputDatasourceID: "ds_invoices_raw",
Filters: &v2.BatchDefinitionFilters{
MediaTypes: []string{"application/pdf"},
},
OutputDatasourceID: v2.String("ds_invoices_processed"),
UserMessage: v2.String("Extract line items and totals from each invoice"),
Concurrency: v2.Int(5),
RetryLimit: v2.Int(3),
Description: v2.String("Nightly batch extraction of invoice data"),
})
if err != nil {
fmt.Println("error creating batch definition:", err)
return
}
fmt.Printf("created batch definition %s (version %s)\n", batch.ID, batch.Version)
}curl --request POST \
--url https://api.meibel.ai/v2/batch-definitions \
--header 'Content-Type: application/json' \
--header 'Meibel-API-Key: <api-key>' \
--data '
{
"name": "<string>",
"agent_id": "<string>",
"input_datasource_id": "<string>",
"filters": {
"regex": "<string>",
"media_types": [
"<string>"
],
"element_ids": [
"<string>"
]
},
"output_datasource_id": "<string>",
"user_message": "<string>",
"concurrency": 10,
"retry_limit": 2,
"recurrence_cron": "<string>",
"description": "<string>",
"execution_policy": {
"datasources": {},
"tools": {}
},
"execution_policy_ids": [
"<string>"
]
}
'const options = {
method: 'POST',
headers: {'Meibel-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
agent_id: '<string>',
input_datasource_id: '<string>',
filters: {regex: '<string>', media_types: ['<string>'], element_ids: ['<string>']},
output_datasource_id: '<string>',
user_message: '<string>',
concurrency: 10,
retry_limit: 2,
recurrence_cron: '<string>',
description: '<string>',
execution_policy: {datasources: {}, tools: {}},
execution_policy_ids: ['<string>']
})
};
fetch('https://api.meibel.ai/v2/batch-definitions', 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-definitions",
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([
'name' => '<string>',
'agent_id' => '<string>',
'input_datasource_id' => '<string>',
'filters' => [
'regex' => '<string>',
'media_types' => [
'<string>'
],
'element_ids' => [
'<string>'
]
],
'output_datasource_id' => '<string>',
'user_message' => '<string>',
'concurrency' => 10,
'retry_limit' => 2,
'recurrence_cron' => '<string>',
'description' => '<string>',
'execution_policy' => [
'datasources' => [
],
'tools' => [
]
],
'execution_policy_ids' => [
'<string>'
]
]),
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-definitions")
.header("Meibel-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"agent_id\": \"<string>\",\n \"input_datasource_id\": \"<string>\",\n \"filters\": {\n \"regex\": \"<string>\",\n \"media_types\": [\n \"<string>\"\n ],\n \"element_ids\": [\n \"<string>\"\n ]\n },\n \"output_datasource_id\": \"<string>\",\n \"user_message\": \"<string>\",\n \"concurrency\": 10,\n \"retry_limit\": 2,\n \"recurrence_cron\": \"<string>\",\n \"description\": \"<string>\",\n \"execution_policy\": {\n \"datasources\": {},\n \"tools\": {}\n },\n \"execution_policy_ids\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.meibel.ai/v2/batch-definitions")
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 \"name\": \"<string>\",\n \"agent_id\": \"<string>\",\n \"input_datasource_id\": \"<string>\",\n \"filters\": {\n \"regex\": \"<string>\",\n \"media_types\": [\n \"<string>\"\n ],\n \"element_ids\": [\n \"<string>\"\n ]\n },\n \"output_datasource_id\": \"<string>\",\n \"user_message\": \"<string>\",\n \"concurrency\": 10,\n \"retry_limit\": 2,\n \"recurrence_cron\": \"<string>\",\n \"description\": \"<string>\",\n \"execution_policy\": {\n \"datasources\": {},\n \"tools\": {}\n },\n \"execution_policy_ids\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"catalog_urn": "<string>",
"name": "<string>",
"version": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Batches
Create Batch Definition
POST
/
batch-definitions
Python
import os
from meibel import MeibelClient
from meibel.models import CreateBatchDefinitionRequest, BatchDefinitionFilters
client = MeibelClient(api_key=os.environ["MEIBEL_API_KEY"])
batch_definition = client.batches.create(
CreateBatchDefinitionRequest(
name="invoice-extraction-batch",
agent_id="agent_8f3a1c",
input_datasource_id="ds_input_7b2c9d",
output_datasource_id="ds_output_4e1f0a",
filters=BatchDefinitionFilters(
regex=r".*\.pdf$",
media_types=["application/pdf"],
),
user_message="Extract line items and totals from each invoice.",
concurrency=5,
retry_limit=3,
recurrence_cron="0 2 * * *",
description="Nightly batch extraction of vendor invoices.",
)
)
print(f"Created batch definition {batch_definition.id} v{batch_definition.version}")import { MeibelClient } from "meibel";
const client = new MeibelClient({ apiKey: process.env.MEIBEL_API_KEY });
const batchDefinition = await client.batches.create({
name: "invoice-extraction-batch",
agent_id: "agent_7f3a9c2b",
input_datasource_id: "ds_invoices_raw",
output_datasource_id: "ds_invoices_processed",
description: "Extracts structured fields from monthly invoice PDFs",
user_message: "Extract vendor, total, and due date from each invoice.",
concurrency: 5,
retry_limit: 3,
recurrence_cron: "0 2 * * 1",
filters: {
regex: "^invoice-.*\\.pdf$",
media_types: ["application/pdf"],
},
execution_policy: {
datasources: {
ds_invoices_raw: {
documents: {
filter: { "data_element.__name__": { $in: ["invoice-2024-01.pdf"] } },
},
},
},
tools: {
web_search: {
disabled: true,
},
},
},
});
console.log(`Created batch definition ${batchDefinition.id} (v${batchDefinition.version})`);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")))
batch, err := client.Batches.Create(context.Background(), v2.CreateBatchDefinitionRequest{
Name: "invoice-extraction-batch",
AgentID: "agent_abc123",
InputDatasourceID: "ds_invoices_raw",
Filters: &v2.BatchDefinitionFilters{
MediaTypes: []string{"application/pdf"},
},
OutputDatasourceID: v2.String("ds_invoices_processed"),
UserMessage: v2.String("Extract line items and totals from each invoice"),
Concurrency: v2.Int(5),
RetryLimit: v2.Int(3),
Description: v2.String("Nightly batch extraction of invoice data"),
})
if err != nil {
fmt.Println("error creating batch definition:", err)
return
}
fmt.Printf("created batch definition %s (version %s)\n", batch.ID, batch.Version)
}curl --request POST \
--url https://api.meibel.ai/v2/batch-definitions \
--header 'Content-Type: application/json' \
--header 'Meibel-API-Key: <api-key>' \
--data '
{
"name": "<string>",
"agent_id": "<string>",
"input_datasource_id": "<string>",
"filters": {
"regex": "<string>",
"media_types": [
"<string>"
],
"element_ids": [
"<string>"
]
},
"output_datasource_id": "<string>",
"user_message": "<string>",
"concurrency": 10,
"retry_limit": 2,
"recurrence_cron": "<string>",
"description": "<string>",
"execution_policy": {
"datasources": {},
"tools": {}
},
"execution_policy_ids": [
"<string>"
]
}
'const options = {
method: 'POST',
headers: {'Meibel-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
agent_id: '<string>',
input_datasource_id: '<string>',
filters: {regex: '<string>', media_types: ['<string>'], element_ids: ['<string>']},
output_datasource_id: '<string>',
user_message: '<string>',
concurrency: 10,
retry_limit: 2,
recurrence_cron: '<string>',
description: '<string>',
execution_policy: {datasources: {}, tools: {}},
execution_policy_ids: ['<string>']
})
};
fetch('https://api.meibel.ai/v2/batch-definitions', 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-definitions",
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([
'name' => '<string>',
'agent_id' => '<string>',
'input_datasource_id' => '<string>',
'filters' => [
'regex' => '<string>',
'media_types' => [
'<string>'
],
'element_ids' => [
'<string>'
]
],
'output_datasource_id' => '<string>',
'user_message' => '<string>',
'concurrency' => 10,
'retry_limit' => 2,
'recurrence_cron' => '<string>',
'description' => '<string>',
'execution_policy' => [
'datasources' => [
],
'tools' => [
]
],
'execution_policy_ids' => [
'<string>'
]
]),
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-definitions")
.header("Meibel-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"agent_id\": \"<string>\",\n \"input_datasource_id\": \"<string>\",\n \"filters\": {\n \"regex\": \"<string>\",\n \"media_types\": [\n \"<string>\"\n ],\n \"element_ids\": [\n \"<string>\"\n ]\n },\n \"output_datasource_id\": \"<string>\",\n \"user_message\": \"<string>\",\n \"concurrency\": 10,\n \"retry_limit\": 2,\n \"recurrence_cron\": \"<string>\",\n \"description\": \"<string>\",\n \"execution_policy\": {\n \"datasources\": {},\n \"tools\": {}\n },\n \"execution_policy_ids\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.meibel.ai/v2/batch-definitions")
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 \"name\": \"<string>\",\n \"agent_id\": \"<string>\",\n \"input_datasource_id\": \"<string>\",\n \"filters\": {\n \"regex\": \"<string>\",\n \"media_types\": [\n \"<string>\"\n ],\n \"element_ids\": [\n \"<string>\"\n ]\n },\n \"output_datasource_id\": \"<string>\",\n \"user_message\": \"<string>\",\n \"concurrency\": 10,\n \"retry_limit\": 2,\n \"recurrence_cron\": \"<string>\",\n \"description\": \"<string>\",\n \"execution_policy\": {\n \"datasources\": {},\n \"tools\": {}\n },\n \"execution_policy_ids\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"catalog_urn": "<string>",
"name": "<string>",
"version": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authorizations
Body
application/json
Create a new BatchDefinition lineage.
Kebab-case label (non-unique within tenant)
AgentDefinition ID; resolved + pinned at creation time
Datasource holding the input Data Elements
Recipe-level filters. element_ids belongs here; per-execution overrides use BatchInputOverrides on the execution row.
Show child attributes
Show child attributes
Pinned output sink. NULL = workflow auto-creates per execution.
Required range:
1 <= x <= 999Required range:
0 <= x <= 999Cron expression validated by croniter; not yet scheduled in DEL-1376.
Inline execution policy constraints (datasources, tools)
Show child attributes
Show child attributes
IDs of stored ExecutionPolicies to compose
Was this page helpful?
⌘I