Skip to content

create_agentic_persona_configuration async

create_agentic_persona_configuration(
    name: AgenticPersonaConfigurationName,
    model_ids: AgenticModelIdList,
    *,
    config_overrides: Optional[AsyncWorkSpacesClientConfig] = None,
    client_token: Optional[IdempotencyToken] = None,
    description: Optional[AgenticPersonaConfigurationDescription] = None,
    agentic_connector_ids: Optional[AgenticConnectorIdList] = None,
    agentic_context_ids: Optional[AgenticContextIdList] = None,
    workspace_enforced_policy_id: Optional[WorkspaceEnforcedPolicyId] = None,
    agent_enforced_policy_id: Optional[AgentEnforcedPolicyId] = None,
    tags: Optional[TagList] = None,
) -> CreateAgenticPersonaConfigurationResult

Creates an Amazon WorkSpaces agentic persona configuration with the specified models, connectors, contexts, and enforced policies. The name must be unique among the persona configurations in your account.

If the name is in use, the operation returns ConflictException, and its ResourceId identifies the existing persona configuration. If you exceed the persona or tag limit, it returns ServiceQuotaExceededException.

Parameters:

  • client_token (Optional[IdempotencyToken], default: None ) –

    A unique, case-sensitive identifier that you provide to ensure that the operation completes no more than one time. If this token matches a previous request with the same parameters, the service returns the result of that request and doesn't create another persona configuration.

    If you reuse the token with different parameters, the operation returns ValidationException. If you deleted the persona configuration created with this token, the operation returns ResourceNotFoundException.

  • name (AgenticPersonaConfigurationName) –

    The name of the persona configuration.

  • description (Optional[AgenticPersonaConfigurationDescription], default: None ) –

    The description of the persona configuration.

  • model_ids (AgenticModelIdList) –

    The identifiers of the models that WorkSpaces created with this configuration can use. Specify 1–25 models. The models must be on your account's model list.

  • agentic_connector_ids (Optional[AgenticConnectorIdList], default: None ) –

    The identifiers of the connectors to add to WorkSpaces created with this configuration. The connectors must be activated for your account.

  • agentic_context_ids (Optional[AgenticContextIdList], default: None ) –

    The identifiers of the contexts to add to WorkSpaces created with this configuration.

  • workspace_enforced_policy_id (Optional[WorkspaceEnforcedPolicyId], default: None ) –

    The identifier of the WorkSpace-enforced policy to apply to WorkSpaces created with this configuration.

  • agent_enforced_policy_id (Optional[AgentEnforcedPolicyId], default: None ) –

    The identifier of the agent-enforced policy to apply to WorkSpaces created with this configuration.

  • tags (Optional[TagList], default: None ) –

    The tags to add to the persona configuration.

Raises:

  • AccessDeniedException –

    The user is not authorized to access a resource.

  • ConflictException –

    The request conflicts with the current state of a resource, for example because a name is already in use or the resource is still in use. Resolve the conflict, and then retry your request.

  • ResourceNotFoundException –

    The resource could not be found.

  • ServiceQuotaExceededException –

    The request would exceed a service quota. Request a quota increase or reduce the number of resources in your request.

  • ThrottlingException –

    The request was throttled. Retry the request with exponential backoff.

  • ValidationException –

    Your request failed validation. Check the error message for the parameter that isn't valid.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Examples:

Example – Creating a persona configuration The following example creates a persona configuration with two models, a connector, a context, and both enforced policies.

