Skip to main content
Version: 1.9.x

Policies (Beta)

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 caches generated guard code for better performance.

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.

Use the component in a flow

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/. If you switch to Guard (apply cached guards), the project directory must already contain valid generated guard code. The component handles module caching and cleanup automatically.

For more information, see the ToolGuard GitHub repository.

Policies parameters

NameTypeDescription
enabledBooleanInput parameter. If true, ToolGuard runs before tool execution; if false, policy validation is skipped.
modeStringInput parameter. Activity: Generate runs buildtime to create guard code, or Guard loads existing guards from the project folder.
projectStringInput parameter. Folder name for generated code under tmp_toolguard/ (default my_project).
in_toolsList[Tool]Input parameter. Tools the agent can use; they are wrapped with policy guards when enabled.
policiesList[String]Input parameter. One or more clear, self-contained business policy strings. Required when generating guards.
modelModelInput parameter. LLM used for Policies buildtime; Anthropic Claude Sonnet is recommended. Required when generating guards.
api_keyStringInput parameter. Model provider API key (advanced). Required when generating guards.
guarded_toolsList[Tool]Output parameter. Tools with policy enforcement applied. Returns the original tools when the component is disabled.
Search