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.

For anything else, kohala.request(method, path, query=..., body=...) calls any endpoint directly.

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.1.tar.gz (9.1 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.1-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for kohala-0.3.1.tar.gz
Algorithm Hash digest
SHA256 222994259b79f1e345da7786cb817af0a33382bf4c13387e77716d2d99b9fa80
MD5 3f71f525f1d4a430807c841d0f889550
BLAKE2b-256 9010dbc609d0782668e3080f1f7418d83b90e8f0f5e0dde0666385f929d706fe

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for kohala-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8994f1587bce6a9393dc3531bb3c8876e26d606f7892b8f21413d9361cf6679c
MD5 c7b94ae9f234f64966e6de180b3edf06
BLAKE2b-256 8f69a4d2a544d03888fbd6fd9016b5350fbdf67c81d2fc3dfd72b1424d5a0f10

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