BedrockAgentCoreControlClient.create_policy
rboto-bedrock-agentcore-control==0.4.0 · Service index · Types
Model summary (excerpt): Creates a policy within the AgentCore Policy system. Policies provide real-time, deterministic control over agentic interactions with AgentCore Gateway. Using Cedar or Dogwood, you can define fine-grained policies that specify which interactions with Gateway tools are permitted based on input parameters and OAuth claims, ensuring agents operate within defined boundaries and business rules. The...
Install and imports
from rboto import BedrockAgentCoreControlClient
from rboto_bedrock_agentcore_control.types import (
CreatePolicyOutput,
EnforcementMode,
PolicyDefinition,
PolicyValidationMode,
)
Signature
async def create_policy(
*,
name: str,
definition: PolicyDefinition,
policy_engine_id: str,
description: str | None = None,
validation_mode: PolicyValidationMode | None = None,
enforcement_mode: EnforcementMode | None = None,
client_token: str | None = None,
) -> CreatePolicyOutput: ...
Arguments without defaults are required. None omits an optional request argument. Static types do not validate resource existence, permissions, lengths, ranges, or conditional service requirements.
Arguments
| Argument | Required | Model notes (excerpt) |
|---|---|---|
name |
Yes | The customer-assigned immutable name for the policy. Must be unique within the account. This name is used for policy identification and cannot be changed after creation. |
definition |
Yes | The Cedar or Dogwood policy statement that defines the access control rules. This contains the actual policy logic written in Cedar or Dogwood, specifying effect (permit or forbid), principals, actions, resources, and conditions for agent behavior control. |
policy_engine_id |
Yes | The identifier of the policy engine which contains this policy. Policy engines group related policies and provide the execution context for policy evaluation. |
description |
No | A human-readable description of the policy's purpose and functionality (1-4,096 characters). This helps policy administrators understand the policy's intent, business rules, and operational scope. Use this field to document why the policy exists, what business requirement it addresses, and any special considerations for maintenance. Clear descriptions are essential for policy governance,... |
validation_mode |
No | The validation mode for the policy creation. Determines how Cedar analyzer validation results are handled during policy creation. FAIL_ON_ANY_FINDINGS (default) runs the Cedar analyzer to validate the policy against the Cedar schema and tool context, failing creation if the analyzer detects any validation issues to ensure strict conformance. IGNORE_ALL_FINDINGS runs the Cedar analyzer but... |
enforcement_mode |
No | The enforcement mode for the policy. Run this policy in LOG_ONLY mode to collect data on how it affects your application. Once you are satisfied with the data gathered, switch the policy to ACTIVE . Defaults to ACTIVE . |
client_token |
No | A unique, case-sensitive identifier to ensure the idempotency of the request. The Amazon Web Services 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 creating a duplicate policy. |
Output
CreatePolicyOutput.
Read-only native attributes, accessed as response.field. Collection getters materialize Python values; to_dict() recursively materializes a mapping. Streams are consumed once.
| Field | Type | Presence | References |
|---|---|---|---|
policy_id |
str |
Always present | — |
name |
str |
Always present | — |
policy_engine_id |
str |
Always present | — |
created_at |
str |
Always present | — |
updated_at |
str |
Always present | — |
policy_arn |
str |
Always present | — |
status |
PolicyStatusOutput |
Always present | PolicyStatusOutput |
enforcement_mode |
EnforcementModeOutput |
Always present | EnforcementModeOutput |
definition |
PolicyDefinitionOutput | None |
Always present | PolicyDefinitionOutput |
description |
str | None |
Always present | — |
status_reasons |
list[str] |
Always present | — |
| None means a value can be absent. Output mappings include every declared key; optional input keys may be omitted. Unknown output enum/union variants are not automatically valid inputs.
Related types
CreatePolicyOutput, EnforcementMode, PolicyDefinition, PolicyValidationMode
Follow these links for nested inputs and outputs; recursive types link back to the same type page.
Pagination and streaming
No generated paginator for this operation.
No output stream.
Errors
Import from rboto_bedrock_agentcore_control.exceptions:
AccessDeniedError, ConflictError, InternalServerError, ResourceNotFoundError, ServiceQuotaExceededError, ThrottlingError, ValidationError.
Other service failures use the service base error; credential, transport and timeout failures use shared errors.