#[non_exhaustive]pub struct Artifact {
pub id: ArtifactId,
pub name: Option<String>,
pub description: Option<String>,
pub parts: Vec<Part>,
pub metadata: Option<Value>,
pub extensions: Option<Vec<String>>,
}Expand description
Artifacts represent task outputs.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.id: ArtifactIdUnique identifier (e.g. UUID) for the artifact. It must be unique within a task.
name: Option<String>A human readable name for the artifact.
description: Option<String>Optional. A human readable description of the artifact.
parts: Vec<Part>The content of the artifact. Must contain at least one part.
Spec requirement: Must contain at least one element. The A2A protocol does not define behavior for empty parts lists.
Parsing treats absence as empty (ProtoJSON printers omit empty
repeated fields; the gRPC binding already decodes it that way) — the
server-side event processors drop empty-parts artifacts explicitly.
metadata: Option<Value>Optional. Metadata included with the artifact.
extensions: Option<Vec<String>>The URIs of extensions that are present or contributed to this Artifact.
Implementations§
Source§impl Artifact
impl Artifact
Sourcepub fn new(id: impl Into<ArtifactId>, parts: Vec<Part>) -> Artifact
pub fn new(id: impl Into<ArtifactId>, parts: Vec<Part>) -> Artifact
Creates a minimal Artifact with an ID and parts.
§Panics
Panics in debug builds if parts is empty. Use Artifact::validate
for fallible validation.
Sourcepub fn text(&self) -> Option<&str>
pub fn text(&self) -> Option<&str>
Returns the text of the first text Part, or None if this artifact
carries no text part.
The client-side counterpart to Message::text:
reading an agent’s textual result is the most common operation once a
task completes.
use a2a_protocol_types::artifact::Artifact;
use a2a_protocol_types::message::Part;
let artifact = Artifact::new("result", vec![Part::text("done")]);
assert_eq!(artifact.text(), Some("done"));Source§impl Artifact
impl Artifact
Sourcepub fn with_name(self, name: impl Into<String>) -> Artifact
pub fn with_name(self, name: impl Into<String>) -> Artifact
Sets the artifact’s human-readable name.
Sourcepub fn with_description(self, description: impl Into<String>) -> Artifact
pub fn with_description(self, description: impl Into<String>) -> Artifact
Sets the artifact’s description.
Sourcepub fn with_metadata(self, metadata: Value) -> Artifact
pub fn with_metadata(self, metadata: Value) -> Artifact
Sets the artifact’s metadata.
Sourcepub fn with_extensions<I, S>(self, extensions: I) -> Artifact
pub fn with_extensions<I, S>(self, extensions: I) -> Artifact
Sets the extension URIs that apply to the artifact.
Sourcepub fn unchecked(id: impl Into<ArtifactId>, parts: Vec<Part>) -> Artifact
pub fn unchecked(id: impl Into<ArtifactId>, parts: Vec<Part>) -> Artifact
An artifact with the given id and parts, whatever the parts are: unlike
Artifact::new it does not assert that there is at least one, so a
test of Artifact::validate can build the artifact it expects to be
refused.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Artifact
impl<'de> Deserialize<'de> for Artifact
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Artifact, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Artifact, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
impl Eq for Artifact
Source§impl Serialize for Artifact
impl Serialize for Artifact
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 Artifact
Auto Trait Implementations§
impl Forget for Artifact
impl Freeze for Artifact
impl Move for Artifact
impl RefUnwindSafe for Artifact
impl Send for Artifact
impl Sync for Artifact
impl Unpin for Artifact
impl UnsafeUnpin for Artifact
impl UnwindSafe for Artifact
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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>,
§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.§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§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§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].