Outbound routing, chunking, and delivery planning for multi-channel AI systems
Project description
nodus-delivery
Outbound routing, chunking, and delivery planning for multi-channel AI systems.
Resolves the right channel adapter for a response, splits long content into
channel-appropriate chunks, and delivers each chunk in order. Depends on
nodus-channels for the
ChannelRegistry and ChannelAdapter protocol.
Status: v0.1.0 — prepared, not yet published.
Install
pip install nodus-delivery
Requires nodus-channels>=0.1.0.
What it provides
| Component | Purpose |
|---|---|
DeliveryPlan |
Describes where and how to send a response |
SizeChunker |
Split at word boundaries up to a max character count |
ParagraphChunker |
Split on paragraph breaks, respecting a max size |
MarkdownBlockChunker |
Preserve code blocks and headers across splits |
strip_markdown |
Remove markdown formatting → plain text |
DeliveryRouter |
Resolve adapter, chunk, and send; build plan from inbound message |
Quick start
from nodus_channels import ChannelRegistry
from nodus_delivery import DeliveryRouter, DeliveryPlan, SizeChunker
registry = ChannelRegistry()
registry.register(my_slack_adapter)
router = DeliveryRouter(registry, default_chunker=SizeChunker(max_chars=2000))
plan = DeliveryPlan(
channel_id="slack",
peer_id="U123",
content="A very long response that may need chunking...",
)
await router.deliver(plan)
DeliveryPlan
from nodus_delivery import DeliveryPlan
plan = DeliveryPlan(
channel_id="slack",
peer_id="U123",
content="Response text",
thread_id="T456", # optional: reply in a thread
reply_to_id="M789", # optional: reply to a specific message
strip_md=False, # strip markdown before chunking (default False)
chunker=None, # override router's default chunker
)
Chunking strategies
SizeChunker
Splits at word boundaries. Safe for any channel.
from nodus_delivery import SizeChunker
chunker = SizeChunker(max_chars=2000)
chunks = chunker.chunk("Long text...") # list[str]
ParagraphChunker
Splits on \n\n paragraph breaks first; falls back to size if a paragraph
exceeds max_chars.
from nodus_delivery import ParagraphChunker
chunker = ParagraphChunker(max_chars=2000)
MarkdownBlockChunker
Keeps code fences (```) and headers (#, ##) intact. Never splits
inside a code block.
from nodus_delivery import MarkdownBlockChunker
chunker = MarkdownBlockChunker(max_chars=2000)
DeliveryRouter
from nodus_delivery import DeliveryRouter
router = DeliveryRouter(
registry,
default_chunker=ParagraphChunker(max_chars=2000),
)
# Build a plan from an inbound Message (replies to sender on same channel)
plan = router.plan_from_message(inbound_message, content="Here is my response.")
# Deliver — sends all chunks in order, returns list of message IDs
msg_ids = await router.deliver(plan)
If no adapter is registered for channel_id, deliver raises KeyError.
strip_markdown
from nodus_delivery import strip_markdown
plain = strip_markdown("**bold** and `code` and [link](url)")
# → "bold and code and link"
Useful when delivering to channels that don't render markdown (e.g., SMS, voice).
Design
- One required dependency:
nodus-channelsforChannelRegistry,ChannelAdapter, andMessagetypes. - Protocol-based chunking. Any callable satisfying
ChunkStrategy(chunk(text) -> list[str]) works — no inheritance needed. - Async delivery.
DeliveryRouter.deliver()is async; each chunk is awaited in sequence to preserve ordering.
Development
pip install -e ".[dev]"
# Also install nodus-channels for tests:
pip install -e "C:/dev/nodus-channels"
pytest tests/ -q
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 nodus_delivery-0.1.0.tar.gz.
File metadata
- Download URL: nodus_delivery-0.1.0.tar.gz
- Upload date:
- Size: 9.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e4093dc432e480678e28cef1fd01bd425b874790e27c7ed5dcd0265a22268c76
|
|
| MD5 |
253e279c42f0921b63e1b7bd27ab002c
|
|
| BLAKE2b-256 |
f619289937580be351d91dc1e7a9f79961c38d17b9c33f14d43e365f416ddb1d
|
File details
Details for the file nodus_delivery-0.1.0-py3-none-any.whl.
File metadata
- Download URL: nodus_delivery-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6543297ef1a16e60412def43220892b11f6aa15d70cefbe8258c5d7318a3cb21
|
|
| MD5 |
541f142106a9845c560414267271f3ff
|
|
| BLAKE2b-256 |
786e2bcfa35dc55531972ffa1b50521202608069790d96ab4bfe843cbed60aa8
|