Skip to main content

SpawnPayload

Struct SpawnPayload 

Source
pub struct SpawnPayload {
Show 15 fields pub instruction: String, pub output_contract: Option<String>, pub context_seed: Vec<SeedMessage>, pub intelligence: IntelConfig, pub mcp_servers: Vec<McpServerSpec>, pub a2a_peers: Vec<A2aPeerSpec>, pub tls_ca: Option<String>, pub aauth: Option<AAuthSettings>, pub gated_tools: Vec<String>, pub limits: Limits, pub telemetry: Telemetry, pub depth: u32, pub warm: bool, pub role: Role, pub turn: Option<Box<TurnSpec>>,
}
Expand description

Everything a subagent needs to run, minted by the supervisor. The child takes none of these fields from its own request — depth in particular is derived by the supervisor from the caller’s handle, so a child cannot claim a shallower depth to buy itself more levels of delegation.

Fields§

§instruction: String

The task. For a delegated child this is the parent’s instruction argument; see also output_contract.

§output_contract: Option<String>

Objective, required output format, and boundaries — a real delegation contract rather than a bare string, so the child’s result can be checked against something.

§context_seed: Vec<SeedMessage>

The narrowed context the parent chose to share — never the parent’s full transcript. Passing only what the child needs keeps its context clean and stops a prompt injection landed in the parent from riding down the tree.

§intelligence: IntelConfig

How to reach the LLM (env/flag-sourced; never logged).

§mcp_servers: Vec<McpServerSpec>

The child’s scoped MCP server subset. Always a subset of the parent’s, because scope narrows monotonically down the tree: no child may reach a server its parent could not.

§a2a_peers: Vec<A2aPeerSpec>

Declared remote-A2A delegation peers. Inherited by children like mcp_servers so a subagent can also delegate over A2A; the a2a.delegate self-tool dials these. #[serde(default)] so a frame that omits the field — the common case, with no peers configured — parses to an empty list.

§tls_ca: Option<String>

Extra PEM CA file path for outbound TLS trust (--tls-ca, the private/in-cluster PKI anchor). PUBLIC material — a path to a CA certificate, never key bytes — so it may ride the payload. The child installs it process-wide before its first dial, so no dial can escape the anchor, and passes it on to its own children. #[serde(default)] so a frame that omits it parses as “no extra anchor”.

§aauth: Option<AAuthSettings>

AAuth agent-identity settings, inherited by every subagent so the whole process tree signs MCP requests under ONE identity — a peer sees the tree as a single agent rather than a crowd of anonymous processes. The key file is a shared-fs path, like tls_ca, and no secret rides here: the enrollment token stays a {{secret:…}} template resolved in the child. #[serde(default)] so a frame that omits it parses as “no identity”.

§gated_tools: Vec<String>

Tool names this child must NOT call directly, routing them up to the supervisor instead.

A subagent connects to its granted MCP servers itself and calls their tools without the supervisor ever seeing the call, which would put every security.policies rule out of reach for exactly the caller the operator is most likely to be narrowing. A policy table that covered root turns but not subagent turns would be worse than none, because the operator would believe they were covered — so the supervisor names the tools a rule might touch and the child round-trips those through the existing ToolRequest channel. Everything else keeps its direct connection.

This is a grant the supervisor makes, not a promise the child keeps: a gated tool is still refused parent-side if the child ignores the list, because the parent evaluates the policy when the request arrives.

§limits: Limits§telemetry: Telemetry§depth: u32

Supervisor-minted tree depth (0 = root).

§warm: bool

Run as a warm continue-session: after each turn, stay alive and wait for the next injected event (ControlMsg::Inject) instead of exiting, continuing the same transcript so the agent keeps its memory of earlier events. Default (false) is a one-shot run per event, which starts each event from a clean context. #[serde(default)] so a frame that omits it parses as one-shot.

§role: Role

The child’s role. agent (default) runs the ReAct loop on instruction or drives a workflow; turn is a turn worker driven by turn below. #[serde(default)] so a frame that omits it parses as agent.

§turn: Option<Box<TurnSpec>>

The turn worker’s input (role: turn).

Implementations§

Source§

impl SpawnPayload

Source

pub fn narrow_tools(&mut self, allow: &[String])

Narrow this child’s tool grant to allow. Any allow-list entry already in the seed is dropped first, so the SUPERVISOR’s mint is the only grant the child sees — a caller-supplied context array cannot forge or widen one. An empty allow is a real narrowing to nothing, not “no narrowing”; leave the marker off entirely for the unnarrowed case.

Source

pub fn allowed_tools(&self) -> Option<Vec<String>>

The narrowed grant this payload carries (None = unnarrowed: the full catalogue the granted servers publish). Reads back what SpawnPayload::narrow_tools minted — including after a restore, which re-spawns from the stored payload.

Trait Implementations§

Source§

impl Clone for SpawnPayload

Source§

fn clone(&self) -> SpawnPayload

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SpawnPayload

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for SpawnPayload

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for SpawnPayload

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more