Skip to main content

A simple communication framework for agents using pubsub and http

Project description

NetworkKit

A lightweight communication framework for distributed agents. Pub/sub messaging (ZeroMQ), HTTP ingress (FastAPI), built-in scheduling, and a single CLI to manage it all.

NetworkKit is the connective tissue for multi-agent systems. Agents don't need to know about each other — they just publish and subscribe to a shared bus. Chat bots, automation workflows, AI agents, hardware sensors — they all speak the same protocol. No broker setup, no YAML sprawl, no infrastructure overhead. One netkit start and you have a running message bus with scheduled tasks that everything can talk to.

Features

  • Message bus: ZeroMQ pub/sub + HTTP POST ingress
  • Scheduler: interval and cron-based message scheduling (UTC)
  • Auth: optional token-based access control
  • Config: TOML config file with env var overrides
  • CLI: netkit for daemon and schedule management
  • Persistence: schedules survive restarts

Install

pip install networkkit

Quick Start

# Start the databus
netkit start

# Check status
netkit status

# Send a message
netkit send "hello" --to agent1 --type CHAT

# Add a scheduled message (every 5 minutes)
netkit schedule add --name heartbeat --to agent1 --type CHAT --interval 5m --content "ping"

# Add a cron job (daily at 09:00 UTC)
netkit schedule add --name daily-check --to agent1 --type CHAT --cron "0 9 * * *" --content "daily review"

# List schedules
netkit schedule list

# Trigger a schedule now
netkit schedule run heartbeat

# Remove a schedule
netkit schedule remove heartbeat

# View logs
netkit log -n 50

# Stop
netkit stop

Configuration

Config file is searched in order:

  1. $NETWORKKIT_CONFIG env var
  2. ./networkkit.toml
  3. ~/.config/networkkit/networkkit.toml
[server]
host = "0.0.0.0"
port = 8000
zmq_port = 5555
# auth_token = "your-secret-token"
data_dir = "~/.local/share/networkkit"
log_level = "INFO"

All settings can be overridden with env vars: NETWORKKIT_HOST, NETWORKKIT_PORT, NETWORKKIT_ZMQ_PORT, NETWORKKIT_AUTH_TOKEN, NETWORKKIT_DATA_DIR, NETWORKKIT_LOG_LEVEL.

Message Types

Type Description
CHAT Conversational message
SYSTEM System/infrastructure message
INFO Non-conversational notification
SENSOR Sensor data
HELO Availability check
ACK Availability response
ERROR Error notification

API Endpoints

All endpoints accept an optional X-NetworkKit-Token header when auth is enabled.

Method Path Description
POST /data Publish a message to the bus
GET /schedules List all schedules
POST /schedules Create/update a schedule
DELETE /schedules/{name} Remove a schedule
POST /schedules/{name}/run Trigger a schedule immediately

Message format

{
  "source": "agent1",
  "to": "agent2",
  "content": "hello",
  "message_type": "CHAT"
}

Schedule format

{
  "name": "heartbeat",
  "to": "agent1",
  "message_type": "CHAT",
  "content": "ping",
  "interval": "5m",
  "enabled": true
}

Interval supports: 30s, 5m, 1h, 1d or raw seconds. Cron uses standard 5-field UTC expressions (minute hour day month weekday, 0=Sunday).

Python API

from networkkit.messages import Message, MessageType
from networkkit.network import HTTPMessageSender, ZMQMessageReceiver

# Send a message
sender = HTTPMessageSender(publish_address="http://127.0.0.1:8000")
await sender.send_message(Message(
    source="agent1", to="agent2",
    content="hello", message_type=MessageType.CHAT,
))

# Subscribe to messages
class MySubscriber:
    name = "agent2"
    def is_intended_for_me(self, message): return message.to in (self.name, "ALL")
    async def handle_message(self, message): print(message.content)

receiver = ZMQMessageReceiver(subscribe_address="tcp://127.0.0.1:5555")
receiver.register_subscriber(MySubscriber())
await receiver.start()

Runtime Files

  • Config: ~/.config/networkkit/networkkit.toml
  • Schedules: ~/.local/share/networkkit/schedules.json
  • PID: ~/.local/share/networkkit/databus.pid
  • Log: ~/.local/share/networkkit/databus.log

License

Apache-2.0

Project details


Download files

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

Source Distribution

networkkit-0.1.2.tar.gz (16.2 kB view details)

Uploaded Source

Built Distribution

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

networkkit-0.1.2-py3-none-any.whl (17.4 kB view details)

Uploaded Python 3

File details

Details for the file networkkit-0.1.2.tar.gz.

File metadata

  • Download URL: networkkit-0.1.2.tar.gz
  • Upload date:
  • Size: 16.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for networkkit-0.1.2.tar.gz
Algorithm Hash digest
SHA256 389b5a3b61f66fead76b4a9a78218b73ea2217f3ddca47bbfa3891f8cf23b4e9
MD5 23448428f6be238552155dbd25b63bc5
BLAKE2b-256 9c7d85f060f1f1119767fd513554f139a93ab5472c34eef77af68618f07de1bf

See more details on using hashes here.

Provenance

The following attestation bundles were made for networkkit-0.1.2.tar.gz:

Publisher: release.yaml on japanvik/networkkit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file networkkit-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: networkkit-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 17.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for networkkit-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 eb610fe6203bf873f64d3fb979a9c0d9001306b31462eb797e60abedd315ccac
MD5 18ebc3be9d5b1679a9094bc644949523
BLAKE2b-256 a98347607c9e61b5a382229ad16f3549ab5812bc8d86fbe1753e29dfd3ff31bd

See more details on using hashes here.

Provenance

The following attestation bundles were made for networkkit-0.1.2-py3-none-any.whl:

Publisher: release.yaml on japanvik/networkkit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page