Moderately AI Python SDK
The official Python SDK for the Moderately AI platform, providing programmatic access to agents, datasets, pipelines, and team management.
Features
Python 3.8+ Support: Compatible with Python 3.8 and later versions
Type Safety: Full type annotations with mypy support
Async/Await: Built-in support for asynchronous operations
Team-scoped Operations: Automatic filtering and scoping to your team
Resource Management: Agents, datasets, pipelines, files, and users
Error Handling: Comprehensive exception handling for different error scenarios
Rate Limiting: Built-in rate limit handling and retry logic
Quick Start
Installation
pip install moderatelyai-sdk
Basic Usage
Synchronous Client
import moderatelyai_sdk
# Initialize with environment variables (recommended)
client = moderatelyai_sdk.ModeratelyAI()
# Use the client - all operations are automatically scoped to your team
users = client.users.list()
dataset = client.datasets.create(name="My Dataset")
agents = client.agents.list()
Asynchronous Client
import asyncio
import moderatelyai_sdk
async def main():
async with moderatelyai_sdk.AsyncModeratelyAI() as client:
users = await client.users.list()
dataset = await client.datasets.create(name="My Dataset")
agents = await client.agents.list()
asyncio.run(main())
Examples
Complete working examples are available in the examples directory:
File Operations - Complete file upload, download, and management workflows
Synchronous and asynchronous examples
REST API to SDK method mappings
Error handling and cleanup patterns