Launch Week 02 wrapped — explore all five launches

Governance Policies with Admin SDK

List governance policies and enroll projects into them in code.

Overview

AI governance policies are organization-scoped bundles of controls that gate how your projects ship. Policies and their controls are created and configured in the platform UI; the Admin SDK lets you enroll projects into a policy in code — ideal for CI/CD pipelines that provision one project per customer or per agent. Each project belongs to at most one policy.

List Policies

List every governance policy in your organization. Each policy includes its controls and a projectsCount.

from confidentai import ConfidentAI

client = ConfidentAI()

org = client.organization()

policies = org.governance.policies.list()

List a Policy's Projects

Page through the projects currently enrolled in a policy.

org = client.organization()

projects = org.governance.policies.list_projects(
    "a17c4e2d-9b3f-4a6c-8d1e-2f5a9c3b7e0d",
    page=1,
    page_size=25,
)

Assign Projects

Assign one or more projects to a policy. Assignment is additive and partial: every project that exists is enrolled and returned in assignedProjectIds (projects on a different policy are moved over), while ids that don't exist in your organization come back in notFoundProjectIds instead of failing the call. Re-assigning an already-enrolled project still counts it, so this is safe to run on every pipeline execution.

org = client.organization()

result = org.governance.policies.assign(
    "a17c4e2d-9b3f-4a6c-8d1e-2f5a9c3b7e0d",
    project_ids=["clq9z3x1k0001la08f7t3g5p2"],
)
print(result.assigned_project_ids)   # ["clq9z3x1k0001la08f7t3g5p2"]
print(result.not_found_project_ids)  # []
print(result.count)                  # 1

Unassign Projects

Remove projects from a policy (for example, when deprovisioning a customer). Removal is also partial: projects currently on the policy are removed and returned in unassignedProjectIds, while ids that aren't on this policy (unknown, foreign, or on another policy) come back in skippedProjectIds.

org = client.organization()

result = org.governance.policies.unassign(
    "a17c4e2d-9b3f-4a6c-8d1e-2f5a9c3b7e0d",
    project_ids=["clq9z3x1k0001la08f7t3g5p2"],
)
print(result.unassigned_project_ids)  # ["clq9z3x1k0001la08f7t3g5p2"]
print(result.skipped_project_ids)     # []
print(result.count)                   # 1

Next Steps

Setting this up for your organization?Set up the controls your team needs before a wider rolloutTalk to us

Last updated on

Built byConfident AI