Skip to main content
Execution policies are hardrails that limit what data and tools an agent session can access, enforced by the platform rather than by the LLM. A policy is written inline as the execution_policy field of the object it governs: an agent definition, a session, or a batch definition. This guide covers setting a baseline policy on an agent, narrowing it per session, and scoping batch runs.

Prerequisites

  • An agent with at least one datasource or MCP server tool. See Managing agents to create one.
  • Your API key in the MEIBEL_API_KEY environment variable.
The examples work on one agent, a support assistant that answers questions over the ds_abc123 datasource and reaches its email and web search tools through an MCP server entry named acme.

Set a policy on an agent definition

A policy on the agent definition is the baseline for every session created against that agent. It is the place for constraints that should hold no matter who is using the agent: the tables it may query, the columns it must never return, and the tools it should not have at all. Set it when creating the agent.
Every session on this agent can now query only the orders and customers tables, never sees the two hidden columns, and has no web search tool. Tools are addressed under the MCP server entry that provides them, keyed by the tool’s own name as the server reports it. See Tool constraints for how server entries and tool names line up.
The platform checks every table, column, metadata field, server entry, tool, and parameter the policy names against the agent’s real schemas before the first LLM call. A reference that does not exist stops the session from starting, with an error listing every problem.

Change an agent’s policy

Tighten or relax the baseline by updating the agent with a new execution_policy. Send the complete policy you want the agent to carry. The update below keeps the datasource scoping and adds a locked recipient on the email tool.
Agents follow a draft and publish workflow, so the new policy takes effect on sessions once the agent is published. See Publish an agent.

Narrow a session

Per-user scoping happens at session creation. The agent’s policy stays fixed, and each session adds the constraints that belong to the user behind it: the region they may see, the documents they own, the limits on what a tool may do on their behalf. The session below restricts one user to EU orders and two documents, and caps how many results any tool on the acme server may return.
The session policy composes with the agent’s policy. Where both touch the same field, the constraints are combined with $and, and a tool or datasource disabled at either level stays disabled. Composition only narrows, so a session can never reach data or tools the agent definition rules out. The global entry applies its constraint to every tool the acme server exposes that declares a count parameter, including tools added to the server after the policy was written. See Composing policies for the full merge rules.

Scope a batch definition

A batch definition carries its own execution_policy, applied to every item the batch processes. Set it when creating the definition to limit which input documents a run may touch and which tools it may call.
The batch definition’s policy composes with the agent’s policy in the same way a session’s does. Executing the definition takes no further policy input; every item in the run inherits the composed result.

Next steps

Execution Policies

The full constraint syntax, enforcement model, and composition rules behind these examples.

Managing Datasource Metadata

Index the metadata fields a document filter can scope on.