Working with Use Cases
Use Cases represent AI/ML applications or systems that you want to track and govern in Credo AI.
Overview
Use Cases are the primary organizational unit in Credo AI. They represent an AI system or application that you're developing, deploying, or monitoring.
Listing Use Cases
from credoai import CredoAI
client = CredoAI()
response = client.use_cases.list(page_limit=50)
for use_case in response.items:
print(f"{use_case.name} (ID: {use_case.id})")
Creating a Use Case
from credoai import CredoAI, UseCaseCreate
client = CredoAI()
use_case = client.use_cases.create(
data=UseCaseCreate(
name="Customer Churn Prediction",
description="ML model to predict customer churn probability",
)
)
print(f"Created: {use_case.id}")
Getting a Use Case
use_case = client.use_cases.get(use_case_id="uc_abc123")
print(f"Name: {use_case.name}")
Updating a Use Case
from credoai import UseCaseUpdate
updated = client.use_cases.update(
use_case_id="uc_abc123",
data=UseCaseUpdate(description="Updated description"),
)
Deleting a Use Case
client.use_cases.delete(use_case_id="uc_abc123")
Managing Relationships
Use cases can be linked to models and vendors:
from credoai import RelationshipAdd
# Add a model to a use case
client.use_case_models.add(
use_case_id="uc_abc123",
data=RelationshipAdd(id="model_xyz789"),
)
# List models for a use case
models = client.use_case_models.list(use_case_id="uc_abc123")
# Add a vendor to a use case
client.use_case_vendors.add(
use_case_id="uc_abc123",
data=RelationshipAdd(id="vendor_def456"),
)
Governance Sub-Resources
Use cases provide fluent access to governance resources via client.use_cases("uc_abc123"):
| Sub-Resource | Access | Description |
|---|---|---|
| Controls | .controls.list() | View policy controls attached to the use case |
| Policy Packs | .policy_packs.list(), .add(), .remove() | Manage attached policy packs |
| Risk Scenarios | .risk_scenarios.list(), .add(), .remove() | Manage attached risk scenarios |
| Workflow | .workflow.get(), .update(), .advance_step(), .advance_stage(), .reject() | Track governance progress |
use_case = client.use_cases("uc_abc123")
# List attached policy packs
packs = use_case.policy_packs.list()
# Check workflow status
workflow = use_case.workflow.get()
print(f"Stage: {workflow.stage}, Step: {workflow.step}")
# Advance workflow
use_case.workflow.advance_step()
See Policy Packs, Risks, and Workflow for full details.
Next Steps
- Learn about Models to track your AI models
- Explore Vendors for third-party AI management
- Understand Relationships between resources
- Manage governance with Policy Packs, Risks, and Workflow
- See the full API Reference for all available methods