>>> await client.create_agentic_persona_configuration(client_token='a1b2c3d4-5678-90ab-cdef-EXAMPLE11111', name='backend-developer', description='Persona for backend developers.', model_ids=['anthropic.claude-sonnet-5-5', 'anthropic.claude-opus-5-5'], agentic_connector_ids=['wsacn-github'], agentic_context_ids=['wsactx-a1b2c3d4'], workspace_enforced_policy_id='wsep-a1b2c3d4', agent_enforced_policy_id='wsae-a1b2c3d4', tags=[{'Key': 'team', 'Value': 'platform'}])
Source code in docs_src/capo_workspaces/_services/async_work_spaces.py
async def create_agentic_persona_configuration(
    self,
    name: "capo_workspaces.types.agentic_persona_configuration_name.AgenticPersonaConfigurationName",
    model_ids: "capo_workspaces.types.agentic_model_id_list.AgenticModelIdList",
    *,
    config_overrides: Optional[AsyncWorkSpacesClientConfig] = None,
    client_token: Optional[
        "capo_workspaces.types.idempotency_token.IdempotencyToken"
    ] = None,
    description: Optional[
        "capo_workspaces.types.agentic_persona_configuration_description.AgenticPersonaConfigurationDescription"
    ] = None,
    agentic_connector_ids: Optional[
        "capo_workspaces.types.agentic_connector_id_list.AgenticConnectorIdList"
    ] = None,
    agentic_context_ids: Optional[
        "capo_workspaces.types.agentic_context_id_list.AgenticContextIdList"
    ] = None,
    workspace_enforced_policy_id: Optional[
        "capo_workspaces.types.workspace_enforced_policy_id.WorkspaceEnforcedPolicyId"
    ] = None,
    agent_enforced_policy_id: Optional[
        "capo_workspaces.types.agent_enforced_policy_id.AgentEnforcedPolicyId"
    ] = None,
    tags: Optional["capo_workspaces.types.tag_list.TagList"] = None,
) -> "capo_workspaces.types.create_agentic_persona_configuration_result.CreateAgenticPersonaConfigurationResult":
    """<p>Creates an Amazon WorkSpaces agentic persona configuration with the specified models, connectors, contexts, and enforced policies. The name must be unique among the persona configurations in your account.</p> <p>If the name is in use, the operation returns <code>ConflictException</code>, and its <code>ResourceId</code> identifies the existing persona configuration. If you exceed the persona or tag limit, it returns <code>ServiceQuotaExceededException</code>.</p>

    Args:
        client_token: <p>A unique, case-sensitive identifier that you provide to ensure that the operation completes no more than one time. If this token matches a previous request with the same parameters, the service returns the result of that request and doesn't create another persona configuration.</p> <p>If you reuse the token with different parameters, the operation returns <code>ValidationException</code>. If you deleted the persona configuration created with this token, the operation returns <code>ResourceNotFoundException</code>.</p>
        name: <p>The name of the persona configuration.</p>
        description: <p>The description of the persona configuration.</p>
        model_ids: <p>The identifiers of the models that WorkSpaces created with this configuration can use. Specify 1–25 models. The models must be on your account's model list.</p>
        agentic_connector_ids: <p>The identifiers of the connectors to add to WorkSpaces created with this configuration. The connectors must be activated for your account.</p>
        agentic_context_ids: <p>The identifiers of the contexts to add to WorkSpaces created with this configuration.</p>
        workspace_enforced_policy_id: <p>The identifier of the WorkSpace-enforced policy to apply to WorkSpaces created with this configuration.</p>
        agent_enforced_policy_id: <p>The identifier of the agent-enforced policy to apply to WorkSpaces created with this configuration.</p>
        tags: <p>The tags to add to the persona configuration.</p>

    Raises:
        capo_workspaces.errors.access_denied_exception.AccessDeniedException: <p>The user is not authorized to access a resource.</p>
        capo_workspaces.errors.conflict_exception.ConflictException: <p>The request conflicts with the current state of a resource, for example because a name is already in use or the resource is still in use. Resolve the conflict, and then retry your request.</p>
        capo_workspaces.errors.resource_not_found_exception.ResourceNotFoundException: <p>The resource could not be found.</p>
        capo_workspaces.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The request would exceed a service quota. Request a quota increase or reduce the number of resources in your request.</p>
        capo_workspaces.errors.throttling_exception.ThrottlingException: <p>The request was throttled. Retry the request with exponential backoff.</p>
        capo_workspaces.errors.validation_exception.ValidationException: <p>Your request failed validation. Check the error message for the parameter that isn't valid.</p>
        capo_workspaces.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        Example – Creating a persona configuration
        The following example creates a persona configuration with two models, a connector, a context, and both enforced policies.

        >>> await client.create_agentic_persona_configuration(client_token='a1b2c3d4-5678-90ab-cdef-EXAMPLE11111', name='backend-developer', description='Persona for backend developers.', model_ids=['anthropic.claude-sonnet-5-5', 'anthropic.claude-opus-5-5'], agentic_connector_ids=['wsacn-github'], agentic_context_ids=['wsactx-a1b2c3d4'], workspace_enforced_policy_id='wsep-a1b2c3d4', agent_enforced_policy_id='wsae-a1b2c3d4', tags=[{'Key': 'team', 'Value': 'platform'}])
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_workspaces.types.create_agentic_persona_configuration_request.CreateAgenticPersonaConfigurationRequest]",
    ) -> AsyncOperationResponse[
        "capo_workspaces.types.create_agentic_persona_configuration_result.CreateAgenticPersonaConfigurationResult"
    ]:
        if req.options.protocol == "awsJson1_1":
            import capo_workspaces._operations.workspaces_service.aws_json1_1.create_agentic_persona_configuration

            (
                output,
                http_response,
            ) = await capo_workspaces._operations.workspaces_service.aws_json1_1.create_agentic_persona_configuration.async_create_agentic_persona_configuration(
                req.options, req.input
            )
        elif req.options.protocol == "rpcv2Cbor":
            import capo_workspaces._operations.workspaces_service.rpcv2_cbor.create_agentic_persona_configuration

            (
                output,
                http_response,
            ) = await capo_workspaces._operations.workspaces_service.rpcv2_cbor.create_agentic_persona_configuration.async_create_agentic_persona_configuration(
                req.options, req.input
            )
        else:
            raise ValueError(f"unknown protocol {req.options.protocol!r}")
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateAgenticPersonaConfiguration")
    )
    input_: capo_workspaces.types.create_agentic_persona_configuration_request.CreateAgenticPersonaConfigurationRequest = {
        "name": name,
        "model_ids": model_ids,
    }
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token
    if description is not None:
        input_["description"] = description
    if agentic_connector_ids is not None:
        input_["agentic_connector_ids"] = agentic_connector_ids
    if agentic_context_ids is not None:
        input_["agentic_context_ids"] = agentic_context_ids
    if workspace_enforced_policy_id is not None:
        input_["workspace_enforced_policy_id"] = workspace_enforced_policy_id
    if agent_enforced_policy_id is not None:
        input_["agent_enforced_policy_id"] = agent_enforced_policy_id
    if tags is not None:
        input_["tags"] = tags

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output