ktx/python/ktx-daemon
semantic-release-bot a6dd8cf730 chore(release): 0.16.0 [skip ci]
## [0.16.0](https://github.com/Kaelio/ktx/compare/v0.15.0...v0.16.0) (2026-07-03)

### Features

* Add duckdb connector ([#308](https://github.com/Kaelio/ktx/issues/308)) ([3c4fcc2](3c4fcc27c7))
* **athena:** first-class AWS Athena warehouse identity (SL + BI mapping) ([#332](https://github.com/Kaelio/ktx/issues/332)) ([f310391](f310391da5))
* **connector:** add Amazon Athena connector via Glue Data Catalog ([#309](https://github.com/Kaelio/ktx/issues/309)) ([fe7e6bd](fe7e6bd1fa))
* query_policy semantic-layer-only restricts agents to predefined semantic-layer measures ([#334](https://github.com/Kaelio/ktx/issues/334)) ([a651b82](a651b82e2f))

### Bug Fixes

* **deps:** patch 22 Dependabot security alerts ([#328](https://github.com/Kaelio/ktx/issues/328)) ([6d01030](6d01030745))
* **sl:** classify semantic-query request rejections as expected, not faults ([#339](https://github.com/Kaelio/ktx/issues/339)) ([a0d19ba](a0d19ba26f))
* **sl:** correct reserved-word/week-grain SQL and classify sl_query errors ([#340](https://github.com/Kaelio/ktx/issues/340)) ([4ebce75](4ebce75449))
* **telemetry:** classify daemon query rejections as expected, not faults ([#335](https://github.com/Kaelio/ktx/issues/335)) ([5d17469](5d17469601))

### Documentation

* reflect recently added connectors in ingestion diagram and README ([#333](https://github.com/Kaelio/ktx/issues/333)) ([66768fe](66768fe009))
2026-07-03 21:22:57 +00:00
..
src/ktx_daemon fix(sl): classify semantic-query request rejections as expected, not faults (#339) 2026-07-03 23:17:33 +02:00
tests fix(sl): classify semantic-query request rejections as expected, not faults (#339) 2026-07-03 23:17:33 +02:00
pyproject.toml chore(release): 0.16.0 [skip ci] 2026-07-03 21:22:57 +00:00
README.md refactor: enforce ktx naming and AGENTS.md compliance sweep (#289) 2026-06-11 13:49:45 +02:00

ktx-daemon

ktx-daemon is the portable Python compute package for ktx.

It supports portable compute in two modes:

  • One-shot commands, used by default by the @kaelio/ktx CLI.
  • An explicit HTTP server for long-running local MCP sessions.

One-shot semantic query

printf '%s\n' '{"sources":[],"query":{"measures":[],"dimensions":[]},"dialect":"postgres"}' \
  | ktx-daemon semantic-query

One-shot source generation

Generate semantic-layer sources from schema scan data:

printf '%s\n' '{"tables":[{"name":"orders","db":"public","columns":[{"name":"id","type":"integer","primary_key":true}]}],"links":[],"dialect":"postgres"}' \
  | ktx-daemon semantic-generate-sources

One-shot database introspection

Introspect a Postgres database schema:

printf '%s\n' '{"connection_id":"warehouse","driver":"postgres","url":"postgresql://readonly@example.test/warehouse","schemas":["public"]}' \
  | ktx-daemon database-introspect

One-shot LookML parsing

Parse LookML projects into resolved, KSL-ready structures:

printf '%s\n' '{"files":[{"path":"views/orders.view.lkml","content":"view: orders { sql_table_name: public.orders ;; measure: order_count { type: count } }"}],"dialect":"postgres"}' \
  | ktx-daemon lookml-parse

One-shot embeddings

Compute text embeddings locally:

printf '%s\n' '{"text":"hello"}' \
  | ktx-daemon embedding-compute

Compute text embeddings locally in bulk:

printf '%s\n' '{"texts":["hello","world"]}' \
  | ktx-daemon embedding-compute-bulk

One-shot code execution

Execute Python code with the current in-process boundary:

printf '%s\n' '{"code":"result = 1 + 2"}' \
  | ktx-daemon code-execute

HTTP compute server

Start the HTTP compute server with code execution disabled:

ktx-daemon serve-http --host 127.0.0.1 --port 8765

Enable HTTP code execution explicitly:

ktx-daemon serve-http --host 127.0.0.1 --port 8765 --enable-code-execution

Available HTTP endpoints:

  • GET /health
  • POST /database/introspect
  • POST /embeddings/compute
  • POST /embeddings/compute-bulk
  • POST /lookml/parse
  • POST /semantic-layer/generate-sources
  • POST /semantic-layer/query
  • POST /semantic-layer/validate
  • POST /code/execute when --enable-code-execution is passed

The HTTP server exposes Postgres database introspection, LookML parsing, local embedding compute, and semantic-layer compute for source generation, query compilation, and validation. Code execution is off by default. When enabled, it runs Python exec in the daemon process with the same in-process boundary as the one-shot code-execute command and does not provide OS-level sandboxing.

HTTP code execution uses the standalone ktx boundary. It does not forward caller authorization headers to a host app and does not connect scratchpad or visualization helpers to host application APIs.