Skip to main content

Part of the Kontiki suite — a compact open-source stack for startups and small teams that need ops without the heavy stack.

Full suite overview → https://kontiki-org.github.io/

Ops demo → kontiki-monitor Quickstart.


Overview

Kontiki is a Python microservices framework built on AMQP (aio-pika) and asyncio.

  • Write only your business logic: Kontiki manages connections to RabbitMQ, message routing (RPC, events, sessions, broadcast), service lifecycle and configuration merge for you.
  • Design service interactions as messages: combine RPC, events, broadcast and per‑instance sessions to describe how services collaborate.
  • Configuration‑driven: merged YAML config and a unified runner (cli.run) to start services the same way in development and production.
  • Optional service registry: heartbeats, degraded state (degraded_on), and basic observability (service status, events, exceptions).
  • Testability-first API: integration helpers (kontiki.testing) are designed to make end-to-end scenarios easy to express with Behave (mock services, captured events/RPC/HTTP, synchronous test runner).

For a detailed overview of all features, see docs/features.md. For patterns that are easy to miss (registry health, flow_id, delivery modes, testing, …), see docs/advanced-features.md.


Quickstart

Install Kontiki (via pip or Poetry):

pip install kontiki

Define a simple service:

from kontiki.delegate import ServiceDelegate
from kontiki.messaging import Messenger, on_event, rpc


class MyDelegate(ServiceDelegate):
    async def setup(self):
        # init from self.container.config
        pass

    async def start(self):
        # optional: start background tasks / open connections
        pass

    async def stop(self):
        # optional: stop background tasks / close connections
        pass

    def do_something(self, x):
        # business logic
        return x * 2

    async def handle_thing(self, payload):
        # business logic
        return {"processed": payload}


class MyService:
    name = "compute-api"  # optional: if omitted, the class name "MyService" is used
    delegate = MyDelegate()
    messenger = Messenger()  # delegate: publish events, RPC to other services

    @rpc
    async def compute(self, x):
        return self.delegate.do_something(x)

    @on_event("thing_happened")
    async def on_thing(self, payload):
        result = await self.delegate.handle_thing(payload)
        await self.messenger.publish("thing_processed", result)

def run():
    cli.run(MyService, "Example Kontiki service.", version="0.1.0")

Expose it as a CLI command in pyproject.toml:

[tool.poetry.scripts]
my_service = "myapp.main:run"

Run your service:

my_service --config config.yaml

Kontiki relies on RabbitMQ. For local development and to run the examples, you can start a RabbitMQ instance via Docker with:

make run-amqp

Documentation

  • Features: docs/features.md
  • Advanced features (patterns & gotchas): docs/advanced-features.md
  • Configuration reference: docs/configuration.md
  • Example configuration: docs/kontiki-config.example.yaml
  • Contributing guidelines: CONTRIBUTING.md
  • License: LICENSE

Examples

Examples can be run via the Makefile (see targets such as run-rpc-service, run-rpc-example, run-simple-events-service, etc.).

Feature Example path
Basic RPC examples/rpc/
Simple events examples/events/simple/
Broadcast events examples/events/broadcast/
Event serialization examples/events/serialization/
Session-based events examples/events/session/
Periodic tasks examples/task/
Service registry (admin + client) examples/registry/
Heartbeats & degraded mode examples/heartbeat/
HTTP entrypoints examples/http/simple/

Suite services

Service Role
kontiki-scheduler Declarative cron on the bus — static YAML schedules publish {name}.schedule_task.requested (replaces external crontab).
kontiki-tui Terminal UI over the registry and local logs.
kontiki-monitor Fleet checks, registry signals, and host disk alerts.

Monitoring (KontikiTUI)

When services register with the Kontiki registry, you can use KontikiTUI: a small terminal UI to browse registered services, inspect registry events and exceptions, and tail log files from the terminal.

KontikiTUI — services overview

Misc

Kontiki did not come out of a naming workshop but from the album Kontiki by the band Cotton Mather.
If you enjoy vintage 4-track indie pop as much as microservices, you should check it out.

Download files

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

Source Distribution

kontiki-1.6.2.tar.gz (39.2 kB view details)

Uploaded Source

Built Distribution

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

kontiki-1.6.2-py3-none-any.whl (57.5 kB view details)

Uploaded Python 3

File details

Details for the file kontiki-1.6.2.tar.gz.

File metadata

  • Download URL: kontiki-1.6.2.tar.gz
  • Upload date:
  • Size: 39.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.2 CPython/3.13.7 Linux/6.8.0-137-generic

File hashes

Hashes for kontiki-1.6.2.tar.gz
Algorithm Hash digest
SHA256 ac37e5c4d9fdbe3a637fc41295c632ba8dea692d8995873fc1ff5cd81a53eefa
MD5 557315481dbcac04010ed522b1bd099b
BLAKE2b-256 11774372b1d99ef67e9c84a5c081086a4391450791cc5b520007b6bd251ff79a

See more details on using hashes here.

File details

Details for the file kontiki-1.6.2-py3-none-any.whl.

File metadata

  • Download URL: kontiki-1.6.2-py3-none-any.whl
  • Upload date:
  • Size: 57.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.2 CPython/3.13.7 Linux/6.8.0-137-generic

File hashes

Hashes for kontiki-1.6.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c93298b204ed97172b2d9c235f67b22ed822ec4f01e0dfd995ea86e3d2eb4b49
MD5 623d508eff331cad98457cac59692c61
BLAKE2b-256 01d222337c746656b03a521a2d5dfe2d37cb75c86bf2cd171dc9f7bf3032aea6

See more details on using hashes here.

Release history Release notifications | RSS feed

1.9.0

2 files

1.8.1

2 files

1.8.0

2 files

1.7.1

2 files

1.7.0

2 files

This release

1.6.2 This release

2 files

1.6.1

2 files

1.6.0

2 files

1.5.0

2 files

1.4.0

2 files

1.3.0

2 files

1.2.0

2 files

1.1.0

2 files

1.0.2

2 files

1.0.1

2 files

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