Skip to content

create_policy_engine

Operation

create_policy_engine

create_policy_engine(request: CreatePolicyEngineInput | CreatePolicyEngineInputDict | None = None, /, *, plugins: list[Plugin] | None = None, **kwargs: Unpack[CreatePolicyEngineInputDict]) -> CreatePolicyEngineOutput

Creates a new policy engine within the AgentCore Policy system. A policy engine is a collection of policies that evaluates and authorizes agent tool calls. When associated with Gateways (each Gateway can be associated with at most one policy engine, but multiple Gateways can be associated with the same engine), the policy engine intercepts all agent requests and determines whether to allow or deny each action based on the defined policies. This is an asynchronous operation. Use the GetPolicyEngine operation to poll the status field to track completion.

Parameters:

Name Type Description Default
request CreatePolicyEngineInput | CreatePolicyEngineInputDict | None

The input as a model or dictionary. Pass this or keyword arguments, not both.

None
plugins list[Plugin] | None

A list of callables that modify the configuration dynamically. Changes made by these plugins only apply for the duration of the operation execution and will not affect any other operation invocations.

None
**kwargs Unpack[CreatePolicyEngineInputDict]

The input fields as keyword arguments.

{}

Returns:

Type Description
CreatePolicyEngineOutput

An instance of CreatePolicyEngineOutput.

create_policy_engine async

create_policy_engine(request: CreatePolicyEngineInput | CreatePolicyEngineInputDict | None = None, /, *, plugins: list[Plugin] | None = None, **kwargs: Unpack[CreatePolicyEngineInputDict]) -> CreatePolicyEngineOutput

Creates a new policy engine within the AgentCore Policy system. A policy engine is a collection of policies that evaluates and authorizes agent tool calls. When associated with Gateways (each Gateway can be associated with at most one policy engine, but multiple Gateways can be associated with the same engine), the policy engine intercepts all agent requests and determines whether to allow or deny each action based on the defined policies. This is an asynchronous operation. Use the GetPolicyEngine operation to poll the status field to track completion.

Parameters:

Name Type Description Default
request CreatePolicyEngineInput | CreatePolicyEngineInputDict | None

The input as a model or dictionary. Pass this or keyword arguments, not both.

None
plugins list[Plugin] | None

A list of callables that modify the configuration dynamically. Changes made by these plugins only apply for the duration of the operation execution and will not affect any other operation invocations.

None
**kwargs Unpack[CreatePolicyEngineInputDict]

The input fields as keyword arguments.

{}

Returns:

Type Description
CreatePolicyEngineOutput

An instance of CreatePolicyEngineOutput.

Input

Pass the input as keyword arguments, a positional dictionary, or a positional model object. Pass plugins separately as a keyword argument.

CreatePolicyEngineInputDict

Bases: TypedDict

Dictionary form of CreatePolicyEngineInput.

Attributes

client_token instance-attribute
client_token: str | None

A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. If you retry a request with the same client token, the service returns the same response without creating a duplicate policy engine.

This field is autopopulated if not provided.

description instance-attribute
description: str | None

A human-readable description of the policy engine's purpose and scope (1-4,096 characters). This helps administrators understand the policy engine's role in the overall governance strategy. Document which Gateway this engine will be associated with, what types of tools or workflows it governs, and the team or service responsible for maintaining it. Clear descriptions are essential when managing multiple policy engines across different services or environments.

encryption_key_arn instance-attribute
encryption_key_arn: str | None

The Amazon Resource Name (ARN) of the KMS key used to encrypt the policy engine data.

name instance-attribute
name: Required[str]

The customer-assigned immutable name for the policy engine. This name identifies the policy engine and cannot be changed after creation.

tags instance-attribute
tags: Mapping[str, str] | None

A map of tag keys and values to assign to an AgentCore Policy. Tags enable you to categorize your resources in different ways, for example, by purpose, owner, or environment.

CreatePolicyEngineInput dataclass

Bases: _SerdeShape

Dataclass for CreatePolicyEngineInput structure.

Attributes

client_token class-attribute instance-attribute
client_token: str | None = ...

A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. If you retry a request with the same client token, the service returns the same response without creating a duplicate policy engine.

This field is autopopulated if not provided.

description class-attribute instance-attribute
description: str | None = ...

A human-readable description of the policy engine's purpose and scope (1-4,096 characters). This helps administrators understand the policy engine's role in the overall governance strategy. Document which Gateway this engine will be associated with, what types of tools or workflows it governs, and the team or service responsible for maintaining it. Clear descriptions are essential when managing multiple policy engines across different services or environments.

encryption_key_arn class-attribute instance-attribute
encryption_key_arn: str | None = ...

The Amazon Resource Name (ARN) of the KMS key used to encrypt the policy engine data.

name class-attribute instance-attribute
name: str | None = ...

The customer-assigned immutable name for the policy engine. This name identifies the policy engine and cannot be changed after creation.

tags class-attribute instance-attribute
tags: dict[str, str] | None = ...

A map of tag keys and values to assign to an AgentCore Policy. Tags enable you to categorize your resources in different ways, for example, by purpose, owner, or environment.

Output

CreatePolicyEngineOutput dataclass

Bases: _SerdeShape

Dataclass for CreatePolicyEngineOutput structure.

Attributes

created_at instance-attribute
created_at: datetime

The timestamp when the policy engine was created. This is automatically set by the service and used for auditing and lifecycle management.

description class-attribute instance-attribute
description: str | None = ...

A human-readable description of the policy engine's purpose.

encryption_key_arn class-attribute instance-attribute
encryption_key_arn: str | None = ...

The Amazon Resource Name (ARN) of the KMS key used to encrypt the policy engine data.

name instance-attribute
name: str

The customer-assigned name of the created policy engine. This matches the name provided in the request and serves as the human-readable identifier.

policy_engine_arn instance-attribute
policy_engine_arn: str

The Amazon Resource Name (ARN) of the created policy engine. This globally unique identifier can be used for cross-service references and IAM policy statements.

policy_engine_id instance-attribute
policy_engine_id: str

The unique identifier for the created policy engine. This system-generated identifier consists of the user name plus a 10-character generated suffix and is used for all subsequent policy engine operations.

response_metadata class-attribute instance-attribute
response_metadata: ResponseMetadata = ...

Metadata about the response that produced this output. Use this to recover the request identifiers a service's support team needs in order to investigate a call. Members of the metadata are individually optional.

status instance-attribute
status: str

The current status of the policy engine. A status of ACTIVE indicates the policy engine is ready for use.

status_reasons instance-attribute
status_reasons: list[str]

Additional information about the policy engine status. This provides details about any failures or the current state of the policy engine creation process.

updated_at instance-attribute
updated_at: datetime

The timestamp when the policy engine was last updated. For newly created policy engines, this matches the createdAt timestamp.