15 releases
Uses new Rust 2024
| new 0.3.2 | Feb 21, 2026 |
|---|---|
| 0.3.1 | Feb 15, 2026 |
| 0.2.1 | Jan 22, 2026 |
| 0.1.9 | Jan 3, 2026 |
| 0.1.1 | Nov 30, 2025 |
#2531 in Asynchronous
207 downloads per month
Used in 6 crates
(4 directly)
105KB
2K
SLoC
adk-artifact
Binary artifact storage for Rust Agent Development Kit (ADK-Rust) agents.
Overview
adk-artifact provides binary data storage for the Rust Agent Development Kit (ADK-Rust):
- InMemoryArtifactService - Simple in-memory artifact storage
- ArtifactService - Trait for custom storage backends
- ScopedArtifacts - Session-scoped artifact access
- Versioning - Multiple versions per artifact
Artifacts are useful for storing images, documents, audio, and other binary data that agents produce or consume.
Installation
[dependencies]
adk-artifact = "0.3.2"
Or use the meta-crate:
[dependencies]
adk-rust = { version = "0.3.2", features = ["artifacts"] }
Quick Start
use adk_artifact::{InMemoryArtifactService, ArtifactService, SaveRequest, LoadRequest};
use adk_core::Part;
// Create artifact service
let service = InMemoryArtifactService::new();
// Store an artifact
let response = service.save(SaveRequest {
app_name: "my_app".to_string(),
user_id: "user_123".to_string(),
session_id: "session_456".to_string(),
file_name: "report.pdf".to_string(),
part: Part::InlineData {
mime_type: "application/pdf".to_string(),
data: pdf_bytes,
},
version: None, // Auto-increment
}).await?;
println!("Saved as version: {}", response.version);
// Retrieve artifact
let response = service.load(LoadRequest {
app_name: "my_app".to_string(),
user_id: "user_123".to_string(),
session_id: "session_456".to_string(),
file_name: "report.pdf".to_string(),
version: None, // Latest version
}).await?;
Use with LoadArtifactsTool
Artifacts integrate with agents via LoadArtifactsTool:
use adk_tool::LoadArtifactsTool;
let tool = LoadArtifactsTool::new();
let agent = LlmAgentBuilder::new("assistant")
.tool(Arc::new(tool))
.build()?;
The LLM can then call this tool to load artifacts by name into the conversation.
Features
- Async storage and retrieval
- Automatic MIME type detection
- Version history support
- Thread-safe concurrent access
- User-scoped artifacts (use
user:prefix for cross-session access)
Related Crates
License
Apache-2.0
Part of ADK-Rust
This crate is part of the ADK-Rust framework for building AI agents in Rust.
Dependencies
~4.5–6.5MB
~112K SLoC