Installation
Sync client
RailScoreClient returns typed dataclass objects. Access scores as result.rail_score.score, result.dimension_scores["fairness"].score, etc.
Async client
AsyncRAILClient returns raw dictionaries rather than dataclasses.
Key classes
| Class | Purpose |
|---|---|
RailScoreClient | Sync client - all core methods |
AsyncRAILClient | Async client - all core methods |
RAILSession | Track quality across a conversation |
Policy | Declarative rules for score enforcement |
Rule | Individual policy rule |
RAILMiddleware | Wrap any async LLM function |
Error handling
DPDPHostedOnlyError (added in SDK 2.6.0) is raised when a hosted-only DPDP operation — such as client.dpdp.dpdp_audit() — is called against a self-hosted RAIL agent. See Python: India DPDP.What’s next
Evaluation
Sync and async eval examples.
Safe Regeneration
Auto-fix below-threshold content.
Sessions & Policy
Track quality across conversations.
India DPDP
Scan Indian PII, gate decisions, emit events, and generate evidence.
Configuration
Inspect policy, plan capabilities, and dimensions at runtime.
Integrations
Provider wrappers for OpenAI, Gemini, Anthropic.