# PolicyProps

Properties for creating a Policy resource.

Used as props by: [Policy](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_bedrockagentcore.Policy.html)

- Source: [`aws-bedrockagentcore/lib/policy/policy.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-bedrockagentcore/lib/policy/policy.ts#L21)
- Type last changed: v2.269.0 · 10 Sep 2026

## Example

TypeScript:

```ts
declare const policyEngine: agentcore.PolicyEngine;

const advancedPolicy = new agentcore.Policy(this, "AdvancedPolicy", {
  policyEngine: policyEngine,
  statement: agentcore.PolicyStatement.fromCedar(
    'permit(principal, action, resource) when { context.custom > 10 };'
  ),
  description: "Advanced policy with custom Cedar logic",
});

policyEngine.addPolicy("CustomPolicy", {
  statement: agentcore.PolicyStatement.fromCedar(
    'forbid(principal, action, resource) when { resource.confidential == true };'
  ),
  description: "Custom policy from Cedar string",
});
```

Python:

```python
# policy_engine: agentcore.PolicyEngine

advanced_policy = agentcore.Policy(self, "AdvancedPolicy",
    policy_engine=policy_engine,
    statement=agentcore.PolicyStatement.from_cedar("permit(principal, action, resource) when { context.custom > 10 };"),
    description="Advanced policy with custom Cedar logic"
)

policy_engine.add_policy("CustomPolicy",
    statement=agentcore.PolicyStatement.from_cedar("forbid(principal, action, resource) when { resource.confidential == true };"),
    description="Custom policy from Cedar string"
)
```

Java:

```java
PolicyEngine policyEngine;

Policy advancedPolicy = Policy.Builder.create(this, "AdvancedPolicy")
        .policyEngine(policyEngine)
        .statement(PolicyStatement.fromCedar("permit(principal, action, resource) when { context.custom > 10 };"))
        .description("Advanced policy with custom Cedar logic")
        .build();

policyEngine.addPolicy("CustomPolicy", AddPolicyOptions.builder()
        .statement(PolicyStatement.fromCedar("forbid(principal, action, resource) when { resource.confidential == true };"))
        .description("Custom policy from Cedar string")
        .build());
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
PolicyEngine policyEngine;

var advancedPolicy = new Policy(this, "AdvancedPolicy", new PolicyProps {
    PolicyEngine = policyEngine,
    Statement = PolicyStatement.FromCedar("permit(principal, action, resource) when { context.custom > 10 };"),
    Description = "Advanced policy with custom Cedar logic"
});

policyEngine.AddPolicy("CustomPolicy", new AddPolicyOptions {
    Statement = PolicyStatement.FromCedar("forbid(principal, action, resource) when { resource.confidential == true };"),
    Description = "Custom policy from Cedar string"
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var policyEngine PolicyEngine

advancedPolicy := agentcore.NewPolicy(this, jsii.String("AdvancedPolicy"), &PolicyProps{
	PolicyEngine: policyEngine,
	Statement: agentcore.PolicyStatement_FromCedar(jsii.String("permit(principal, action, resource) when { context.custom > 10 };")),
	Description: jsii.String("Advanced policy with custom Cedar logic"),
})

policyEngine.AddPolicy(jsii.String("CustomPolicy"), &AddPolicyOptions{
	Statement: agentcore.PolicyStatement_*FromCedar(jsii.String("forbid(principal, action, resource) when { resource.confidential == true };")),
	Description: jsii.String("Custom policy from Cedar string"),
})
```

## Properties

- `description`: string — Optional description for the policy.

  **Default:** No description

  Maximum length of 4096.

- `policyEngine`: [IPolicyEngine](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_bedrockagentcore.IPolicyEngine.html) (required) — The policy engine this policy belongs to.

  [disable-awslint:prefer-ref-interface]

- `policyName`: string — The name of the policy.

  **Default:** Auto-generated unique name

  Valid characters: a-z, A-Z, 0-9, _ (underscore)
  Must start with a letter, 1-48 characters
  Pattern: ^[A-Za-z][A-Za-z0-9_]*$

- `statement`: [PolicyStatement](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_bedrockagentcore.PolicyStatement.html) (required) — The Cedar policy statement for this policy.

  Build a type-safe statement with the `PolicyStatement` factories, which validate
  at synthesis time and reject values that cannot be represented safely in Cedar.

  For raw Cedar (features this API does not model, or migrating an existing policy),
  use `PolicyStatement.fromCedar('...')`. That string is used exactly as given: the
  module does not escape, quote, or validate it, so it is treated as trusted input
  and you own its correctness and safety. Do not assemble it from values that come
  from outside your application, such as a request body or a database record.

- `validationMode`: [PolicyValidationMode](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_bedrockagentcore.PolicyValidationMode.html) — Validation mode for the policy.

  **Default:** PolicyValidationMode.FAIL_ON_ANY_FINDINGS

  Controls how Cedar analyzer validation findings are handled.
