Repository navigation
Releases
Releases · mfshiu/AgentFlow
AgentFlow 2026.10.13
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 withdispatch.workers/dispatch.queue_capacity;dispatch.mode: per_message_threadrestores the old model but is deprecated. Agent.publish()returnsTrue/Falseinstead ofNone, and still never raises for broker errors; an invalidqosraisesValueError(#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 exceeddispatch.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()returnsFalse,publish_sync()raisesMqttBackpressureError(#35).
Migration: raisemax_pending_bytesin the broker config for bursty senders. - Holon control messages,
publish_sync()requests and automatic replies are sent at QoS 1; every message carries amessage_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 withqos=1for QoS 1 end to end, and keep handlers idempotent. - Envelopes whose
versionis missing, not an integer or outside 1-3 are dropped and counted indecode_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) raiseValueErrorfromAgent.subscribe()andMqttBroker.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 runningpublish_sync()call, andpublish_sync()on a topic owned by asubscribe()handler, raiseTopicWaitCollisionError(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, orRuntimeErrorwithout a broker) instead of aTimeoutErrorafter the full timeout (RFC-002, RFC-012).
Migration: catch these as well asTimeoutError.- Automatic replies are sent only for topics with a handler registered by
subscribe(topic, topic_handler=...); a request that falls through toon_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 inlate_reply_countinstead of reachingon_message();timeout=Noneis deprecated (#21).
Migration: pass a finite timeout, and do not readtopic_returnback after the call.- Requests carry a
correlation_id, andpublish_sync()ignores replies to other requests (RFC-014, #36). Overlapping calls that share atopic_waitwith 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: falserestores the old behaviour; tuneconnect_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) raiseMqttConnectRefused, and the agent stops retrying (#17).
Migration: update broker ACLs keyed on client ids, or set theclient_idtemplate. MqttBrokerinstances are single-shot:start()on an instance that is not NEW raisesRuntimeError, and so doesstop()while STARTING;start(options, *, startup_timeout_s=None)andstop(graceful_timeout_s=5.0)are bounded and returnbool(RFC-010, RFC-011).
Migration: create a new broker for each start (the Agent already does).MqttBroker.publish()raisesMqttPublishErrorwhen the broker is not running or not connected, or when paho rejects the message, instead of returning a failedMessageInfo(RFC-012).
Migration: catchagentflow.broker.MqttPublishErrorwhen calling the broker directly;Agent.publish()handles it.MessageBroker.publish()/subscribe()take keyword-onlyqos(andretainfor publish). While disconnected,MqttBroker.subscribe()/unsubscribe()only update the registry replayed on the next CONNACK; afterstop()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()raisesRuntimeError.ProcessWorker.stop()escalates to terminate and kill after 5 + 2 + 1 s and returns the exit code;ThreadWorker.stop()returnsFalse(stateSTOP_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 explicitCONCURRENCY_TYPEemits aFutureWarning(the default will become'thread'), andagent.configlacks that key until then; messaging and data calls on a process-mode controller, which never reach the child, emit aRuntimeWarning(#9).
Migration: callstart_thread()orstart_process(), and do messaging inside the agent's hooks and handlers.
Holons
- Children re-send
register_childon every (re)connect, and parents announce themselves with a new internalparent_onlinesubject;on_register_child/on_register_parentfire once per member (#6).
Migration: in mixed-version fleets, upgrade parents (including mid-tier agents) before children. terminateis honoured only from a registered parent,register_parentonly on the child's own channel, and automatic replies are never published to holon control topics (#13).
Migration: tools that stop agents by publishing onto_child.{name}needholon.trust_unregistered_parents: true; setholon.control_secreton 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/_parentsare replaced, not mutated, when a new member registers; a raisingon_register_childno longer suppressesregister_parentoron_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 incodec.pickle_allowed_globals; protocol 0-2 payloads that contain bytes are refused (#1).
Migration: allowlist types such asdatetime.datetime, or send plain data;codec.accept_pickle: falserefuses 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}restoresstr(ex);publish_sync(..., raise_on_error=True)raisesRemoteErrorinstead of returning the error reply. agentflow.core.wrapperwas removed; it was unused, broken, and contained an unrestrictedpickle.loads(#1).
Migration: none.
Packaging
paho-mqtt>=2.0,<3is a declared dependency (#45).
Migration: replace a pinned paho-mqtt 1.x.
Added
Agent.unsubscribe(topic)andMessageBroker.unsubscribe(topic), a non-abstract no-op by default (RFC-001).agent_configis optional:Agent(name)works, and agents created without a config no longer share one default dict (#75).Agent.is_connected()and the hookson_disconnected()/on_reconnected(), run on a short-lived daemon thread;BrokerNotifier._on_disconnect(planned), non-abstract (#2).qos=onAgent.publish()/subscribe()(#4);publish_sync(..., raise_on_error=False)andRemoteErrorwithtopic,errorandreply(#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(defaultTrue),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).
dispatchconfig:workers(8), `queu...