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 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.2.tar.gz (9.2 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.2-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: kohala-0.3.2.tar.gz
  • Upload date:
  • Size: 9.2 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.2.tar.gz
Algorithm Hash digest
SHA256 28a65a5f34f1e07929d986cb651f38d9709ec2e3a3c7cfde6a1e9d72dcc6500d
MD5 23b62f0fe974bbf737d7b4017d5d9bdb
BLAKE2b-256 094e1041a916c126d400886947ac92cfe171ca5abe7d124af781fbe887eb9cee

See more details on using hashes here.

File details

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

File metadata

  • Download URL: kohala-0.3.2-py3-none-any.whl
  • Upload date:
  • Size: 11.4 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7e3844e3d1e7f2045bf10f9059d61a6c8bab34ad187295c3ac061921da2f2569
MD5 ba290adddfa205bed373ae42136ff25c
BLAKE2b-256 1a82425ab9a95d5d44afda247f80d050f19c01e5fcf587fa9d336917054893f8

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