feat(langgraph): server-announced subagent identity - #869
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
blove
enabled auto-merge (squash)
August 30, 2026 14:38
The tools:<uuid> namespace a child graph streams under is a checkpoint id assigned independently of the parent's call_* tool-call id — nothing on the wire links them (#864 established this and chose to refuse guessing under ambiguity, at the cost of empty cards for parallel fan-out). But the server KNOWS both halves. Probed live: inside the @tool body, config metadata carries checkpoint_ns (= the exact stream namespace, verified matching on the wire) and InjectedToolCallId provides the call id. threadplane-middleware 0.0.2 adds announce_subagent(config, tool_call_id): one custom event {type: 'threadplane.subagent_binding', namespace, tool_call_id}, emitted via get_stream_writer, safely no-op outside a run. @threadplane/langgraph recognizes it: bindChildStream() maps the namespace authoritatively, replays any chunks buffered before the binding arrived, and never overrides an established mapping. The event is consumed as protocol chatter, not forwarded to customEvents(). The ladder and the single-candidate fallback remain for graphs that don't announce. cockpit/chat/subagents adopts it with a ~20-line inline emitter (cockpit standalone rule; comment points at the canonical middleware helper). Verified: - wire: 3 binding events, every stream namespace bound to a real call id - live model in Chrome: all three cards populate on their own call ids - lib 346/346 — incl. the case #864 left unattributed (two children, reverse arrival order) now resolving exactly via bindings, with the pre-binding chunk replayed from the buffer - middleware 42/42 under the CI-exact uv flow; e2e 1/1; lint 0 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
blove
force-pushed
the
blove/subagent-binding-events
branch
from
August 30, 2026 16:19
6af8c1e to
6c583da
Compare
Contributor
This was referenced Aug 30, 2026
blove
added a commit
that referenced
this pull request
Aug 30, 2026
The subagent-binding mechanism shipped across three packages (#869, middleware 0.0.2, @threadplane/langgraph 0.0.62) and two demos, but the subgraphs guide still described only the heuristic story. New section documents the three attribution tiers in preference order — server-announced binding, description ladder, single-candidate positional fallback — with the three-line `announce_subagent` tool change and its no-guarding-needed contract. Placed between "Subagent stream details" and "Orchestrator pattern", where the reader has just met SubagentStreamRef and is about to wire dispatch. One renderer correction along the way: `<Tip>` is a cockpit-guide component, not a website-docs one — prerender failed until it became `<Callout>`. Verified: website build green, suite 347/347. Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes the gap #864 deliberately left open. That PR established there's no wire-level link between a child's
tools:<uuid>namespace and itscall_*tool-call id, and chose to refuse guessing under ambiguity — correct, but it means parallel fan-out shows empty cards forever.The server knows both halves
Probed live before designing anything: inside the
@toolbody,config.metadata.checkpoint_nsis the exact namespace the child will stream under (verified matching on the wire, three for three), andInjectedToolCallIdprovides thecall_*id. The client can't derive the link; the server can announce it.The mechanism
threadplane-middleware0.0.2 addsannounce_subagent(config, tool_call_id)— emits one custom event:{"type": "threadplane.subagent_binding", "namespace": "tools:<uuid>", "tool_call_id": "call_…"}Safely no-ops outside a run (no writer, no namespace, no id) so callers never guard it.
@threadplane/langgraphrecognizes the event:bindChildStream()maps the namespace authoritatively, replays any chunks buffered before the binding arrived (the #847 buffer doing double duty), and never overrides an established mapping. The event is consumed as protocol chatter — it doesn't leak intocustomEvents(). The description ladder and single-candidate fallback are untouched, so graphs that don't announce keep exactly today's behavior.cockpit/chat/subagentsadopts it via a ~20-line inline emitter per the cockpit standalone rule, with a comment pointing at the canonical middleware helper.Verification
call_*id, run settled.uvflow (venv →pip install -e '.[test]'→ pytest). One false start: I addedlanggraphto the test extra before noticing it's already a runtime dep — reverted, so theuv.lockdiff is exactly the version bump.cockpit-chat-subagents1/1; lint 0 errors.After merge
threadplane-middleware0.0.2 — the publish workflow is deliberately manual (workflow_dispatch, dry-run default). Until then the demo's inline emitter keeps everything working; nothing depends on the unpublished version.@threadplane/langgraphpatch release (0.0.62) to ship the client half.announce_subagentinexamples/chatonce 0.0.2 is on PyPI.🤖 Generated with Claude Code