Upgrade: Cloudflare sub-agent entries go through a Durable Object RPC method
@helix-agents/runtime-cloudflare (major): a parent Durable Object starts and resumes its sub-agents and companions through DurableObjectAgentBase.subAgentEntry, a Durable Object RPC method. A sub-agent's parent, root and consult come from that entry only.
What to do
Use compatibility date
2024-04-03or later, or add therpccompatibility flag:tomlcompatibility_date = "2024-04-03" # or, on an older date: compatibility_flags = ["nodejs_compat", "rpc"]On an older date without the flag, a child entry is refused
framework_not_supportedbefore anything is sent.A custom
subAgentNamespace, or a wrapper of one (tracing, metrics, a test fake), must also forwardsubAgentEntry. A wrapper that forwards onlyfetchgets the same typed refusal:tsget: (id) => { const s = ns.get(id); return { fetch: (i, init) => s.fetch(i, init), subAgentEntry: (r) => s.subAgentEntry(r) }; },A namespace from
env(the Durable Object binding itself) needs no change.
What else changed
- A sub-agent's parent, root and consult come from
subAgentEntryonly. A/subagent/:type/startor/resumethat reaches a Durable Object through itsfetch(the remote-agent worker handler, or an app's own route) names no parent, root or consult: a new session is a root session in this service, and itsbindingis kept. A native/startis the same. Such an entry into an existing session enters it as it is, with its stored parent and root. - An entry into an existing session must match the session's parent and root. One that names another parent or root (including a parent on a root session) is refused
state_child_session_taken(409). Nothing is written. - An app's auth hook decides who may create or enter a session with a given id.
- A parent's abort bounds its wait for a child entry; it does not cancel the child's entry.
@helix-agents/runtime-js(minor):execute()onto an existing session whoseparentSessionId/rootSessionId(or binding parent) differs from the session's is refusedstate_child_session_takenbefore anything is written.