Platform Labels

Create workspace-level labels and attach them to issues for categorisation

Colour-coded labels organise platform issues by type, priority, or team โ€” attach them from an agent or the SDK.

python
import os
from praisonaiagents import Agent
from praisonai_platform.client import PlatformClient

agent = Agent(
    name="label-manager",
    instructions="Categorise issues with workspace labels (bug, feature, urgent).",
)

async with PlatformClient(
    os.getenv("PLATFORM_URL", "http://localhost:8000"),
    token=os.getenv("PLATFORM_TOKEN"),
) as client:
    label = await client.create_label("ws-123", name="bug", color="#dc2626")
    await client.add_label_to_issue("ws-123", "issue-456", label["id"])

The user asks to triage issues; the agent creates labels and attaches them on the platform.

Diagram

๐Ÿค– Agent

๐Ÿ“ฆ PlatformClient

๐Ÿท๏ธ Create Label

๐Ÿ”— Attach to Issue

๐Ÿ“Š Organised Issues

Quick Start

  1. Simple Usage

    Create a label and attach it to an issue:

    python
    import os
    import asyncio
    from praisonai_platform.client import PlatformClient
    
    async def tag_issue():
        async with PlatformClient(
            os.getenv("PLATFORM_URL", "http://localhost:8000"),
            token=os.getenv("PLATFORM_TOKEN"),
        ) as client:
            label = await client.create_label(
                "ws-123",
                name="bug",
                color="#dc2626",
            )
            await client.add_label_to_issue("ws-123", "issue-456", label["id"])
    
    asyncio.run(tag_issue())
  2. With Configuration

    List labels, update colours, and remove labels from issues:

    python
    import os
    import asyncio
    from praisonai_platform.client import PlatformClient
    
    async def manage_labels():
        async with PlatformClient(
            os.getenv("PLATFORM_URL", "http://localhost:8000"),
            token=os.getenv("PLATFORM_TOKEN"),
        ) as client:
            labels = await client.list_labels("ws-123")
            await client.update_label("ws-123", labels[0]["id"], color="#991b1b")
            await client.remove_label_from_issue("ws-123", "issue-456", labels[0]["id"])
    
    asyncio.run(manage_labels())

How It Works

Diagram
DBAPIPlatformClientAgentDBAPIPlatformClientAgentcreate_label()POST /workspaces/{id}/labelsstore labeladd_label_to_issue()POST /issues/{id}/labels/{label_id}success
ComponentPurpose
LabelsReusable, workspace-scoped tags with hex colours
Issue linksMany-to-many โ€” one issue can carry several labels
PlatformClientAsync CRUD for labels and issue attachments

Configuration Options

FieldTypeDefaultDescription
namestrโ€”Label name (unique per workspace)
colorstr#6B7280Hex colour for UI display
descriptionstrNoneOptional label description

Best Practices

Use semantic colours

Keep colours consistent โ€” red for bugs, green for features, orange for urgent items.

Limit label sprawl

Aim for 10โ€“20 labels per workspace; use prefixes like type: or priority: when needed.

Read tokens from the environment

Use os.getenv("PLATFORM_TOKEN") โ€” never hardcode JWT values in source.

Batch with a context manager

Reuse one PlatformClient session when tagging many issues in a loop.


Related