Skip to content

Releases

AgentFlow 2026.10.13

Choose a tag to compare

@mfshiu mfshiu released this 13 Oct 16:16
465252f

2026.10.13 contains breaking changes for users of 2025.5.24 and 2025.8.22.1933. Read Breaking changes below before upgrading; coming from 2025.5.24, also read the notes under 2025.8.22.1933 in CHANGES.md.

This is the first tagged release, and the first under the MIT License.

Changes since 2025.8.22.1933: the reliability work of RFC-001 to RFC-013 (July-August 2026) and the fixes from the October 2026 audit (merged pull requests #80-#109, RFC-014 and RFC-015).

Breaking changes

Messaging

  • Handlers run on a bounded pool of 8 daemon threads with a 1024-message queue instead of one new thread per message; when the queue is full the newest message is dropped (RFC-004). publish_sync() inside a handler stays safe: replies use a lane of their own (#7).
    Migration: size it with dispatch.workers / dispatch.queue_capacity; dispatch.mode: per_message_thread restores the old model but is deprecated.
  • Agent.publish() returns True / False instead of None, and still never raises for broker errors; an invalid qos raises ValueError (#4).
    Migration: check the result where a lost message matters.
  • Payloads larger than codec.max_payload_bytes (default 16 MiB) are dropped without decoding, and received payloads waiting for a handler may not exceed dispatch.max_queued_bytes (default 256 MiB) (#34).
    Migration: raise these limits if you send larger messages.
  • MqttBroker refuses a publish once max_pending_bytes (default 64 MiB) are unsent or unacknowledged: Agent.publish() returns False, publish_sync() raises MqttBackpressureError (#35).
    Migration: raise max_pending_bytes in the broker config for bursty senders.
  • Holon control messages, publish_sync() requests and automatic replies are sent at QoS 1; every message carries a message_id, and a redelivered id (window of 4096) is dropped before any handler runs (#4).
    Migration: none for MQTT 3.1.1 brokers; subscribe services with qos=1 for QoS 1 end to end, and keep handlers idempotent.
  • Envelopes whose version is missing, not an integer or outside 1-3 are dropped and counted in decode_failure_count, as are payloads without an AgentFlow prefix, now without a traceback per message (#15).
    Migration: none for AgentFlow senders.
  • Invalid subscription filters (e.g. a+b/c, a/#/b) raise ValueError from Agent.subscribe() and MqttBroker.subscribe() before anything is registered, connected or not (#53).
    Migration: use + and # only as whole topic levels, # only last.
  • Agent.subscribe() / unsubscribe() on a topic held by a running publish_sync() call, and publish_sync() on a topic owned by a subscribe() handler, raise TopicWaitCollisionError (RFC-006, RFC-007).
    Migration: keep subscription topics and reply topics apart.

Request/reply

  • publish_sync() raises the broker's error at once (MqttPublishError, MqttBackpressureError, or RuntimeError without a broker) instead of a TimeoutError after the full timeout (RFC-002, RFC-012).
    Migration: catch these as well as TimeoutError.
  • Automatic replies are sent only for topics with a handler registered by subscribe(topic, topic_handler=...); a request that falls through to on_message() gets no reply (RFC-003).
    Migration: register an explicit handler for every request topic.
  • Replies never carry topic_return, and a handler exception no longer mutates the incoming Parcel: the error reply is a new Parcel (RFC-003).
    Migration: none, unless a handler kept its input Parcel and relied on that mutation.
  • publish_sync() no longer writes the reply topic into the caller's Parcel; a late reply on a generated reply topic is dropped and counted in late_reply_count instead of reaching on_message(); timeout=None is deprecated (#21).
    Migration: pass a finite timeout, and do not read topic_return back after the call.
  • Requests carry a correlation_id, and publish_sync() ignores replies to other requests (RFC-014, #36). Overlapping calls that share a topic_wait with a responder older than 2026.10.13 now time out rather than risk taking each other's reply.
    Migration: upgrade responders first.

MQTT broker

  • The client reconnects automatically after a connection loss (back-off 1-30 s) and restores its subscriptions; each connect attempt times out after 2 s instead of paho's 5 s (#2).
    Migration: reconnect: false restores the old behaviour; tune connect_timeout.
  • The client sends a client id, '{name}-{agent_id:.12}' by default, instead of a zero-length one; refusals that a retry cannot fix (bad credentials, not authorised, id rejected) raise MqttConnectRefused, and the agent stops retrying (#17).
    Migration: update broker ACLs keyed on client ids, or set the client_id template.
  • MqttBroker instances are single-shot: start() on an instance that is not NEW raises RuntimeError, and so does stop() while STARTING; start(options, *, startup_timeout_s=None) and stop(graceful_timeout_s=5.0) are bounded and return bool (RFC-010, RFC-011).
    Migration: create a new broker for each start (the Agent already does).
  • MqttBroker.publish() raises MqttPublishError when the broker is not running or not connected, or when paho rejects the message, instead of returning a failed MessageInfo (RFC-012).
    Migration: catch agentflow.broker.MqttPublishError when calling the broker directly; Agent.publish() handles it.
  • MessageBroker.publish() / subscribe() take keyword-only qos (and retain for publish). While disconnected, MqttBroker.subscribe() / unsubscribe() only update the registry replayed on the next CONNACK; after stop() they do nothing (RFC-005, #4).
    Migration: subclasses of the built-in brokers must accept the new keywords.

Lifecycle and workers

  • Workers are single-shot: a second start() raises RuntimeError. ProcessWorker.stop() escalates to terminate and kill after 5 + 2 + 1 s and returns the exit code; ThreadWorker.stop() returns False (state STOP_TIMEOUT) if the thread does not exit in 5 s (RFC-008, RFC-009).
    Migration: create a new Agent to run it again.
  • start() without an explicit CONCURRENCY_TYPE emits a FutureWarning (the default will become 'thread'), and agent.config lacks that key until then; messaging and data calls on a process-mode controller, which never reach the child, emit a RuntimeWarning (#9).
    Migration: call start_thread() or start_process(), and do messaging inside the agent's hooks and handlers.

Holons

  • Children re-send register_child on every (re)connect, and parents announce themselves with a new internal parent_online subject; on_register_child / on_register_parent fire once per member (#6).
    Migration: in mixed-version fleets, upgrade parents (including mid-tier agents) before children.
  • terminate is honoured only from a registered parent, register_parent only on the child's own channel, and automatic replies are never published to holon control topics (#13).
    Migration: tools that stop agents by publishing on to_child.{name} need holon.trust_unregistered_parents: true; set holon.control_secret on every agent of a holon or on none.
  • Parent messages carry the sender's parent_name; an agent drops its own echoed broadcasts and messages from senders not named like its parent, so name-addressed messages no longer reach grandchildren (#5, #38).
    Migration: none, unless you relied on that addressing.
  • _children / _parents are replaced, not mutated, when a new member registers; a raising on_register_child no longer suppresses register_parent or on_children_message (#57).
    Migration: re-read the attribute instead of keeping a reference to it.

Security

  • BinaryParcel (pickle) payloads are decoded with a restricted unpickler: plain data only, plus immutable types listed in codec.pickle_allowed_globals; protocol 0-2 payloads that contain bytes are refused (#1).
    Migration: allowlist types such as datetime.datetime, or send plain data; codec.accept_pickle: false refuses pickle entirely.
  • An automatic error reply names only the exception type, e.g. "KeyError (details are in the responder's log)" (#68).
    Migration: errors: {expose_details: true} restores str(ex); publish_sync(..., raise_on_error=True) raises RemoteError instead of returning the error reply.
  • agentflow.core.wrapper was removed; it was unused, broken, and contained an unrestricted pickle.loads (#1).
    Migration: none.

Packaging

  • paho-mqtt>=2.0,<3 is a declared dependency (#45).
    Migration: replace a pinned paho-mqtt 1.x.

Added

  • Agent.unsubscribe(topic) and MessageBroker.unsubscribe(topic), a non-abstract no-op by default (RFC-001).
  • agent_config is optional: Agent(name) works, and agents created without a config no longer share one default dict (#75).
  • Agent.is_connected() and the hooks on_disconnected() / on_reconnected(), run on a short-lived daemon thread; BrokerNotifier._on_disconnect(planned), non-abstract (#2).
  • qos= on Agent.publish() / subscribe() (#4); publish_sync(..., raise_on_error=False) and RemoteError with topic, error and reply (#68).
  • Agent counters: decode_failure_count (#15), late_reply_count (#21), publish_backpressure_count (#35).
  • Agent config sections, validated at construction (unknown keys and wrong types raise):
    • codec: accept_pickle (default True), pickle_allowed_globals ([]), max_payload_bytes (16 MiB) (#1, #34);
    • errors: expose_details (False) (#68);
    • holon: control_secret (unset; str or bytes of at least 16 bytes, signs control messages with HMAC-SHA256), control_max_age (300 s), max_children (unlimited), trust_unregistered_parents (False) (#13).
  • dispatch config: workers (8), `queu...
Read more