Python
from meibel import MeibelClient
client = MeibelClient(api_key="your-api-key")
result = client.agents.sessions.create_by_name("name_value")
print(result)import { MeibelClient } from 'meibel';
const client = new MeibelClient({ apiKey: 'your-api-key' });
const result = await client.agents.sessions.createByName('name_value');
console.log(result);import v2 "github.com/meibel-ai/meibel-go/v2"
client := v2.NewClient(v2.WithAPIKey("your-api-key"))
ctx := context.Background()
result, err := client.Agents.Sessions.CreateByName(ctx, "name_value")
if err != nil {
log.Fatal(err)
}
fmt.Println(result)curl --request POST \
--url https://api.meibel.ai/v2/agents/name/{name}/sessions \
--header 'Content-Type: application/json' \
--header 'Meibel-API-Key: <api-key>' \
--data '
{
"prompt": "<string>",
"initial_context": {},
"max_iterations_per_user_message": 20,
"message_wait_timeout_seconds": 259200,
"execution_policy_ids": [
"pol_abc123",
"pol_def456"
],
"execution_policy": {
"datasources": {
"ds_abc123": {
"documents": {
"filter": {
"data_element.__id__": {
"$in": [
"de_abc",
"de_def"
]
}
}
},
"tables": {
"filter": {
"orders.region": {
"$eq": "EU"
},
"table.__name__": {
"$in": [
"orders",
"customers"
]
}
},
"hidden_columns": {
"customers": [
"ssn",
"credit_card"
]
}
}
},
"ds_xyz789": {
"disabled": true
}
},
"tools": {
"send_email": {
"variables": {
"max_attachments": {
"$lte": 3
},
"to": {
"$eq": "support@acme.com"
}
}
},
"web_search": {
"disabled": true
}
}
}
}
'const options = {
method: 'POST',
headers: {'Meibel-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
prompt: '<string>',
initial_context: {},
max_iterations_per_user_message: 20,
message_wait_timeout_seconds: 259200,
execution_policy_ids: ['pol_abc123', 'pol_def456'],
execution_policy: {
datasources: {
ds_abc123: {
documents: {filter: {'data_element.__id__': {$in: ['de_abc', 'de_def']}}},
tables: {
filter: {'orders.region': {$eq: 'EU'}, 'table.__name__': {$in: ['orders', 'customers']}},
hidden_columns: {customers: ['ssn', 'credit_card']}
}
},
ds_xyz789: {disabled: true}
},
tools: {
send_email: {variables: {max_attachments: {$lte: 3}, to: {$eq: 'support@acme.com'}}},
web_search: {disabled: true}
}
}
})
};
fetch('https://api.meibel.ai/v2/agents/name/{name}/sessions', 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/agents/name/{name}/sessions",
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([
'prompt' => '<string>',
'initial_context' => [
],
'max_iterations_per_user_message' => 20,
'message_wait_timeout_seconds' => 259200,
'execution_policy_ids' => [
'pol_abc123',
'pol_def456'
],
'execution_policy' => [
'datasources' => [
'ds_abc123' => [
'documents' => [
'filter' => [
'data_element.__id__' => [
'$in' => [
'de_abc',
'de_def'
]
]
]
],
'tables' => [
'filter' => [
'orders.region' => [
'$eq' => 'EU'
],
'table.__name__' => [
'$in' => [
'orders',
'customers'
]
]
],
'hidden_columns' => [
'customers' => [
'ssn',
'credit_card'
]
]
]
],
'ds_xyz789' => [
'disabled' => true
]
],
'tools' => [
'send_email' => [
'variables' => [
'max_attachments' => [
'$lte' => 3
],
'to' => [
'$eq' => 'support@acme.com'
]
]
],
'web_search' => [
'disabled' => true
]
]
]
]),
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/agents/name/{name}/sessions")
.header("Meibel-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"<string>\",\n \"initial_context\": {},\n \"max_iterations_per_user_message\": 20,\n \"message_wait_timeout_seconds\": 259200,\n \"execution_policy_ids\": [\n \"pol_abc123\",\n \"pol_def456\"\n ],\n \"execution_policy\": {\n \"datasources\": {\n \"ds_abc123\": {\n \"documents\": {\n \"filter\": {\n \"data_element.__id__\": {\n \"$in\": [\n \"de_abc\",\n \"de_def\"\n ]\n }\n }\n },\n \"tables\": {\n \"filter\": {\n \"orders.region\": {\n \"$eq\": \"EU\"\n },\n \"table.__name__\": {\n \"$in\": [\n \"orders\",\n \"customers\"\n ]\n }\n },\n \"hidden_columns\": {\n \"customers\": [\n \"ssn\",\n \"credit_card\"\n ]\n }\n }\n },\n \"ds_xyz789\": {\n \"disabled\": true\n }\n },\n \"tools\": {\n \"send_email\": {\n \"variables\": {\n \"max_attachments\": {\n \"$lte\": 3\n },\n \"to\": {\n \"$eq\": \"support@acme.com\"\n }\n }\n },\n \"web_search\": {\n \"disabled\": true\n }\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.meibel.ai/v2/agents/name/{name}/sessions")
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 \"prompt\": \"<string>\",\n \"initial_context\": {},\n \"max_iterations_per_user_message\": 20,\n \"message_wait_timeout_seconds\": 259200,\n \"execution_policy_ids\": [\n \"pol_abc123\",\n \"pol_def456\"\n ],\n \"execution_policy\": {\n \"datasources\": {\n \"ds_abc123\": {\n \"documents\": {\n \"filter\": {\n \"data_element.__id__\": {\n \"$in\": [\n \"de_abc\",\n \"de_def\"\n ]\n }\n }\n },\n \"tables\": {\n \"filter\": {\n \"orders.region\": {\n \"$eq\": \"EU\"\n },\n \"table.__name__\": {\n \"$in\": [\n \"orders\",\n \"customers\"\n ]\n }\n },\n \"hidden_columns\": {\n \"customers\": [\n \"ssn\",\n \"credit_card\"\n ]\n }\n }\n },\n \"ds_xyz789\": {\n \"disabled\": true\n }\n },\n \"tools\": {\n \"send_email\": {\n \"variables\": {\n \"max_attachments\": {\n \"$lte\": 3\n },\n \"to\": {\n \"$eq\": \"support@acme.com\"\n }\n }\n },\n \"web_search\": {\n \"disabled\": true\n }\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"session_id": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Sessions
Create Session By Name
Start a session against the latest published version of an agent by name.
Resolves the current latest published version at runtime — callers do not need to track a specific agent ID or version. Returns 404 if no published version exists for the given agent name.
POST
/
agents
/
name
/
{name}
/
sessions
Python
from meibel import MeibelClient
client = MeibelClient(api_key="your-api-key")
result = client.agents.sessions.create_by_name("name_value")
print(result)import { MeibelClient } from 'meibel';
const client = new MeibelClient({ apiKey: 'your-api-key' });
const result = await client.agents.sessions.createByName('name_value');
console.log(result);import v2 "github.com/meibel-ai/meibel-go/v2"
client := v2.NewClient(v2.WithAPIKey("your-api-key"))
ctx := context.Background()
result, err := client.Agents.Sessions.CreateByName(ctx, "name_value")
if err != nil {
log.Fatal(err)
}
fmt.Println(result)curl --request POST \
--url https://api.meibel.ai/v2/agents/name/{name}/sessions \
--header 'Content-Type: application/json' \
--header 'Meibel-API-Key: <api-key>' \
--data '
{
"prompt": "<string>",
"initial_context": {},
"max_iterations_per_user_message": 20,
"message_wait_timeout_seconds": 259200,
"execution_policy_ids": [
"pol_abc123",
"pol_def456"
],
"execution_policy": {
"datasources": {
"ds_abc123": {
"documents": {
"filter": {
"data_element.__id__": {
"$in": [
"de_abc",
"de_def"
]
}
}
},
"tables": {
"filter": {
"orders.region": {
"$eq": "EU"
},
"table.__name__": {
"$in": [
"orders",
"customers"
]
}
},
"hidden_columns": {
"customers": [
"ssn",
"credit_card"
]
}
}
},
"ds_xyz789": {
"disabled": true
}
},
"tools": {
"send_email": {
"variables": {
"max_attachments": {
"$lte": 3
},
"to": {
"$eq": "support@acme.com"
}
}
},
"web_search": {
"disabled": true
}
}
}
}
'const options = {
method: 'POST',
headers: {'Meibel-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
prompt: '<string>',
initial_context: {},
max_iterations_per_user_message: 20,
message_wait_timeout_seconds: 259200,
execution_policy_ids: ['pol_abc123', 'pol_def456'],
execution_policy: {
datasources: {
ds_abc123: {
documents: {filter: {'data_element.__id__': {$in: ['de_abc', 'de_def']}}},
tables: {
filter: {'orders.region': {$eq: 'EU'}, 'table.__name__': {$in: ['orders', 'customers']}},
hidden_columns: {customers: ['ssn', 'credit_card']}
}
},
ds_xyz789: {disabled: true}
},
tools: {
send_email: {variables: {max_attachments: {$lte: 3}, to: {$eq: 'support@acme.com'}}},
web_search: {disabled: true}
}
}
})
};
fetch('https://api.meibel.ai/v2/agents/name/{name}/sessions', 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/agents/name/{name}/sessions",
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([
'prompt' => '<string>',
'initial_context' => [
],
'max_iterations_per_user_message' => 20,
'message_wait_timeout_seconds' => 259200,
'execution_policy_ids' => [
'pol_abc123',
'pol_def456'
],
'execution_policy' => [
'datasources' => [
'ds_abc123' => [
'documents' => [
'filter' => [
'data_element.__id__' => [
'$in' => [
'de_abc',
'de_def'
]
]
]
],
'tables' => [
'filter' => [
'orders.region' => [
'$eq' => 'EU'
],
'table.__name__' => [
'$in' => [
'orders',
'customers'
]
]
],
'hidden_columns' => [
'customers' => [
'ssn',
'credit_card'
]
]
]
],
'ds_xyz789' => [
'disabled' => true
]
],
'tools' => [
'send_email' => [
'variables' => [
'max_attachments' => [
'$lte' => 3
],
'to' => [
'$eq' => 'support@acme.com'
]
]
],
'web_search' => [
'disabled' => true
]
]
]
]),
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/agents/name/{name}/sessions")
.header("Meibel-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"<string>\",\n \"initial_context\": {},\n \"max_iterations_per_user_message\": 20,\n \"message_wait_timeout_seconds\": 259200,\n \"execution_policy_ids\": [\n \"pol_abc123\",\n \"pol_def456\"\n ],\n \"execution_policy\": {\n \"datasources\": {\n \"ds_abc123\": {\n \"documents\": {\n \"filter\": {\n \"data_element.__id__\": {\n \"$in\": [\n \"de_abc\",\n \"de_def\"\n ]\n }\n }\n },\n \"tables\": {\n \"filter\": {\n \"orders.region\": {\n \"$eq\": \"EU\"\n },\n \"table.__name__\": {\n \"$in\": [\n \"orders\",\n \"customers\"\n ]\n }\n },\n \"hidden_columns\": {\n \"customers\": [\n \"ssn\",\n \"credit_card\"\n ]\n }\n }\n },\n \"ds_xyz789\": {\n \"disabled\": true\n }\n },\n \"tools\": {\n \"send_email\": {\n \"variables\": {\n \"max_attachments\": {\n \"$lte\": 3\n },\n \"to\": {\n \"$eq\": \"support@acme.com\"\n }\n }\n },\n \"web_search\": {\n \"disabled\": true\n }\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.meibel.ai/v2/agents/name/{name}/sessions")
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 \"prompt\": \"<string>\",\n \"initial_context\": {},\n \"max_iterations_per_user_message\": 20,\n \"message_wait_timeout_seconds\": 259200,\n \"execution_policy_ids\": [\n \"pol_abc123\",\n \"pol_def456\"\n ],\n \"execution_policy\": {\n \"datasources\": {\n \"ds_abc123\": {\n \"documents\": {\n \"filter\": {\n \"data_element.__id__\": {\n \"$in\": [\n \"de_abc\",\n \"de_def\"\n ]\n }\n }\n },\n \"tables\": {\n \"filter\": {\n \"orders.region\": {\n \"$eq\": \"EU\"\n },\n \"table.__name__\": {\n \"$in\": [\n \"orders\",\n \"customers\"\n ]\n }\n },\n \"hidden_columns\": {\n \"customers\": [\n \"ssn\",\n \"credit_card\"\n ]\n }\n }\n },\n \"ds_xyz789\": {\n \"disabled\": true\n }\n },\n \"tools\": {\n \"send_email\": {\n \"variables\": {\n \"max_attachments\": {\n \"$lte\": 3\n },\n \"to\": {\n \"$eq\": \"support@acme.com\"\n }\n }\n },\n \"web_search\": {\n \"disabled\": true\n }\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"session_id": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authorizations
Path Parameters
Body
application/json
IDs of stored ExecutionPolicies to compose into this session.
Example:
["pol_abc123", "pol_def456"]
Inline session-level access constraints (hardrails). Controls which datasources and tools the agent can use, and what data is accessible within each. Composed with any stored policies referenced by execution_policy_ids.
Show child attributes
Show child attributes
Example:
{
"datasources": {
"ds_abc123": {
"documents": {
"filter": {
"data_element.__id__": { "$in": ["de_abc", "de_def"] }
}
},
"tables": {
"filter": {
"orders.region": { "$eq": "EU" },
"table.__name__": { "$in": ["orders", "customers"] }
},
"hidden_columns": { "customers": ["ssn", "credit_card"] }
}
},
"ds_xyz789": { "disabled": true }
},
"tools": {
"send_email": {
"variables": {
"max_attachments": { "$lte": 3 },
"to": { "$eq": "support@acme.com" }
}
},
"web_search": { "disabled": true }
}
}
Response
Successful Response
Was this page helpful?
⌘I