Tool Policies is only available on certain plans. See plans and pricing.
- 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.
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 shouldn't delete records
Contractors shouldn't delete records
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.Payments need a ceiling
Payments need a ceiling
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.Support agents don't need customers' contact details
Support agents don't need customers' contact details
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: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.
Stop contractors deleting records, Policy chat:
- Finds the
Contractorsgroup and sets Who it applies to to it. - Writes a Block tools statement with Tool names set to
*delete*.
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.1
Go to StackOne 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
- Select the project and open Project Settings > Policies.
- Click Create policy.
- 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.
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:
- Click Add statement and select a statement.
-
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.
- Block tools: Tool names, as patterns such as
- Optionally, click Add condition to narrow the statement. See Conditions.
Redact PII
Redact PII
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.
Pattern syntax for tool names and field paths
Pattern syntax for tool names and field paths
*is the only wildcard, and it matches any run of characters.- A pattern has to cover the whole name:
salarymatches 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
- Optionally, switch Rule from Form to Cedar to read or edit the statements as Cedar.
- Click Create policy.
Testing a policy before enforcing it
Before enforcing a policy, check it:- 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.
- 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.
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.
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.
What a denied call returns
When an enforced policy refuses a tool call before it runs, the request fails with HTTP403 and nothing reaches the underlying provider. The refusal returns to the agent as the tool result.
Troubleshooting
Why is a pattern matching the wrong tools, or none at all?
Why is a pattern matching the wrong tools, or none at all?
- It matches nothing. The pattern has to cover the whole name:
salaryonly 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*missespersonio_delete_person. A pattern matches exactly rather than describing a behavior:*delete*does not catch a tool namedokta_remove_user_from_group. - It matches more than you expected.
*matches any run of characters, underscores included, so*create*could coverleaddocket_list_opportunities_created_since.
Why is a policy not taking effect?
Why is a policy not taking effect?
Check the following in order:
- The policy’s Enforcement is set to Enforced (not Monitored or Disabled).
- The user is covered by Who it applies to, and not under the statement’s Except for.
- The call is made in the project the policy was created in.
- If the policy has a Resource, the call is on that action, connector or account.
- The tool name or field path pattern matches exactly, including case.
- 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.
- Any conditions on the statement hold: the category, client, values and dates.
- If the statement names a label, Smart Rules is on for the project.
Can I see policy decisions in request logs?
Can I see policy decisions in request logs?
Yes, on an action log. Open the record and select the Policy tab.
Related
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.