Skip to main content

kohala

Official Python client for the Kohala API — build, govern, run, and monetize AI agents. Zero third-party dependencies (standard library only). Every call is metered server-side; the client adds no tracking.

Install

pip install kohala

Requires Python 3.8+.

Quick start

import os

from kohala import Kohala

# Read the key from the environment — never hardcode or commit a pk_ key.
kohala = Kohala(api_key=os.environ["KOHALA_API_KEY"])

# List your agents
agents = kohala.agents.list()

# Create one
agent = kohala.agents.create(
    name="Weekly digest",
    charter="Summarize this week's activity and publish a Koan.",
    industry="software",
    enabled=True,
)

# Trigger a run now (returns as soon as it's queued)
kohala.runs.trigger(agent["id"])

# Read run history
runs = kohala.runs.list(agent["id"], limit=10)

# Build a Koan embed URL for an iframe
src = kohala.koans.embed_url("my-koan-slug", view="detail")

Configuration

Kohala(
    api_key=os.environ["KOHALA_API_KEY"],  # required — keep it out of source control
    base_url="https://kohala.ai",  # optional (default)
    timeout=30.0,                  # optional (seconds)
)

Resources

  • kohala.agents — CRUD plus health, get_quota/set_quota, skills, koans, reports, deployments.

  • kohala.runslist, get, trigger, retry.

  • kohala.workflowslist, get, create, update, delete, list_runs, run, get_run.

  • kohala.koansget, embed_url.

  • kohala.userscreate(email, password, tier="personal", team_name=None) (POST /api/v1/users): programmatically create a personal- or business-tier account. Requires the superuser-granted "Can create users" flag on the key's account (ungranted callers get 403). Created accounts are born verified — no verification email — and can log in immediately. Business tier requires team_name and creates a new team with the user as its first member; Circle tier is invitation-only and not creatable.

    created = kohala.users.create(
        email="new.hire@example.com",
        password="s3cure-pass",
        tier="business",
        team_name="Acme Coffee Co.",
    )
    

For anything else on the documented /api/v1 surface, kohala.request(method, path, query=..., body=...) calls the endpoint directly with the same pk_ key. Note the key's scope: it authenticates the management API only — session-only account surfaces (profile, billing settings, key management) are not reachable with a pk_ key and stay in the workspace UI.

Mobile & Lani chat API

This client covers the pk_-key /api/v1 surface. The cookie-free Mobile API (mk_ bearer tokens) — Lani chat, including document & image attachments with server-side content extraction (POST /api/lani-meta/attachments, attachmentIds on message sends (JSON wire names are camelCase), per-message attachments arrays, and auth-gated downloads) — is a plain REST surface authenticated per device, so call it with any HTTP client. Full reference: kohala.ai/platform/api.

Errors

Non-2xx responses raise KohalaError with .status, .code, .details, and .request_id:

from kohala import KohalaError

try:
    kohala.agents.get(999)
except KohalaError as err:
    if err.status == 404:
        ...  # handle not found

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kohala-0.3.3.tar.gz (10.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kohala-0.3.3-py3-none-any.whl (12.9 kB view details)

Uploaded Python 3

File details

Details for the file kohala-0.3.3.tar.gz.

File metadata

  • Download URL: kohala-0.3.3.tar.gz
  • Upload date:
  • Size: 10.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for kohala-0.3.3.tar.gz
Algorithm Hash digest
SHA256 95523a9f6a9ba7b09987217cedd3438916e3d83ff256e19de0e2f3b89b6fc83d
MD5 dcf331ca73ef555b090aec9b74a25eef
BLAKE2b-256 96bea74ca23ecd0ea1776683192fa7957a92ec94cb7d09fcbaa569bc43b2797c

See more details on using hashes here.

File details

Details for the file kohala-0.3.3-py3-none-any.whl.

File metadata

  • Download URL: kohala-0.3.3-py3-none-any.whl
  • Upload date:
  • Size: 12.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for kohala-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 95d0d5942adc23e02b87bcc490ce6e8dca00cb9d2c9e56e54aef2024b97b2ac2
MD5 916f24022a5747d48935a44bb021ec01
BLAKE2b-256 d6eb6fd8a37886239e7d3c6ebe124e00dd20f6c608f14f16a1084b119404f0f3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page