Python
import os
from meibel import MeibelClient
from meibel.models import (
CreateExecutionPolicyRequest,
ExecutionPolicy,
DatasourceView,
TagConstraints,
ToolConfig,
)
client = MeibelClient(api_key=os.environ["MEIBEL_API_KEY"])
execution_policy = ExecutionPolicy(
datasources={
"ds_customer_db": DatasourceView(
tables=TagConstraints(
filter={"region": "us-east"},
hidden_columns={"customers": ["ssn", "credit_card"]},
hidden_tables=["internal_audit_log"],
),
),
},
tools={
"send_email": ToolConfig(
variables={"recipient_domain": {"$in": ["acme.com", "acme.io"]}},
),
},
)
policy = client.execution_policies.create(
CreateExecutionPolicyRequest(
name="us-east-support-agent-policy",
description="Restricts support agents to US-East customer data and approved email domains",
execution_policy=execution_policy,
)
)
print(f"Created policy: {policy.id} ({policy.name})")import { MeibelClient } from "meibel";
const client = new MeibelClient({ apiKey: process.env.MEIBEL_API_KEY });
const executionPolicy = await client.executionPolicies.create({
name: "customer-support-readonly",
description: "Restricts support agents to redacted customer records and read-only tools",
execution_policy: {
datasources: {
ds_customer_db_001: {
disabled: false,
tables: {
filter: { region: { $in: ["us-east", "us-west"] } },
hidden_columns: {
customers: ["ssn", "credit_card_number"],
},
hidden_tables: ["billing_internal"],
},
documents: {
filter: { document_type: { $eq: "public_faq" } },
},
},
},
tools: {
refund_processor: {
disabled: true,
},
order_lookup: {
variables: {
max_results: { $lte: 50 },
},
},
},
},
});
console.log(`Created policy ${executionPolicy.id}: ${executionPolicy.name}`);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")))
policy, err := client.ExecutionPolicies.Create(context.Background(), v2.CreateExecutionPolicyRequest{
Name: "customer-support-readonly",
Description: v2.String("Restricts support agents to redacted customer records"),
ExecutionPolicy: v2.ExecutionPolicy{
Datasources: map[string]v2.DatasourceView{
"ds_crm_prod": {
Tables: &v2.TagConstraints{
Filter: map[string]any{
"region": map[string]any{"$eq": "us-east"},
},
HiddenColumns: map[string][]string{
"customers": {"ssn", "credit_card_number"},
},
},
Documents: &v2.RagConstraints{
Filter: map[string]any{
"document_type": map[string]any{"$eq": "public"},
},
},
},
},
Tools: map[string]v2.ToolConfig{
"refund_customer": {
Disabled: v2.Bool(true),
},
},
},
})
if err != nil {
panic(err)
}
fmt.Printf("Created execution policy %s (%s)\n", policy.ID, policy.Name)
}curl --request POST \
--url https://api.meibel.ai/v2/execution-policies \
--header 'Content-Type: application/json' \
--header 'Meibel-API-Key: <api-key>' \
--data '
{
"name": "eu-restricted-read-only",
"description": "Restrict session to EU data, hide PII columns",
"execution_policy": {
"datasources": {
"ds_abc123": {
"tables": {
"filter": {
"table.__name__": {
"$in": [
"orders",
"customers"
]
},
"orders.region": {
"$eq": "EU"
}
},
"hidden_columns": {
"customers": [
"ssn",
"credit_card"
]
}
},
"documents": {
"filter": {
"data_element.__id__": {
"$in": [
"de_abc",
"de_def"
]
}
}
}
},
"ds_xyz789": {
"disabled": true
}
},
"tools": {
"send_email": {
"variables": {
"to": {
"$eq": "support@acme.com"
},
"max_attachments": {
"$lte": 3
}
}
},
"web_search": {
"disabled": true
}
}
}
}
'const options = {
method: 'POST',
headers: {'Meibel-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'eu-restricted-read-only',
description: 'Restrict session to EU data, hide PII columns',
execution_policy: {
datasources: {
ds_abc123: {
tables: {
filter: {'table.__name__': {$in: ['orders', 'customers']}, 'orders.region': {$eq: 'EU'}},
hidden_columns: {customers: ['ssn', 'credit_card']}
},
documents: {filter: {'data_element.__id__': {$in: ['de_abc', 'de_def']}}}
},
ds_xyz789: {disabled: true}
},
tools: {
send_email: {variables: {to: {$eq: 'support@acme.com'}, max_attachments: {$lte: 3}}},
web_search: {disabled: true}
}
}
})
};
fetch('https://api.meibel.ai/v2/execution-policies', 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/execution-policies",
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' => 'eu-restricted-read-only',
'description' => 'Restrict session to EU data, hide PII columns',
'execution_policy' => [
'datasources' => [
'ds_abc123' => [
'tables' => [
'filter' => [
'table.__name__' => [
'$in' => [
'orders',
'customers'
]
],
'orders.region' => [
'$eq' => 'EU'
]
],
'hidden_columns' => [
'customers' => [
'ssn',
'credit_card'
]
]
],
'documents' => [
'filter' => [
'data_element.__id__' => [
'$in' => [
'de_abc',
'de_def'
]
]
]
]
],
'ds_xyz789' => [
'disabled' => true
]
],
'tools' => [
'send_email' => [
'variables' => [
'to' => [
'$eq' => 'support@acme.com'
],
'max_attachments' => [
'$lte' => 3
]
]
],
'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/execution-policies")
.header("Meibel-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"eu-restricted-read-only\",\n \"description\": \"Restrict session to EU data, hide PII columns\",\n \"execution_policy\": {\n \"datasources\": {\n \"ds_abc123\": {\n \"tables\": {\n \"filter\": {\n \"table.__name__\": {\n \"$in\": [\n \"orders\",\n \"customers\"\n ]\n },\n \"orders.region\": {\n \"$eq\": \"EU\"\n }\n },\n \"hidden_columns\": {\n \"customers\": [\n \"ssn\",\n \"credit_card\"\n ]\n }\n },\n \"documents\": {\n \"filter\": {\n \"data_element.__id__\": {\n \"$in\": [\n \"de_abc\",\n \"de_def\"\n ]\n }\n }\n }\n },\n \"ds_xyz789\": {\n \"disabled\": true\n }\n },\n \"tools\": {\n \"send_email\": {\n \"variables\": {\n \"to\": {\n \"$eq\": \"support@acme.com\"\n },\n \"max_attachments\": {\n \"$lte\": 3\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/execution-policies")
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\": \"eu-restricted-read-only\",\n \"description\": \"Restrict session to EU data, hide PII columns\",\n \"execution_policy\": {\n \"datasources\": {\n \"ds_abc123\": {\n \"tables\": {\n \"filter\": {\n \"table.__name__\": {\n \"$in\": [\n \"orders\",\n \"customers\"\n ]\n },\n \"orders.region\": {\n \"$eq\": \"EU\"\n }\n },\n \"hidden_columns\": {\n \"customers\": [\n \"ssn\",\n \"credit_card\"\n ]\n }\n },\n \"documents\": {\n \"filter\": {\n \"data_element.__id__\": {\n \"$in\": [\n \"de_abc\",\n \"de_def\"\n ]\n }\n }\n }\n },\n \"ds_xyz789\": {\n \"disabled\": true\n }\n },\n \"tools\": {\n \"send_email\": {\n \"variables\": {\n \"to\": {\n \"$eq\": \"support@acme.com\"\n },\n \"max_attachments\": {\n \"$lte\": 3\n }\n }\n },\n \"web_search\": {\n \"disabled\": true\n }\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"customer_id": "<string>",
"project_id": "<string>",
"name": "<string>",
"execution_policy": {
"datasources": {},
"tools": {}
},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"description": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Execution policies
Create Execution Policy
POST
/
execution-policies
Python
import os
from meibel import MeibelClient
from meibel.models import (
CreateExecutionPolicyRequest,
ExecutionPolicy,
DatasourceView,
TagConstraints,
ToolConfig,
)
client = MeibelClient(api_key=os.environ["MEIBEL_API_KEY"])
execution_policy = ExecutionPolicy(
datasources={
"ds_customer_db": DatasourceView(
tables=TagConstraints(
filter={"region": "us-east"},
hidden_columns={"customers": ["ssn", "credit_card"]},
hidden_tables=["internal_audit_log"],
),
),
},
tools={
"send_email": ToolConfig(
variables={"recipient_domain": {"$in": ["acme.com", "acme.io"]}},
),
},
)
policy = client.execution_policies.create(
CreateExecutionPolicyRequest(
name="us-east-support-agent-policy",
description="Restricts support agents to US-East customer data and approved email domains",
execution_policy=execution_policy,
)
)
print(f"Created policy: {policy.id} ({policy.name})")import { MeibelClient } from "meibel";
const client = new MeibelClient({ apiKey: process.env.MEIBEL_API_KEY });
const executionPolicy = await client.executionPolicies.create({
name: "customer-support-readonly",
description: "Restricts support agents to redacted customer records and read-only tools",
execution_policy: {
datasources: {
ds_customer_db_001: {
disabled: false,
tables: {
filter: { region: { $in: ["us-east", "us-west"] } },
hidden_columns: {
customers: ["ssn", "credit_card_number"],
},
hidden_tables: ["billing_internal"],
},
documents: {
filter: { document_type: { $eq: "public_faq" } },
},
},
},
tools: {
refund_processor: {
disabled: true,
},
order_lookup: {
variables: {
max_results: { $lte: 50 },
},
},
},
},
});
console.log(`Created policy ${executionPolicy.id}: ${executionPolicy.name}`);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")))
policy, err := client.ExecutionPolicies.Create(context.Background(), v2.CreateExecutionPolicyRequest{
Name: "customer-support-readonly",
Description: v2.String("Restricts support agents to redacted customer records"),
ExecutionPolicy: v2.ExecutionPolicy{
Datasources: map[string]v2.DatasourceView{
"ds_crm_prod": {
Tables: &v2.TagConstraints{
Filter: map[string]any{
"region": map[string]any{"$eq": "us-east"},
},
HiddenColumns: map[string][]string{
"customers": {"ssn", "credit_card_number"},
},
},
Documents: &v2.RagConstraints{
Filter: map[string]any{
"document_type": map[string]any{"$eq": "public"},
},
},
},
},
Tools: map[string]v2.ToolConfig{
"refund_customer": {
Disabled: v2.Bool(true),
},
},
},
})
if err != nil {
panic(err)
}
fmt.Printf("Created execution policy %s (%s)\n", policy.ID, policy.Name)
}curl --request POST \
--url https://api.meibel.ai/v2/execution-policies \
--header 'Content-Type: application/json' \
--header 'Meibel-API-Key: <api-key>' \
--data '
{
"name": "eu-restricted-read-only",
"description": "Restrict session to EU data, hide PII columns",
"execution_policy": {
"datasources": {
"ds_abc123": {
"tables": {
"filter": {
"table.__name__": {
"$in": [
"orders",
"customers"
]
},
"orders.region": {
"$eq": "EU"
}
},
"hidden_columns": {
"customers": [
"ssn",
"credit_card"
]
}
},
"documents": {
"filter": {
"data_element.__id__": {
"$in": [
"de_abc",
"de_def"
]
}
}
}
},
"ds_xyz789": {
"disabled": true
}
},
"tools": {
"send_email": {
"variables": {
"to": {
"$eq": "support@acme.com"
},
"max_attachments": {
"$lte": 3
}
}
},
"web_search": {
"disabled": true
}
}
}
}
'const options = {
method: 'POST',
headers: {'Meibel-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'eu-restricted-read-only',
description: 'Restrict session to EU data, hide PII columns',
execution_policy: {
datasources: {
ds_abc123: {
tables: {
filter: {'table.__name__': {$in: ['orders', 'customers']}, 'orders.region': {$eq: 'EU'}},
hidden_columns: {customers: ['ssn', 'credit_card']}
},
documents: {filter: {'data_element.__id__': {$in: ['de_abc', 'de_def']}}}
},
ds_xyz789: {disabled: true}
},
tools: {
send_email: {variables: {to: {$eq: 'support@acme.com'}, max_attachments: {$lte: 3}}},
web_search: {disabled: true}
}
}
})
};
fetch('https://api.meibel.ai/v2/execution-policies', 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/execution-policies",
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' => 'eu-restricted-read-only',
'description' => 'Restrict session to EU data, hide PII columns',
'execution_policy' => [
'datasources' => [
'ds_abc123' => [
'tables' => [
'filter' => [
'table.__name__' => [
'$in' => [
'orders',
'customers'
]
],
'orders.region' => [
'$eq' => 'EU'
]
],
'hidden_columns' => [
'customers' => [
'ssn',
'credit_card'
]
]
],
'documents' => [
'filter' => [
'data_element.__id__' => [
'$in' => [
'de_abc',
'de_def'
]
]
]
]
],
'ds_xyz789' => [
'disabled' => true
]
],
'tools' => [
'send_email' => [
'variables' => [
'to' => [
'$eq' => 'support@acme.com'
],
'max_attachments' => [
'$lte' => 3
]
]
],
'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/execution-policies")
.header("Meibel-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"eu-restricted-read-only\",\n \"description\": \"Restrict session to EU data, hide PII columns\",\n \"execution_policy\": {\n \"datasources\": {\n \"ds_abc123\": {\n \"tables\": {\n \"filter\": {\n \"table.__name__\": {\n \"$in\": [\n \"orders\",\n \"customers\"\n ]\n },\n \"orders.region\": {\n \"$eq\": \"EU\"\n }\n },\n \"hidden_columns\": {\n \"customers\": [\n \"ssn\",\n \"credit_card\"\n ]\n }\n },\n \"documents\": {\n \"filter\": {\n \"data_element.__id__\": {\n \"$in\": [\n \"de_abc\",\n \"de_def\"\n ]\n }\n }\n }\n },\n \"ds_xyz789\": {\n \"disabled\": true\n }\n },\n \"tools\": {\n \"send_email\": {\n \"variables\": {\n \"to\": {\n \"$eq\": \"support@acme.com\"\n },\n \"max_attachments\": {\n \"$lte\": 3\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/execution-policies")
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\": \"eu-restricted-read-only\",\n \"description\": \"Restrict session to EU data, hide PII columns\",\n \"execution_policy\": {\n \"datasources\": {\n \"ds_abc123\": {\n \"tables\": {\n \"filter\": {\n \"table.__name__\": {\n \"$in\": [\n \"orders\",\n \"customers\"\n ]\n },\n \"orders.region\": {\n \"$eq\": \"EU\"\n }\n },\n \"hidden_columns\": {\n \"customers\": [\n \"ssn\",\n \"credit_card\"\n ]\n }\n },\n \"documents\": {\n \"filter\": {\n \"data_element.__id__\": {\n \"$in\": [\n \"de_abc\",\n \"de_def\"\n ]\n }\n }\n }\n },\n \"ds_xyz789\": {\n \"disabled\": true\n }\n },\n \"tools\": {\n \"send_email\": {\n \"variables\": {\n \"to\": {\n \"$eq\": \"support@acme.com\"\n },\n \"max_attachments\": {\n \"$lte\": 3\n }\n }\n },\n \"web_search\": {\n \"disabled\": true\n }\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"customer_id": "<string>",
"project_id": "<string>",
"name": "<string>",
"execution_policy": {
"datasources": {},
"tools": {}
},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"description": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authorizations
Body
application/json
Response
Successful Response
ExecutionPolicyResponse
Session-level access constraints (hardrails) for data and tools. Controls what data an agent session can access and what tools it can use. Constraints are enforced by the platform at runtime — the agent cannot bypass them. Multiple policies can be composed: stored policies (by ID) and/or an inline policy are structurally merged. Overlapping datasource or tool entries are combined with $and (intersection semantics). All filter fields use MongoDB-style constraint operators. Plain values are automatically normalized to {"$eq": value}.
Show child attributes
Show child attributes
Was this page helpful?
⌘I