Installation
- uv
- pip
Quick Start
Authentication
The SDK discovers credentials in this order:- Explicit token - Pass
auth_tokento the client - Context-specific environment variable -
PRAGMA_AUTH_TOKEN_{CONTEXT}(uppercase) - Generic environment variable -
PRAGMA_AUTH_TOKEN - CLI credentials file - Tokens stored by
pragma auth login
Contexts
Contexts allow switching between environments (e.g., development, staging, production):PragmaClient
Synchronous client for the Pragmatiks API. Use as a context manager to ensure connections are closed.Constructor
Context Manager
Health Check
Get Current User
UserInfo with user_id, email, organization_id, and organization_name.
Raises: httpx.HTTPStatusError if not authenticated (401).
Resource Operations
list_resources
model is provided.
list_resource_types
provider, resource, schema, and description.
get_resource
httpx.HTTPStatusError if resource not found (404).
apply_resource
delete_resource
httpx.HTTPStatusError if resource not found (404).
Dead Letter Operations
Dead letter events are failed lifecycle events that can be retried or discarded.list_dead_letter_events
get_dead_letter_event
retry_dead_letter_event
retry_all_dead_letter_events
delete_dead_letter_event
delete_dead_letter_events
provider or all=True.
ValueError if neither provider nor all=True is specified.
Provider Deployment
Deploy custom providers to the platform.list_providers
ProviderInfo with provider_id, current_version, deployment_status, and updated_at.
list_builds
BuildInfo with provider_id, version, status, error_message, and created_at.
push_provider
PushResult with version, status, and message.
get_build_status
BuildInfo with provider_id, version, status, error_message (on failure), and created_at.
stream_build_logs
deploy_provider
ProviderStatus with status, version, updated_at, and healthy.
get_deployment_status
ProviderStatus with status, version, updated_at, and healthy.
AsyncPragmaClient
Asynchronous client with the same API asPragmaClient. All methods are async.
Async Context Manager
Streaming Build Logs (Async)
Concurrent Operations
Run multiple independent operations concurrently:Typed Responses
Use typed models for better IDE support and validation. Define models using the SDK base classes.Resource Model
Using Typed Models
Lifecycle State Enum
Dependencies
When building providers, you can declare dependencies on other resources using theDependency[T] generic. This provides typed access to the resolved dependency’s outputs.
Error Handling
The SDK raiseshttpx.HTTPStatusError for API errors. Handle common cases: