start_policy_generation¶
Operation¶
start_policy_generation
async
¶
start_policy_generation(input: StartPolicyGenerationInput, plugins: list[Plugin] | None = None) -> StartPolicyGenerationOutput
Initiates the AI-powered generation of Cedar policies from natural language descriptions within the AgentCore Policy system. This feature enables both technical and non-technical users to create policies by describing their authorization requirements in plain English, which is then automatically translated into formal Cedar policy statements. The generation process analyzes the natural language input along with the Gateway's tool context to produce validated policy options. Generated policy assets are automatically deleted after 7 days, so you should review and create policies from the generated assets within this timeframe. Once created, policies are permanent and not subject to this expiration. Generated policies should be reviewed and tested in log-only mode before deploying to production. Use this when you want to describe policy intent naturally rather than learning Cedar syntax, though generated policies may require refinement for complex scenarios.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input
|
StartPolicyGenerationInput
|
An instance of |
required |
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
|
Returns:
| Type | Description |
|---|---|
StartPolicyGenerationOutput
|
An instance of |
Input¶
StartPolicyGenerationInput
dataclass
¶
Dataclass for StartPolicyGenerationInput structure.
Attributes¶
client_token
class-attribute
instance-attribute
¶
client_token: str | None = None
A unique, case-sensitive identifier to ensure the idempotency of the request. The AWS SDK automatically generates this token, so you don't need to provide it in most cases. If you retry a request with the same client token, the service returns the same response without starting a duplicate generation.
content
class-attribute
instance-attribute
¶
content: Content | None = None
The natural language description of the desired policy behavior. This content is processed by AI to generate corresponding Cedar policy statements that match the described intent.
name
class-attribute
instance-attribute
¶
name: str | None = None
A customer-assigned name for the policy generation request. This helps track and identify generation operations, especially when running multiple generations simultaneously.
policy_engine_id
class-attribute
instance-attribute
¶
policy_engine_id: str | None = None
The identifier of the policy engine that provides the context for policy generation. This engine's schema and tool context are used to ensure generated policies are valid and applicable.
Output¶
StartPolicyGenerationOutput
dataclass
¶
Dataclass for StartPolicyGenerationOutput structure.
Attributes¶
created_at
instance-attribute
¶
created_at: datetime
The timestamp when the policy generation request was created.
findings
class-attribute
instance-attribute
¶
findings: str | None = None
Initial findings from the policy generation process.
policy_engine_id
instance-attribute
¶
policy_engine_id: str
The identifier of the policy engine associated with the started policy generation.
policy_generation_arn
instance-attribute
¶
policy_generation_arn: str
The ARN of the created policy generation request.
policy_generation_id
instance-attribute
¶
policy_generation_id: str
The unique identifier assigned to the policy generation request for tracking progress.
resource
instance-attribute
¶
resource: Resource
The resource information associated with the policy generation request.
status
instance-attribute
¶
status: PolicyGenerationStatus
The initial status of the policy generation request.
status_reasons
instance-attribute
¶
status_reasons: list[str]
Additional information about the generation status.
updated_at
instance-attribute
¶
updated_at: datetime
The timestamp when the policy generation was last updated.