pub struct SubAgentSpawn {
pub parent_alias: String,
pub parent_policy: Arc<SecurityPolicy>,
pub parent_allowed_agent_aliases: HashSet<String>,
}Expand description
Builder for a SubAgent spawn. The caller resolves a parent agent
from the loaded config; Self::build applies any narrowing
overrides and validates the result.
Fields§
§parent_alias: String§parent_policy: Arc<SecurityPolicy>§parent_allowed_agent_aliases: HashSet<String>Implementations§
Source§impl SubAgentSpawn
impl SubAgentSpawn
Sourcepub fn for_agent(config: &Config, agent_alias: &str) -> Result<Self>
pub fn for_agent(config: &Config, agent_alias: &str) -> Result<Self>
Resolve a parent’s identity from the loaded config and an
agent alias. Returns Err when the alias does not name a
configured agent — the spawn site surfaces a structured
failure instead of invoking the agent loop on a nonexistent
identity.
Sourcepub fn build(self, overrides: SubAgentOverrides) -> Result<SubAgentContext>
pub fn build(self, overrides: SubAgentOverrides) -> Result<SubAgentContext>
Apply overrides to the parent’s permissions and return a
validated SubAgentContext. On any escalation, returns
Err with the originating violation in the error chain.
When the caller supplies a policy override, the child inherits
the parent’s PerSenderTracker so action and cost budgets are
shared between parent and SubAgent runs. Otherwise a SubAgent
could be spawned to bypass the parent’s max_actions_per_hour
or max_cost_per_day_cents ceiling by consuming from a
fresh-zeroed bucket; the inheritance closes that escape. The
no-override path already shares the bucket via
Arc<SecurityPolicy> cloning.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SubAgentSpawn
impl !RefUnwindSafe for SubAgentSpawn
impl Send for SubAgentSpawn
impl Sync for SubAgentSpawn
impl Unpin for SubAgentSpawn
impl UnsafeUnpin for SubAgentSpawn
impl !UnwindSafe for SubAgentSpawn
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more