Documentation Index Fetch the complete documentation index at: https://docs.praison.ai/llms.txt
Use this file to discover all available pages before exploring further.
Platform Python SDK provides clean public API exports for seamless integration with PraisonAI Platform features.
Quick Start
Simple Import
from praisonai_platform import PlatformClient , create_app
# Create FastAPI app
app = create_app ()
# Use HTTP client
async with PlatformClient ( " http://localhost:8000 " ) as client :
await client . register ( " user@example.com " , " password " )
With Authentication
from praisonai_platform import PlatformClient
# Client with token
client = PlatformClient (
base_url = " http://localhost:8000 " ,
token = " your-jwt-token "
)
workspaces = await client . list_workspaces ()
How It Works
Component Purpose Usage create_app()FastAPI factory Server deployment PlatformClientHTTP client API integration __version__Package version Version checking
API Exports
The package exports three main components:
create_app
PlatformClient
Version Info
from praisonai_platform import create_app
# Create FastAPI application instance
app = create_app ()
# Run with uvicorn
if __name__ == " __main__ " :
import uvicorn
uvicorn . run ( app , host = " 0.0.0.0 " , port = 8000 )
from praisonai_platform import PlatformClient
# Initialize client
client = PlatformClient ( " http://localhost:8000 " )
# Authenticate
await client . register ( " user@example.com " , " pass " )
# Create workspace
workspace = await client . create_workspace ( " My Team " )
# Create issue
issue = await client . create_issue (
workspace_id = workspace [ " id " ],
title = " Bug Report " ,
description = " System crashes on startup "
)
from praisonai_platform import __version__
print ( f "Platform SDK version: { __version__ } " )
# Output: Platform SDK version: 0.1.0
Client Features
Authentication Register, login, and manage JWT tokens
Workspaces Multi-tenant workspace management
Issues Issue tracking and project management
Agents AI agent lifecycle management
Common Patterns
Server Deployment
from praisonai_platform import create_app
def deploy_server ():
""" Deploy Platform API server """
app = create_app ()
# Add custom middleware if needed
# app.add_middleware(...)
return app
# For production
app = deploy_server ()
SDK Integration
from praisonai_platform import PlatformClient
class AgentWorkflow :
def __init__ ( self , platform_url : str , token : str ):
self . client = PlatformClient ( platform_url , token )
async def setup_workspace ( self ):
""" Create workspace and project """
workspace = await self . client . create_workspace ( " AI Project " )
project = await self . client . create_project (
workspace [ " id " ],
" Agent Tasks "
)
return workspace , project
Version Checking
from praisonai_platform import __version__
import sys
def check_compatibility ():
""" Ensure compatible Platform SDK version """
required = " 0.1.0 "
if __version__ < required :
sys . exit ( f "Platform SDK { required } + required, got { __version__ } " )
Best Practices
Always use async context managers for HTTP clients to ensure proper cleanup: async with PlatformClient ( " http://localhost:8000 " ) as client :
workspaces = await client . list_workspaces ()
# Client automatically closes
Store and reuse JWT tokens for multiple requests: client = PlatformClient ( " http://localhost:8000 " )
auth_data = await client . register ( " user@example.com " , " pass " )
# Token is automatically stored in client._token
Wrap API calls in try-catch for HTTP errors: try :
workspace = await client . create_workspace ( " Duplicate Name " )
except httpx . HTTPStatusError as e :
if e . response . status_code == 409 :
print ( " Workspace name already exists " )
Environment Configuration
Use environment variables for configuration: import os
from praisonai_platform import PlatformClient
client = PlatformClient (
base_url = os . getenv ( " PLATFORM_URL " , " http://localhost:8000 " ),
token = os . getenv ( " PLATFORM_TOKEN " )
)
Platform Architecture Complete Platform SDK reference
Authentication Guide JWT token management