feat(pipeline): subagent_registry slot + credential propagation to sub-agents#201
Merged
Merged
Conversation
…b-agents
Phase D3 of the LLM backend upgrade. Wires the SubagentTypeRegistry
through the pipeline so the Stage 12 orchestrator can consume it, and
ensures the parent's CredentialBundle reaches every sub-agent factory
via the SubAgentBuildContext — the final piece of the multi-provider
sub-agent chain.
Pipeline (core/pipeline.py)
- New ``_subagent_registry`` slot, settable via two channels:
- ``Pipeline.from_manifest{,_async}(subagent_registry=...)``: bind at
construction time. The new ``_wire_subagent_orchestrator`` helper
rebuilds the agent stage's orchestrator with the registry as a
constructor arg.
- ``Pipeline.attach_runtime(subagent_registry=...)``: late-bind after
construction. Same helper rebuilds the orchestrator if an agent
stage is registered.
- ``_init_state`` propagates the registry to ``state.subagent_registry``
alongside the existing ``state.credentials`` propagation from A3.
PipelineState (core/state.py)
- New ``subagent_registry`` slot mirroring the pipeline's.
Tests (tests/unit/test_subagent_credential_propagation.py, NEW)
- 8 cases: pipeline slot defaults, attach_runtime / from_manifest accept
the kwarg, _init_state populates state.subagent_registry, factory
receives parent's bundle through SubAgentBuildContext, factory can
build a real sub-pipeline via Pipeline.from_manifest reusing the
bundle, attach_runtime rewires the agent stage's orchestrator,
no-op when no agent stage is registered.
Full suite: 3229 passed, 8 skipped, 0 failed.
The sub-agent multi-provider path is now complete end-to-end:
descriptor.provider → factory builds a sub-pipeline using ctx.credentials
+ from_manifest → sub-pipeline's Stage 6 resolves the new provider via
ClientRegistry.
Plan reference: docs/llm-backend-upgrade-plan/07_rollout_phases.md (Phase D3).
Co-Authored-By: Claude Opus 4.7 (1M context) <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.
Summary
Phase D3 of the LLM backend upgrade cycle. Wires `SubagentTypeRegistry` through the pipeline and propagates the parent's `CredentialBundle` to every sub-agent factory via `SubAgentBuildContext` — the final piece of the multi-provider sub-agent chain.
What's new
End-to-end chain
`descriptor.provider` → factory(ctx) sees parent's bundle → factory calls `Pipeline.from_manifest(credentials=ctx.credentials)` → sub-pipeline's Stage 6 builds the right client via `ClientRegistry`.
Tests
Plan reference: `docs/llm-backend-upgrade-plan/07_rollout_phases.md` (Phase D3).