Skip to main content

Tarko Agent UI Python SDK

Python SDK for serving @tarko/agent-ui-builder static assets.

Quick Start

pip install tarko-agent-ui
# Or with uv
uv add tarko-agent-ui
# Create app.py
from fastapi import FastAPI
from fastapi.responses import HTMLResponse
from tarko_agent_ui import get_agent_ui_html

app = FastAPI()

@app.get("/")
def home():
    return HTMLResponse(get_agent_ui_html(
        base_url="http://localhost:8000/api"
    ))

# Run: uvicorn app:app
# Visit: http://localhost:8000

That's it! You now have a fully functional Agent UI.

Configuration

Customize your Agent UI with the ui_config parameter:

get_agent_ui_html(
    base_url="http://localhost:8000/api",  # Your agent API endpoint
    ui_config={
        "title": "My Agent",
        "logo": "https://example.com/logo.png",
        "subtitle": "AI assistant for your needs",
        "welcomePrompts": [
            "What can you help me with?",
            "Tell me about your capabilities",
            "Show me an example"
        ]
    }
)

Environment Variables

Use environment variables for flexible deployment:

AGENT_BASE_URL=http://my-agent.com/api python app.py
import os
from tarko_agent_ui import get_agent_ui_html

base_url = os.getenv("AGENT_BASE_URL", "http://localhost:8000/api")
html = get_agent_ui_html(base_url=base_url)

Framework Examples

FastAPI (click to expand)
from fastapi import FastAPI
from fastapi.responses import HTMLResponse
from tarko_agent_ui import get_agent_ui_html

app = FastAPI()

@app.get("/", response_class=HTMLResponse)
async def root():
    return HTMLResponse(get_agent_ui_html(
        base_url="http://localhost:8000/api",
        ui_config={"title": "FastAPI Agent"}
    ))
Flask (click to expand)
from flask import Flask
from tarko_agent_ui import get_agent_ui_html

app = Flask(__name__)

@app.route('/')
def root():
    return get_agent_ui_html(
        base_url="http://localhost:5000/api",
        ui_config={"title": "Flask Agent"}
    )
Django (click to expand)
# views.py
from django.http import HttpResponse
from tarko_agent_ui import get_agent_ui_html

def home(request):
    html = get_agent_ui_html(
        base_url="http://localhost:8000/api",
        ui_config={"title": "Django Agent"}
    )
    return HttpResponse(html)

Complete Example

See examples/fastapi_server.py for a production-ready FastAPI server with:

  • Comprehensive UI configuration
  • Error handling
  • Environment variable support
# Try the example
git clone https://github.com/agent-infra/tarko-agent-ui-python.git
cd tarko-agent-ui-python
uv sync
python examples/fastapi_server.py

API Reference

get_agent_ui_html(base_url, ui_config=None) ⭐

Returns configured Agent UI HTML content with injected environment variables.

Parameters:

  • base_url (str): Agent API base URL
  • ui_config (dict, optional): UI configuration object

Returns: Complete HTML string ready for serving

Note: This is the recommended approach - no need to mount static files!

get_static_path() (Advanced)

Returns absolute path to bundled static assets.

Use case: Only needed if you want to serve static files separately (e.g., for custom routing or CDN setup).

How It Works

  1. Zero Dependencies: Pure Python package with no external dependencies
  2. Pre-bundled Assets: Static assets are included with the package
  3. Framework Agnostic: Returns HTML strings that work with any Python web framework
  4. No Runtime Downloads: Everything works offline after installation

Backend Integration

To connect your Agent backend, implement the Agent API Protocol (documentation coming soon).

Requirements

  • Python 3.8+
  • Any Python web framework (FastAPI, Flask, Django, etc.)

Metadata

Release files for tarko-agent-ui 0.3.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tarko-agent-ui 0.3.5
File Size Uploaded Provenance Actions
tarko_agent_ui-0.3.5.tar.gz 1.6 MB Without provenance Details for tarko_agent_ui-0.3.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tarko-agent-ui 0.3.5
File Interpreter ABI Platform Actions
tarko_agent_ui-0.3.5-py3-none-any.whl Python 3 none any Details for tarko_agent_ui-0.3.5-py3-none-any.whl

Total release size: 3.2 MB

Release files / tarko_agent_ui-0.3.5.tar.gz

Download URL tarko_agent_ui-0.3.5.tar.gz
Size 1.6 MB
Tags Source
SHA-256 checksum
How to use checksums
112bd06ab15d6a9a27f2f991a91e0c6493b0074da6d101f5a948ab0586f4bad1
BLAKE2b-256 checksum
How to use checksums
13089d31b6f3877bcd5ca160c65d254f8f8cdae4dfc246f2ccf6e12b423894b4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.3

Release files / tarko_agent_ui-0.3.5-py3-none-any.whl

Download URL tarko_agent_ui-0.3.5-py3-none-any.whl
Size 1.6 MB
Tags Python 3
SHA-256 checksum
How to use checksums
0d6c7cd9d4701aeab410e2223b74292deaa53e2ecf507c2a1f77fccfd3abde63
BLAKE2b-256 checksum
How to use checksums
0a1ccb30f22ab8587546baa50235f7e64abd8c2dd15fc95b2ce8263f2466b65e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.3

Security for tarko-agent-ui 0.3.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page