Quickstart
A quick example to get you started with the pycredoai SDK.
Setup
pip install pycredoai
Set your environment variables:
export CREDOAI_API_KEY="your-api-key"
export CREDOAI_TENANT="your-tenant"
Hello World
from credoai import CredoAI, UseCaseCreate
# Initialize the client
client = CredoAI()
# Verify connection
ping = client.system.ping()
print(f"Connected: {ping.message}")
# Create a use case
use_case = client.use_cases.create(
data=UseCaseCreate(
name="My First Use Case",
description="Created via the SDK"
)
)
print(f"Created: {use_case.name} (ID: {use_case.id})")
# List all use cases
for uc in client.use_cases.list_all():
print(f" - {uc.name}")
# Clean up
client.use_cases.delete(use_case_id=use_case.id)
print("Deleted use case")
What's Next?
Now that you have the basics working:
- Learn about Use Cases, Models, and Vendors
- Understand Relationships between resources
- Master Pagination for large datasets
- Handle Errors gracefully
- Use Async Operations for better performance