pub struct Artifact {
pub id: ArtifactId,
pub name: Option<String>,
pub description: Option<String>,
pub parts: Vec<Part>,
pub extensions: Option<Vec<String>>,
pub metadata: Option<Value>,
}Expand description
An output artifact produced by an agent.
Each artifact has a unique ArtifactId and carries its content as a
non-empty list of Part values.
Fields§
§id: ArtifactIdUnique artifact identifier.
name: Option<String>Optional human-readable name.
description: Option<String>Optional human-readable description.
parts: Vec<Part>Content parts.
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.
extensions: Option<Vec<String>>URIs of extensions used in this artifact.
metadata: Option<Value>Arbitrary metadata.
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"));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 Freeze 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§
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<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.Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request