Skip to main content
Tool Policies is only available on certain plans. See plans and pricing.
Tool Policies set limits on what an AI agent can see and do for each user it acts for:
  • Input: calls the agent makes are checked before they reach the provider, and refused when a policy denies them.
  • Output: data a provider returns is checked before it reaches the agent, so sensitive fields are masked and PII is redacted.
Flow diagram. An AI agent acting for a user makes a tool call. Input statements (Block tools, Refuse writes, Refuse writes by label) check the call: a refused call returns to the agent without the provider being called, and an allowed call reaches the provider. The provider's response passes through output statements (Mask fields by path, Mask fields by label, Redact PII) and returns to the agent with fields masked and PII redacted

When to use Tool Policies

Use a policy when the same agents act for people who should have different access, or when a call or the data it returns needs a limit:
Contractors use the same agents as employees, but deleting records should stay with employees.A policy for the Contractors group with a Block tools statement on tools matching *delete* refuses those calls for contractors only.
An agent can create payments, but none should go over a set amount.A Refuse writes statement on the payment amount, with an Only when values condition for amounts over 1000, refuses the large ones and lets the rest through.
Tickets hold customers’ email addresses, phone numbers and card numbers, which a support agent can do its job without.A policy on the Zendesk account with a Redact PII statement for the Contact and Financial categories removes them from responses, and a Mask fields by path statement masks the card number field outright.

How a policy is evaluated

A policy’s rule holds at least one statement, and each statement forbids one thing. Every call is allowed unless a statement in an enforced policy forbids it. A policy is made up of these parts: These hold across every policy:

A forbid always wins

When policies overlap, any matching statement in an enforced policy refuses the call or masks the field, whatever other policies say. To let one user through a statement that covers their group, add them to the statement’s Except for condition.

Policies narrow access

Connector Profile scoping and account access apply restrictions before policies.

Policies follow the user

Policies apply to calls a user makes through an AI platform, the dashboard playground, or their own personal API key. Calls made with a project API key are not checked against any policy. Govern that traffic with Connector Profile scoping instead.

Policies stay in their project

A policy belongs to the project it is created in and governs calls made in that project only. To apply the same rule in several projects, create it in each.

Statements

Input statements check the calls an agent makes, before they reach the provider: Output statements check what the provider returns, before it reaches the agent: Refuse writes by label and Mask fields by label are smart rules. Instead of writing a path for every connector, you describe the data in plain words and a model finds the fields that hold it, without reading any values. One statement then covers every connector, including ones you add later. Adding a statement never narrows another, since any statement that matches acts on its own. To narrow a statement, add conditions to it.

Conditions

A condition narrows a statement to some calls:

Build a policy with Policy chat

When you create or edit a policy, describe the rule in your own words under Policy chat. It proposes the whole rule, shown against the current one, and nothing changes until you accept the proposal. Policy chat writes every kind of statement and condition. For example, this prompt writes a Redact PII statement for email addresses, with Support under Except for:
Naming an AI client adds an Only from clients condition:

What Policy chat can look up

Policy chat can look things up in the project as it drafts, and the transcript shows each lookup as it runs:
By default, only a tool call’s tool, connector and caller are exposed.With Advanced Logs on, Policy chat also sees the field paths the call’s request and response carried, never their values.
For example, given Stop contractors deleting records, Policy chat:
  1. Finds the Contractors group and sets Who it applies to to it.
  2. Writes a Block tools statement with Tool names set to *delete*.
It also flags what a rule may miss. For example, a pattern matching delete does not catch a connector whose tools are named with remove or archive, so you can ask it to add those patterns too.

Starting from logs

Start a policy from a call in your logs.
2
Select the log of a call you want to create a policy from.
3
Click Use in policy at the top of the panel.This takes you to the Policies page with the context of the log selected.
4
Select an existing policy, or click Create policy.
5
Policy chat now has the context of the selected log.Describe the policy you want, for example This call should not have been allowed to return salary or This person should not have been allowed to make it.See Build a policy with Policy chat.

Build a policy manually

1

Open Policies

  1. Select the project and open Project Settings > Policies.
  2. Click Create policy.
  3. Set the following:
    • Name: a descriptive name for the policy.
2

Set the enforcement level

Choose an Enforcement level:
  • Enforced: Refuses calls the policy denies, masks fields, and redacts PII according to the rule.
  • Monitored: Records decisions in the logs without blocking or modifying calls.
  • Disabled: Stores the policy without evaluating it.
Start new policies in Monitored, verify the decisions in your logs, then switch to Enforced.
3

Choose who it applies to

Select Everyone, or select Users and groups and search for the users or groups the policy covers.
4

Choose a resource

To hold every statement to one action, connector or Linked Account, select Action, Connector or Account under Resource and pick it. Otherwise leave None.
5

Add statements

For each thing the policy forbids:
  1. Click Add statement and select a statement.
  2. Set what it matches:
    • Block tools: Tool names, as patterns such as *delete*.
    • Refuse writes and Mask fields by path: Field paths, as patterns such as *salary*, or Field path patterns, as regular expressions over the field’s path.
    • Refuse writes by label and Mask fields by label: the Labels to act on, and Unlabelled. See Unclassified fields.
    • Redact PII: the categories and classes under Which PII to redact.
    To cover everything on the policy’s resource instead, click Apply to everything on the resource.
  3. Optionally, click Add condition to narrow the statement. See Conditions.
