Skip to content

feat(pipeline): subagent_registry slot + credential propagation to sub-agents#201

Merged
CocoRoF merged 1 commit into
mainfrom
feat/llm-backend/d3-pipeline-subagent
May 17, 2026
Merged

feat(pipeline): subagent_registry slot + credential propagation to sub-agents#201
CocoRoF merged 1 commit into
mainfrom
feat/llm-backend/d3-pipeline-subagent

Conversation

@CocoRoF
Copy link
Copy Markdown
Owner

@CocoRoF CocoRoF commented May 17, 2026

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

  • `Pipeline._subagent_registry` slot. Settable via either:
    • `Pipeline.from_manifest{,_async}(subagent_registry=...)`
    • `Pipeline.attach_runtime(subagent_registry=...)`
  • `_wire_subagent_orchestrator(registry)` helper rebuilds the agent stage's orchestrator with the registry as a constructor arg.
  • `PipelineState.subagent_registry` slot, populated by `_init_state`.

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

  • `tests/unit/test_subagent_credential_propagation.py` (NEW) — 8 cases.
  • Full repo: 3229 passed, 8 skipped, 0 failed.

Plan reference: `docs/llm-backend-upgrade-plan/07_rollout_phases.md` (Phase D3).

…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>
@CocoRoF CocoRoF merged commit 2a41f53 into main May 17, 2026
1 check passed
@CocoRoF CocoRoF deleted the feat/llm-backend/d3-pipeline-subagent branch May 17, 2026 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant