A hot-loading plugin microkernel for Python
Project description
uxok
Status: 0.x, pre-1.0. Functional and well-tested, but the public API is still settling and may change between releases. If you build on it now, pin to a commit and expect to adjust on upgrade.
A hot-loading plugin microkernel for building self-modifying agentic systems in Python.
Read the docs to learn more!
The docs are a WIP but I will be updating them actively: if you notice something off with them (or the code), please drop me an issue.
Installation
pip install uxok
Quick start
Basic functionality in a single script. The same program split into modules — the structure a real project uses — is in examples/getting_started/ and walked through by the Getting started tutorial. For a fuller host with hot reload and graceful shutdown, see examples/example_host/.
import asyncio
from uxok import Core, Plugin, event, hook
# Plugins are declared by subclassing `Plugin` and defining their name and what they provide in the capability metadata.
class Model(Plugin):
def __init__(self):
super().__init__(name="model", provides={"llm"})
# Methods are async so that other plugins can call them at random through capabilities.
async def reply(self, text, persona):
return f"{persona} you said '{text}'."
# Hooks are set using a decorator and can be triggered by any plugin.
@hook("persona")
async def voice(self):
return "Cheerfully:"
# Other plugins can declare dependencies on other plugins' capabilities with "requires=". This builds a dependency graph the kernel resolves for you.
class Agent(Plugin):
def __init__(self, done):
super().__init__(name="agent", requires={"llm"})
self.lines = ["hello there", "what's the weather like?"]
self.done = done
# Required capabilities are then acquired by name; the kernel hands back the provider.
async def on_start(self):
self.llm = await self.get_capability("llm") # kernel wires it up
await self.emit("turn")
# Events are subscribed to in the same fashion as hooks.
@event("turn")
async def speak(self, ev):
if not self.lines:
self.done.set()
return
line = self.lines.pop(0)
persona = await self.hook("persona", firstresult=True)
print(f"user: {line}")
print(f"agent: {await self.llm.reply(line, persona)}")
await self.emit("turn")
# The main program just opens a core and loads plugins onto it; registration order matters, providers first.
async def main():
done = asyncio.Event()
async with Core() as core: # async context manager starts/stops the kernel
await core.register_plugin(Model()) # provider first
await core.register_plugin(Agent(done))
await done.wait()
asyncio.run(main())
Features
- Hot-Loading — Add/remove/replace plugins at runtime without restart
- Capability System — Kernel-style dependency resolution with tag-based selection
- Event-Driven — Non-blocking pub/sub messaging for loose coupling
- Hook System — Priority-based extension points for pipelines
- Introspectable — Query the live plugin graph at runtime: filter by capability, hook, event, or status
- Type Safety — Full protocol-based typing with mypy support
uxok has a microkernel-style architecture: the core provides only essential primitives for building extensible, self-modifying agentic applications — event-driven communication, hook-based extension points, hot-loading plugins with lifecycle management, and capability-based dependency resolution. Everything else is a plugin you can add, remove, or swap at runtime.
Development
git clone https://github.com/hiddenfalls42/uxok.git
cd uxok
pip install -e .[dev]
pytest # Run tests
ruff check src tests examples # Lint
mypy src # Type check
Contributing
Contributions welcome!
License
MIT — see LICENSE
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file uxok-0.1.0.tar.gz.
File metadata
- Download URL: uxok-0.1.0.tar.gz
- Upload date:
- Size: 105.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c71dab786be21fce945a7fade148b25714e0de5802f9dcaf3036ae2b85d8570e
|
|
| MD5 |
0fe1cda26b1af7c7b0c5275b81f1af53
|
|
| BLAKE2b-256 |
02455cdf0a77d32d073e1bdfc7ec15afc770e9d87811134060c8dd7be913b34a
|
Provenance
The following attestation bundles were made for uxok-0.1.0.tar.gz:
Publisher:
release.yml on hiddenfalls42/uxok
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
uxok-0.1.0.tar.gz -
Subject digest:
c71dab786be21fce945a7fade148b25714e0de5802f9dcaf3036ae2b85d8570e - Sigstore transparency entry: 2075878567
- Sigstore integration time:
-
Permalink:
hiddenfalls42/uxok@5877cd64492bad5af99fdf859981ee1dedc1b329 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/hiddenfalls42
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@5877cd64492bad5af99fdf859981ee1dedc1b329 -
Trigger Event:
push
-
Statement type:
File details
Details for the file uxok-0.1.0-py3-none-any.whl.
File metadata
- Download URL: uxok-0.1.0-py3-none-any.whl
- Upload date:
- Size: 111.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
016e76bb35bad28b3b1604150ddbe3a5eeebb6fd745688c057242c73ed48667d
|
|
| MD5 |
ac1255883b9adbf16a7d91c63fd1d584
|
|
| BLAKE2b-256 |
82bf77404c339ebd932c8335f8a6c60d4e9bb313867ce2772f3a500df248d418
|
Provenance
The following attestation bundles were made for uxok-0.1.0-py3-none-any.whl:
Publisher:
release.yml on hiddenfalls42/uxok
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
uxok-0.1.0-py3-none-any.whl -
Subject digest:
016e76bb35bad28b3b1604150ddbe3a5eeebb6fd745688c057242c73ed48667d - Sigstore transparency entry: 2075878586
- Sigstore integration time:
-
Permalink:
hiddenfalls42/uxok@5877cd64492bad5af99fdf859981ee1dedc1b329 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/hiddenfalls42
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@5877cd64492bad5af99fdf859981ee1dedc1b329 -
Trigger Event:
push
-
Statement type: