BedrockAgentCoreControl / Client / start_policy_generation
start_policy_generation¶
- BedrockAgentCoreControl.Client.start_policy_generation(**kwargs)¶
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.
See also: AWS API Documentation
Request Syntax
response = client.start_policy_generation( policyEngineId='string', resource={ 'arn': 'string' }, content={ 'rawText': 'string' }, name='string', clientToken='string' )
- Parameters:
policyEngineId (string) –
[REQUIRED]
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.
resource (dict) –
[REQUIRED]
The resource information that provides context for policy generation. This helps the AI understand the target resources and generate appropriate access control rules.
Note
This is a Tagged Union structure. Only one of the following top level keys can be set:
arn.arn (string) –
The Amazon Resource Name (ARN) of the resource. This globally unique identifier specifies the exact resource that policies will be evaluated against for access control decisions.
content (dict) –
[REQUIRED]
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.
Note
This is a Tagged Union structure. Only one of the following top level keys can be set:
rawText.rawText (string) –
The raw text content containing natural language descriptions of desired policy behavior. This text is processed by AI to generate corresponding Cedar policy statements that match the described intent.
name (string) –
[REQUIRED]
A customer-assigned name for the policy generation request. This helps track and identify generation operations, especially when running multiple generations simultaneously.
clientToken (string) –
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.
This field is autopopulated if not provided.
- Return type:
dict
- Returns:
Response Syntax
{ 'policyEngineId': 'string', 'policyGenerationId': 'string', 'name': 'string', 'policyGenerationArn': 'string', 'resource': { 'arn': 'string' }, 'createdAt': datetime(2015, 1, 1), 'updatedAt': datetime(2015, 1, 1), 'status': 'GENERATING'|'GENERATED'|'GENERATE_FAILED'|'DELETE_FAILED', 'statusReasons': [ 'string', ], 'findings': 'string' }
Response Structure
(dict) –
policyEngineId (string) –
The identifier of the policy engine associated with the started policy generation.
policyGenerationId (string) –
The unique identifier assigned to the policy generation request for tracking progress.
name (string) –
The customer-assigned name for the policy generation request.
policyGenerationArn (string) –
The ARN of the created policy generation request.
resource (dict) –
The resource information associated with the policy generation request.
Note
This is a Tagged Union structure. Only one of the following top level keys will be set:
arn. If a client receives an unknown member it will setSDK_UNKNOWN_MEMBERas the top level key, which maps to the name or tag of the unknown member. The structure ofSDK_UNKNOWN_MEMBERis as follows:'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
arn (string) –
The Amazon Resource Name (ARN) of the resource. This globally unique identifier specifies the exact resource that policies will be evaluated against for access control decisions.
createdAt (datetime) –
The timestamp when the policy generation request was created.
updatedAt (datetime) –
The timestamp when the policy generation was last updated.
status (string) –
The initial status of the policy generation request.
statusReasons (list) –
Additional information about the generation status.
(string) –
findings (string) –
Initial findings from the policy generation process.
Exceptions
BedrockAgentCoreControl.Client.exceptions.ServiceQuotaExceededExceptionBedrockAgentCoreControl.Client.exceptions.AccessDeniedExceptionBedrockAgentCoreControl.Client.exceptions.ConflictExceptionBedrockAgentCoreControl.Client.exceptions.ValidationExceptionBedrockAgentCoreControl.Client.exceptions.ResourceNotFoundExceptionBedrockAgentCoreControl.Client.exceptions.ThrottlingExceptionBedrockAgentCoreControl.Client.exceptions.InternalServerException