docs/versioned_docs/version-1.11.0/Components/policies.mdx
The Policies component leverages ToolGuard to automatically generate guard code that validates tool execution against defined business policies.
With this component, developers define business policies in natural language and integrate policy enforcement into agent workflows. It automatically generates validation code for tools from those policies, protects tool execution by enforcing policy compliance at runtime, and stores generated guard code in the flow for reuse.
The component supports Generate activity, which runs ToolGuard’s buildtime flow to produce new guard code from policies, and Guard activity, which reuses previously generated guard code for faster runs.
When enabled is true, you must supply at least one policy before generating guards.
Generated guard code is written under tmp_toolguard/{project_name}/, with Step 1 producing guard specifications from policies in Step_1/, and Step 2 turning those specifications into executable guard code in Step_2/.
The generated code is also stored in the Policies node. After switching to Guard, the component loads that stored code, so the local tmp_toolguard directory is not required. If the node does not contain complete generated code, run Generate again.
For more information, see the ToolGuard GitHub repository.
| Name | Type | Description |
|---|---|---|
| enabled | Boolean | Input parameter. If true, ToolGuard runs before tool execution; if false, policy validation is skipped. |
| mode | String | Input parameter. Activity: Generate runs buildtime to create guard code, or Guard loads generated guards stored in the flow. |
| project | String | Input parameter. Folder name for generated code under tmp_toolguard/ (default my_project). |
| in_tools | List[Tool] | Input parameter. Tools the agent can use; they are wrapped with policy guards when enabled. |
| policies | List[String] | Input parameter. One or more clear, self-contained business policy strings. Required when generating guards. |
| model | Model | Input parameter. LLM used for Policies buildtime; Anthropic Claude Sonnet is recommended. Required when generating guards. |
| api_key | String | Input parameter. Model provider API key (advanced). Required when generating guards. |
| guarded_tools | List[Tool] | Output parameter. Tools with policy enforcement applied. Returns the original tools when the component is disabled. |