1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
//! # adk-artifact
//!
//! Binary artifact storage for ADK agents.
//!
//! ## Overview
//!
//! This crate provides versioned artifact storage for binary data:
//!
//! - [`InMemoryArtifactService`] - Simple in-memory storage
//! - [`FileArtifactService`] - Local filesystem storage with crash-safe writes
//! - `GcsArtifactService` - Google Cloud Storage backend (feature `gcs`),
//! blob-name compatible with adk-python
//! - [`ArtifactService`] - Trait for custom backends
//! - [`ScopedArtifacts`] - Session-scoped artifact access
//!
//! Versions are immutable: a save naming an existing version fails with
//! `ErrorCategory::Conflict`, and the session id [`USER_SCOPE_SESSION_ID`] is reserved for
//! `user:` artifacts.
//!
//! ## Quick Start
//!
//! ```rust
//! use adk_artifact::{ArtifactService, InMemoryArtifactService, SaveRequest};
//! use adk_core::Part;
//!
//! # #[tokio::main(flavor = "current_thread")]
//! # async fn main() -> adk_core::Result<()> {
//! let service = InMemoryArtifactService::new();
//! let saved = service
//! .save(SaveRequest {
//! app_name: "my_app".into(),
//! user_id: "user".into(),
//! session_id: "session".into(),
//! file_name: "notes.txt".into(),
//! part: Part::text_part("hello"),
//! version: None,
//! })
//! .await?;
//! assert_eq!(saved.version, 1);
//! # Ok(())
//! # }
//! ```
//!
//! ## Use Cases
//!
//! - Store generated images, PDFs, audio
//! - Cache intermediate results
//! - Share binary data between agent turns
pub use FileArtifactService;
pub use GcsArtifactService;
pub use InMemoryArtifactService;
pub use ScopedArtifacts;
pub use ;
pub use ArtifactSubjectData;