A Redact PII statement removes PII from tool responses. StackOne’s own PII model scans each response before the agent sees it, including free-text fields such as ticket bodies and notes. Record UUIDs, order numbers, and API keys stay intact.The PII Redaction benchmark compares the model with Microsoft Presidio on connector data.Every class of PII is redacted until you pick some under Which PII to redact:
  • Select a whole category (such as Contact or Financial) to redact all classes within it.
  • To leave specific classes out of a selected category, expand the category and deselect them.
  • To redact individual classes without selecting their whole category, expand the category and select only those classes.
  • Use Search PII to find categories and classes by name.
To redact on one Linked Account only, set the policy’s Resource to Account. There is no pattern to enter. Each detected span is replaced, and the rest of the response is unchanged.A live response that cannot be scanned (it is streamed, above the scan size limit, or the scan fails) is returned unredacted, and the request log records which classes were not redacted. A Deep Query read that cannot be redacted is refused instead.For how detection works, what changes in the call and what is recorded, see PII Redaction.
  • * is the only wildcard, and it matches any run of characters.
  • A pattern has to cover the whole name: salary matches only something named exactly that, so use *salary* to match it anywhere.
  • Matching is case-sensitive.
  • ?, [a-z], and {a,b} are ordinary characters here, not wildcards. A pattern using one saves cleanly and then never matches anything.
Field path patterns are regular expressions instead, such as ^employees\[\]\.bonus$.
6

Review and create

  1. Optionally, switch Rule from Form to Cedar to read or edit the statements as Cedar.
  2. Click Create policy.

Testing a policy before enforcing it

Before enforcing a policy, check it:
  1. Test against personas: in the create and edit panel, Test this policy against personas shows what the rule would decide for the users you choose, without making a call. Each user can be tested through a chosen AI client, or No client (older connection), and added again under another client to compare the decisions.
    • Write statements are tested against a Request body. Type a JSON body, or use the request body of a recent call, which needs the call’s Advanced Logs entry.
    • Choose All policies to see the decision alongside the other policies that apply, or This policy alone to test it on its own.
  2. Monitored: set the policy’s Enforcement to Monitored, and the logs record what the policy would have done while calls run unchanged. PII detections are recorded the same way.
Only when Enforcement is set to Enforced are tool calls blocked or modified as defined by the policy.

Change a policy’s enforcement level

1

Open Policies

Select the project and open Project Settings > Policies.
2

Select the new level

On the policy’s row in the table, click the … button and select the new level:
  • Enforce moves the policy to Enforced.
  • Monitor or Stop enforcing moves the policy to Monitored.
  • Disable moves the policy to Disabled.
To change it from the side panel instead, edit Enforcement and click Save changes.

Duplicating policies

Instead of starting with a blank new policy, an existing policy can be used as a template.
1

Open Policies

Select the project and open Project Settings > Policies.
2

Duplicate the policy

On an existing policy’s row in the table, click the … button and select Duplicate.
3

Review the draft

A new policy is drafted with the original policy’s details except:
  • Name: original name is appended with (copy).
  • Enforcement: set to Disabled.
Edit as needed, then click Create policy.

What a denied call returns

When an enforced policy refuses a tool call before it runs, the request fails with HTTP 403 and nothing reaches the underlying provider. The refusal returns to the agent as the tool result.
Masking and PII redaction never fail a live call. The agent receives the response with the denied fields masked and the detected PII redacted. A Deep Query read is refused instead when a Redact PII statement can’t redact it.

Troubleshooting

  • It matches nothing. The pattern has to cover the whole name: salary only matches a tool named exactly that, so use *salary*. ?, [a-z], and {a,b} do not perform any special matching.
  • It misses tools you expected. Matching is case-sensitive: *Delete* misses personio_delete_person. A pattern matches exactly rather than describing a behavior: *delete* does not catch a tool named okta_remove_user_from_group.
  • It matches more than you expected. * matches any run of characters, underscores included, so *create* could cover leaddocket_list_opportunities_created_since.
Check the following in order:
  1. The policy’s Enforcement is set to Enforced (not Monitored or Disabled).
  2. The user is covered by Who it applies to, and not under the statement’s Except for.
  3. The call is made in the project the policy was created in.
  4. If the policy has a Resource, the call is on that action, connector or account.
  5. The tool name or field path pattern matches exactly, including case.
  6. A user made the call through an AI platform, the dashboard playground, or their own personal API key. Calls made with a project API key are not checked against any policy.
  7. Any conditions on the statement hold: the category, client, values and dates.
  8. If the statement names a label, Smart Rules is on for the project.
Yes, on an action log. Open the record and select the Policy tab.

Smart Rules

Mask or refuse fields by what they hold, with labels.

Scoping Connectors

Set which actions each Connector Profile exposes.

Groups

Maintain the groups your policies apply to.

Connector Profile Access

Control who can link accounts on a profile.

Observability

Configure request logging and retention.