pub struct Artifact {
pub id: Uuid,
pub session_id: Option<Uuid>,
pub name: String,
pub content_type: String,
pub data: Vec<u8>,
pub metadata: Value,
pub created_at: DateTime<Utc>,
}Expand description
Binary artifact stored by the agent runtime, such as files, images, or attachments.
Fields§
§id: UuidUnique artifact identifier.
session_id: Option<Uuid>Optional session association.
name: StringHuman-readable artifact name.
content_type: StringMIME content type.
data: Vec<u8>Raw binary data.
metadata: ValueApplication-specific metadata.
created_at: DateTime<Utc>When the artifact was created.
Implementations§
Source§impl Artifact
impl Artifact
Sourcepub fn new(
name: impl Into<String>,
content_type: impl Into<String>,
data: Vec<u8>,
) -> Self
pub fn new( name: impl Into<String>, content_type: impl Into<String>, data: Vec<u8>, ) -> Self
Creates a new artifact with a generated UUIDv7 ID and current timestamp.
session_id and metadata are initialized to None and Value::Null respectively.
Sourcepub fn with_session(self, session_id: Uuid) -> Self
pub fn with_session(self, session_id: Uuid) -> Self
Associates this artifact with a session, consuming and returning self.
Sourcepub fn with_metadata(self, metadata: Value) -> Self
pub fn with_metadata(self, metadata: Value) -> Self
Sets metadata on the artifact, consuming and returning self.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Artifact
impl<'de> Deserialize<'de> for Artifact
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
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
Mutably borrows from an owned value. Read more