Skip to main content

Working with Policy Packs

Policy Packs are collections of policy controls that define governance requirements in Credo AI.

Overview

Policy Packs group related policy controls into reusable packages that can be attached to use cases. They serve as the bridge between your organization's governance policies and the AI systems being governed.

Listing Policy Packs

from credoai import CredoAI

client = CredoAI()

response = client.policy_packs.list(page_limit=50)
for pack in response.items:
print(f"{pack.name} (ID: {pack.id})")

Creating a Policy Pack

from credoai import CredoAI, PolicyPackCreate

client = CredoAI()

pack = client.policy_packs.create(
data=PolicyPackCreate(
name="Data Quality Standards",
)
)
print(f"Created: {pack.id}")

Getting a Policy Pack

pack = client.policy_packs.get(policy_pack_id="pp_abc123")
print(f"Name: {pack.name}")

Updating a Policy Pack

from credoai import PolicyPackUpdate

updated = client.policy_packs.update(
policy_pack_id="pp_abc123",
data=PolicyPackUpdate(name="Updated Policy Pack"),
)

Deleting a Policy Pack

client.policy_packs.delete(policy_pack_id="pp_abc123")

Duplicating a Policy Pack

Create a copy of an existing policy pack with a new key:

from credoai import PolicyPackDuplicate

copy = client.policy_packs.duplicate(
policy_pack_id="pp_abc123",
data=PolicyPackDuplicate(name="Copy of Data Quality Standards"),
)
print(f"Duplicated: {copy.id}")

Attaching to Use Cases

Policy packs can be attached to use cases via the fluent API:

from credoai import PolicyPackAttachment

use_case = client.use_cases("uc_abc123")

# List attached policy packs
packs = use_case.policy_packs.list()
for pack in packs.items:
print(f" - {pack.name}")

# Attach a policy pack
fetched = client.policy_packs.get("pp_abc123")
use_case.policy_packs.add(fetched)

# Remove a policy pack
use_case.policy_packs.remove("pp_abc123")

Next Steps

  • Learn about Risks to understand risk types and scenarios
  • Explore Workflow for governance stage management
  • See the full API Reference for all available methods