symfonic.capabilities.delegation.composition¶
composition ¶
Children as agents, assembled into one capability.
The generated sub_agents.py builds each child through the compatibility
facade, with a template persona, a config-tree model and a shared metrics
argument that only that facade accepts. Four dependencies for "this agent has
a helper".
(This module names none of those types, and not for brevity: this package forbids even mentioning the facade in its source, on the rule that a capability which type-checks a child against it is not extracted. The rule is text-based and that is deliberate -- a package that may not depend on something is clearest when it may not say it either.)
Everything needed to do it kernel-natively already exists, and none of it is
one call: :class:DelegationCapability takes a roster, tools, a lifecycle, a
context and a depth policy. Assembling those five correctly is not something a
scaffold template should be teaching, and a template that got it subtly wrong
would teach the wrong thing to everyone who copied it.
A child is anything with async run. Structural rather than nominal, so
symfonic.Agent qualifies without delegation importing it -- and so a test
double or an adapter can stand in without inheriting anything.
Observability is not here. The scaffold rolls child cost up through the facade's own metrics argument; the kernel-native answer belongs to the observability slice, and inventing a channel here would put a second one beside whatever that slice lands, with both partly wired and neither authoritative.
child_roster ¶
child_roster(children: Sequence[Any], *, scope: Any = None, context: Any = None) -> DelegationRoster
The roster children form, refusing a duplicate name.
A duplicate is a tool the model cannot address unambiguously. Refused here rather than resolved by last-wins, because last-wins leaves the deployment's list and the model's palette disagreeing with nothing to say so.
Source code in src/symfonic/capabilities/delegation/composition.py
delegated_children ¶
delegated_children(children: Sequence[Any], *, max_depth: int = DEFAULT_MAX_DEPTH, scope: Any = None) -> DelegationCapability
One capability that offers children as tools the model may call.
Raises:
| Type | Description |
|---|---|
ValueError
|
if |
An empty roster is refused because the capability would contribute a tool that can call nobody: the model is told it may delegate, every attempt fails, and it reads as a runtime fault rather than as a deployment with no children.