pub enum SubagentVisibility {
Attributed,
Inline,
Hidden,
}Expand description
What a consumer sees of an agent’s subagents.
Attributed — the default, and no transformer at all —
sends the stream as the agent emitted it. The other two exist because a
client older than @ag-ui/client 0.0.59 rejects the SUBAGENT_* event
types while decoding: an unknown field is tolerated, an unknown event
type is not, and there is nothing a client can do about it after the
fact. A producer with such consumers must not send them, and this is how
it does not.
Upstream’s integrations default to inline and make the full surface
opt-in. This crate defaults the other way, because a transformer that
rewrites the stream is opt-in here like every other: an agent that wrote
ctx.subagent(..) meant it, and silently flattening what it said is the
kind of surprise the design notes argue against. Flip it per endpoint when
your consumers are older:
let runner = Runner::new(MyAgent).transformer(SubagentVisibility::inline());Variants§
Attributed
The full surface: the lifecycle events, and subagentRunId on
everything a subagent produced.
Inline
The pre-subagent shape: no lifecycle events and no subagentRunId
anywhere — not on events, not on the messages inside
MESSAGES_SNAPSHOT or the RUN_STARTED input echo, not on the
interrupts a paused run reports. A subagent’s own text arrives as the
parent’s work. A *_CHUNK event that named no id is given the one its
attribution resolved to, since without the attribution the consumer
would resolve it differently.
A subagent’s steps are dropped rather than flattened. A step brackets
its own agent’s graph, and as the parent’s it would either collide
with an open step of the same name — the common shape: a parent
tools step wrapping the delegation and the child’s own tools
inside it — or misdescribe the parent’s graph. The lifecycle events
were the child’s structure; so are its steps.
Hidden
Only the parent’s own events. Everything a subagent produced is dropped — including the result of a call it requested, even when the parent executed it, since a result for a call the consumer never saw is a protocol error. The converse holds too: a result answering the parent’s call is kept, untagged, whoever executed it — the consumer saw the call, and a call left unanswered in the history is what the next request would carry back.
The one thing kept is the run’s shared state. A STATE_SNAPSHOT or
STATE_DELTA a subagent published describes the thread’s state,
not the subagent’s work: a client that never saw it would mirror a
stale state and send that back on its next request. It goes out with
the tag cleared, as the parent’s.
Implementations§
Source§impl SubagentVisibility
impl SubagentVisibility
Sourcepub fn filter(self) -> SubagentFilter
pub fn filter(self) -> SubagentFilter
The transformer for this mode. Pointless but harmless for
Attributed, which passes everything through.
Sourcepub fn inline() -> SubagentFilter
pub fn inline() -> SubagentFilter
The transformer for Inline.
The transformer for Hidden.
Trait Implementations§
Source§impl Clone for SubagentVisibility
impl Clone for SubagentVisibility
Source§fn clone(&self) -> SubagentVisibility
fn clone(&self) -> SubagentVisibility
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for SubagentVisibility
Source§impl Debug for SubagentVisibility
impl Debug for SubagentVisibility
Source§impl Default for SubagentVisibility
impl Default for SubagentVisibility
Source§fn default() -> SubagentVisibility
fn default() -> SubagentVisibility
impl Eq for SubagentVisibility
Source§impl Hash for SubagentVisibility
impl Hash for SubagentVisibility
Source§impl PartialEq for SubagentVisibility
impl PartialEq for SubagentVisibility
Source§fn eq(&self, other: &SubagentVisibility) -> bool
fn eq(&self, other: &SubagentVisibility) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for SubagentVisibility
Auto Trait Implementations§
impl Freeze for SubagentVisibility
impl RefUnwindSafe for SubagentVisibility
impl Send for SubagentVisibility
impl Sync for SubagentVisibility
impl Unpin for SubagentVisibility
impl UnsafeUnpin for SubagentVisibility
impl UnwindSafe for SubagentVisibility
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.