suna/sdk
marko-kraemer ddf2d32f59 feat(admin): add user thread viewer with admin access bypass
 Features:
- Add admin portal thread viewer with pagination
- Display thread list with project names and public status
- Add clickable links to view threads via /share/{thread_id}
- Add admin bypass for accessing all threads (public and private)

🔧 Backend Refactoring:
- Consolidate admin APIs into admin_api.py and billing_admin_api.py
- Remove unused files: users_admin.py, admin/api.py
- Remove unused endpoints: user search, grant-bulk-credits, migrate-user
- Update admin thread endpoint to use share URLs

 Performance:
- Remove message_count from UserThreadSummary (optimization)
- Remove N+1 query issue in thread listing

🔒 Authorization:
- Add admin role bypass in verify_and_authorize_thread_access
- Create RLS migration (20251005160000_admin_roles_access.sql)
- Update thread_select_policy for admin access
- Update message_select_policy for admin access
- Update project_select_policy for admin access
- Update agent_runs_select_policy for admin access

💻 Frontend:
- Add Threads tab to admin user details dialog
- Add useAdminUserThreads hook with pagination
- Remove unused admin hooks (useAdminUserSearch, useAdminAdvancedSearch)
- Display thread metadata with Open button and ExternalLink icon

🗃️ Database:
- Apply RLS policies allowing admin/super_admin roles to bypass restrictions
- Admins can now view any thread, message, project, or agent_run

This enables admins to view and debug any user's threads through the
share page interface, regardless of public/private status.
2025-10-05 18:09:26 +02:00
..
example auto load builder 2025-08-14 15:16:19 -07:00
kortix feat(admin): add user thread viewer with admin access bypass 2025-10-05 18:09:26 +02:00
.gitignore Add README and update API URL in Kortix class 2025-08-01 03:30:25 +05:30
.python-version feat(sdk): restructure SDK into new directory with updated API and models 2025-07-29 00:41:33 +05:30
README.md enterprise page 2025-08-08 18:23:21 -07:00
__init__.py enterprise page 2025-08-08 18:23:21 -07:00
pyproject.toml Update dependencies and refactor KortixMCP initialization 2025-08-01 01:23:20 +05:30
uv.lock Update dependencies and refactor KortixMCP initialization 2025-08-01 01:23:20 +05:30

README.md

Kortix SDK

Python

A Python SDK that enables you to create, manage, and interact with AI Workers on Suna.

📦 Installation

Install directly from the GitHub repository:

pip install "kortix @ git+https://github.com/kortix-ai/suna.git@main#subdirectory=sdk"

Or using uv:

uv add "kortix @ git+https://github.com/kortix-ai/suna.git@main#subdirectory=sdk"

🔧 Quick Start

import asyncio
from kortix import kortix

async def main():
    mcp_tools = kortix.MCPTools(
        "http://localhost:4000/mcp/",  # Point to any HTTP MCP server
        "Kortix",
    )
    await mcp_tools.initialize()

    # Initialize the client
    client = kortix.Kortix(api_key="your-api-key")

    # Create an agent
    agent = await client.Agent.create(
        name="My Assistant",
        system_prompt="You are a helpful AI assistant.",
        mcp_tools=[mcp_tools],
        allowed_tools=["get_wind_direction"],
    )

    # Create a conversation thread
    thread = await client.Thread.create()

    # Run the agent
    run = await agent.run("Hello, how are you?", thread)

    # Stream the response
    stream = await run.get_stream()
    async for chunk in stream:
        print(chunk, end="")

if __name__ == "__main__":
    asyncio.run(main())

🔑 Environment Setup

Get your API key from https://suna.so/settings/api-keys

🧪 Running Examples

# Install dependencies
uv sync

# Run the main example
PYTHONPATH=$(pwd) uv run example/example.py