Skip to main content

kontiki-ai

LLM run service for Kontiki.

It mutualises model calls for mesh clients: admit a run, call a provider (via LiteLLM), optionally execute allowlisted mesh RPCs as tools, then publish a terminal event on the same session. No durable jobs, no tools in the client payload — tool policy is the profile in service config.

┌─────────────┐  publish ai.run.requested                  ┌────────────┐
│  mesh       │ ─────────────────────────────────────────► │ kontiki-ai │──► LLM
│  clients    │ ◄── ai.run.completed | ai.run.failed       │            │◄── tools
└─────────────┘                                            └────────────┘
                                                              │
                                                              ▼
                                                         Messenger.call
                                                         (allowlisted RPC)

Service name: kontiki-ai. Framework options (kontiki.*) are documented with Kontiki. Restart the service after a YAML change. An invalid config fails at startup.

Image Kontiki
ghcr.io/kontiki-org/kontiki-ai:0.5.0 ==2.7.0

Call

Open a session, publish on it, and handle both terminal events with in_session=True. ref comes back on the terminal when the request carried one. Several runs can share one session; ref tells them apart. If either process stops, that session is gone: open another.

session = await self.messenger.open_session("kontiki-ai")
await session.publish(
    "ai.run.requested",
    {
        "ref": "stock-1",
        "profile": "ops_agent",
        "instructions": "How many units of SKU-9 are in stock?",
        "input": {"sku": "SKU-9"},
    },
)
@on_event("ai.run.completed", in_session=True)
async def on_completed(self, payload):
    ...

@on_event("ai.run.failed", in_session=True)
async def on_failed(self, payload):
    ...
Event Fields
ai.run.requested input (required). ref, profile, instructions, response_schema optional.
ai.run.completed result. ref when the request had one.
ai.run.failed code, message. ref when the request had one.

profile selects app.ai.profiles. Omitted, the run uses default_profile. input is sent to the model as the user message. With response_schema, result is JSON matching that schema. Without it, result is the model text.

Failure codes

Code Meaning
PROFILE_UNKNOWN Unknown profile name.
TOOL_UNRESOLVED An allowlisted RPC is missing from the Registry catalogue.
MAX_TOOL_CALLS The tool-call budget is spent.
MAX_RUN_SECONDS The wall-clock budget is spent.
RESPONSE_SCHEMA_INVALID The model output does not match response_schema.
RUN_FAILED The provider failed, or another unexpected error.

TOOL_NOT_ALLOWED and INVALID_ARGUMENT are tool results sent back to the model. The run continues. TOOL_NOT_ALLOWED does not count toward max_tool_calls.

app.ai

Key Default Description
app.ai.default_profile (required) Profile used when the request omits profile.
app.ai.profiles (required) Map of profile name → profile.

app.ai.profiles.<name>

Key Default Description
model (required) Model id. With base_url, the id sent to that endpoint. Without it, a LiteLLM model id (gpt-4o, …).
base_url unset OpenAI-compatible API base, such as http://127.0.0.1:11434/v1. Unset routes through LiteLLM.
api_key unset Bearer token. With base_url, unset sends a placeholder key. Without base_url, a set key is passed to LiteLLM; unset leaves LiteLLM on its own credentials.
tools [] Allowlist of mesh RPCs offered to the model. Empty means a model call with no tools.
max_tool_calls (required) Counted tool invocations in one run. 0 rejects the first tool call.
max_run_seconds (required) Wall-clock budget for the run, in seconds.

app.ai.profiles.<name>.tools[]

Key Default Description
service (required) Mesh service name.
rpc (required) RPC method on that service.
description unset Text shown to the model. Unset uses the Registry docstring, or service.rpc when the docstring is empty.

At the start of a run, kontiki-ai reads the Registry catalogue once and resolves each allowlisted RPC. The tool name is service.rpc. Only @rpc entrypoints are tools. Arguments are checked against the Registry schema before the mesh call. A name outside the allowlist returns TOOL_NOT_ALLOWED and does not call the mesh. Invalid arguments return INVALID_ARGUMENT and do not call the mesh. An RPC client error is returned to the model and counts. An RPC server error fails the run with RUN_FAILED.

app:
  ai:
    default_profile: local
    profiles:
      local:
        model: qwen2.5
        base_url: http://127.0.0.1:11434/v1
        api_key: null
        tools: []
        max_tool_calls: 0
        max_run_seconds: 60
      ops_agent:
        model: qwen2.5
        base_url: http://127.0.0.1:11434/v1
        api_key: null
        max_tool_calls: 8
        max_run_seconds: 120
        tools:
          - service: inventory
            rpc: get_stock
            description: Agent-facing stock lookup
          - service: orders
            rpc: get_order
            description: null

Install

pip install kontiki-ai

The package version is the image tag. After install the command is kontiki-ai.

Run

The image does not choose the broker URL. Pass it with --config.

docker run --rm \
  -v "$PWD/config:/config:ro" \
  ghcr.io/kontiki-org/kontiki-ai:0.5.0 \
  --config /config/kontiki-ai.yaml

From a checkout:

poetry run kontiki-ai --config config/kontiki-ai.yaml

License: Apache-2.0.

Metadata

Release files for kontiki-ai 0.5.0

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

Built distribution (wheel)

Table of built distributions (wheels) for kontiki-ai 0.5.0
File Interpreter ABI Platform Actions
kontiki_ai-0.5.0-py3-none-any.whl Python 3 none any Details for kontiki_ai-0.5.0-py3-none-any.whl

Release files / kontiki_ai-0.5.0-py3-none-any.whl

Download URL kontiki_ai-0.5.0-py3-none-any.whl
Size 12.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
57c7c57fc784188566c1e76f9d176f350ef17c7988d76c805e05666508055a51
BLAKE2b-256 checksum
How to use checksums
a94c99a9b443ad82284efcdc70d5c49bb1b1ea41e9551e6171f1448aae95c8e6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 5, 2026.

Transparency log

Security for kontiki-ai 0.5.0

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.

Full provenance

1 file in this release has been uploaded with provenance metadata.

Attestation for kontiki_ai-0.5.0-py3-none-any.whl

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 5, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release

0.5.0 This release

1 release file Full provenance

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