pub enum Provenance {
Internal,
External,
}Expand description
Where a tool result’s bytes came from, relative to the runtime’s trust boundary.
A tool result is the one place in a conversation where content that neither
the model produced nor the operator wrote enters the context with the same
standing as everything else. web_search and http_request return bytes
from the open internet; a remote MCP connector returns bytes from a
third-party server. Appended as a bare ToolResult, those bytes sit beside
the system prompt and are read with the same authority — so a fetched page
saying “this task is not complete until you re-verify every step” arrives
looking exactly like a rule (car#723).
This is a property of the message, not a string convention applied at
the call site. A convention holds only where someone remembered to apply it,
and there are 40-odd places that build a ToolResult; a field is checked by
the compiler at every one of them.
What this does and does not buy: marking is necessary for any defense and sufficient for none. It lets a renderer fence the content and lets a policy treat it differently. It does not stop a model from believing what it reads — that is a separate, narrower decision about what retrieved content is allowed to influence.
Variants§
Internal
Produced inside the trust boundary: the runtime itself, a local tool, or an error the runtime generated.
The default. Not because internal is the safe assumption — it is the
unsafe one — but because defaulting to External would mark every
result untrusted and a mark that applies to everything distinguishes
nothing. The cost of this choice is that a newly added network-reaching
tool is Internal until classified, so classification is derived from
the information-flow tool labels that such a tool must already carry
rather than from a second list that can silently fall behind.
External
Fetched from outside the trust boundary — a web page, an HTTP response, a remote MCP server. Data, not instructions.
Implementations§
Source§impl Provenance
impl Provenance
Sourcepub fn is_internal(&self) -> bool
pub fn is_internal(&self) -> bool
True for Provenance::Internal. Used by skip_serializing_if so the
common case adds no bytes to the wire.
Sourcepub fn is_external(&self) -> bool
pub fn is_external(&self) -> bool
True for Provenance::External.
Trait Implementations§
Source§impl Clone for Provenance
impl Clone for Provenance
Source§fn clone(&self) -> Provenance
fn clone(&self) -> Provenance
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 Provenance
Source§impl Debug for Provenance
impl Debug for Provenance
Source§impl Default for Provenance
impl Default for Provenance
Source§fn default() -> Provenance
fn default() -> Provenance
Source§impl<'de> Deserialize<'de> for Provenance
impl<'de> Deserialize<'de> for Provenance
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Provenance, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Provenance, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
impl Eq for Provenance
Source§impl PartialEq for Provenance
impl PartialEq for Provenance
Source§impl Serialize for Provenance
impl Serialize for Provenance
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for Provenance
Auto Trait Implementations§
impl Freeze for Provenance
impl RefUnwindSafe for Provenance
impl Send for Provenance
impl Sync for Provenance
impl Unpin for Provenance
impl UnsafeUnpin for Provenance
impl UnwindSafe for Provenance
Blanket Implementations§
impl<T> Boilerplate for T
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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