Skip to main content
PlatformClient gives agents and scripts full CRUD access to workspaces, issues, labels, and agents over the Platform API.
import os
from praisonaiagents import Agent
from praisonai_platform.client import PlatformClient

agent = Agent(
    name="platform-bot",
    instructions="Track and update workspace issues.",
)

async with PlatformClient(
    os.getenv("PLATFORM_URL", "http://localhost:8000"),
    token=os.getenv("PLATFORM_TOKEN"),
) as client:
    workspace = await client.create_workspace("My Team")
    issue = await client.create_issue(workspace["id"], "Fix login bug")
The user tracks bugs; the agent uses PlatformClient to log and update workspace issues.

Quick Start

1

Simple Usage

pip install praisonai-platform
import asyncio
from praisonai_platform.client import PlatformClient

async def main():
    async with PlatformClient("http://localhost:8000") as client:
        await client.register("user@example.com", "password123")
        workspace = await client.create_workspace("My Team")
        project = await client.create_project(workspace["id"], "Sprint 1")
        await client.create_issue(
            workspace["id"],
            "Fix login bug",
            project_id=project["id"],
        )

asyncio.run(main())
2

With Configuration

Pass an existing token and batch related calls in one session:
import os
import asyncio
from praisonai_platform.client import PlatformClient

async def setup_workspace():
    client = PlatformClient(
        os.getenv("PLATFORM_URL", "http://localhost:8000"),
        token=os.getenv("PLATFORM_TOKEN"),
    )
    workspace = await client.create_workspace("Dev Team")
    await client.add_member(workspace["id"], "user-456", role="admin")
    await client.create_project(workspace["id"], "Q1 Sprint")

asyncio.run(setup_workspace())

How It Works

PatternWhen to use
Context managerMultiple API calls — reuses connections
Standalone clientSingle request with a known token

API Areas

AreaKey methods
Authregister, login, get_me
Workspacescreate_workspace, list_workspaces, add_member
Projectscreate_project, list_projects, get_project_stats
Issuescreate_issue, list_issues, update_issue
Commentsadd_comment, list_comments
Agentscreate_agent, list_agents, update_agent
Labelscreate_label, add_label_to_issue, list_issue_labels
Dependenciescreate_dependency, list_dependencies
See Platform SDK Client for endpoint-level detail.

Error Handling

import httpx
from praisonai_platform.client import PlatformClient

try:
    async with PlatformClient("http://localhost:8000") as client:
        await client.get_workspace("invalid-id")
except httpx.HTTPStatusError as e:
    if e.response.status_code == 404:
        print("Workspace not found")
    elif e.response.status_code == 401:
        print("Authentication required")

Best Practices

Keep related calls inside one async with PlatformClient(...) block.
Call register() or login() once; the client stores the JWT for later requests.
Pass workspace_id on every resource method — RBAC enforces membership.
Use os.getenv("PLATFORM_URL") and os.getenv("PLATFORM_TOKEN") in production.

Platform SDK Reference

REST endpoints and request schemas

Platform Client SDK Testing

Integration tests with ASGITransport