Back to catalog / Agent artifacts
Store large agent-generated files as versioned artifacts
Store reports, charts, or files as binary artifacts while keeping only the name and version in model context.
Goal
Avoid repeatedly placing large files in prompts while supporting retrieval by session and version.
Steps
- Choose an artifact service backend and define app, user, and session isolation. [artifact]
- Save the Part in a tool with
await ctx.save_artifact(filename, part)instead of returning a large payload as text. [artifact] - Return the filename and version; use
await ctx.load_artifact(filename, version=n)to fetch that version on demand. [artifact] - Set size, type, retention, and deletion rules to prevent indefinite storage. [artifact]
How to verify
After storage, only an artifact reference appears in model context; retrieval matches the selected version.
Troubleshooting
If content is truncated, check MIME type and Part format; if versions mismatch, pass and verify the version explicitly.
Permissions
Prerequisites
- Python 3.11+, google-adk compatible with the pinned revision, and an isolated test environment
- Configure InMemoryArtifactService for tests or a persistent artifact service
Permissions
- Use authorized test data only; isolate sessions and credentials per user; obtain human authorization before external side effects
Limitations
This procedure follows Google ADK at the pinned revision; other versions, models, or remote services may differ in APIs and event semantics. Recheck permissions, retention, and recovery before production.
Pinned upstream source
- Repository
- google/adk-python
- File path
- docs/guides/artifacts/artifact_service/index.md
- Pinned commit
e9b74d36140f2594b24c481fb7a3825b2cb01e96- Source checked
- 2026-10-14 · Reviewed against the pinned upstream source
Repository metrics
These values describe the upstream repository, not popularity or likes for an individual skill or playbook.
- Stars
- Not collected
- Forks
- Not collected
- Observed at
- Not collected
No metrics snapshot is available yet.
License: Apache-2.0
Main topic
Turn ecommerce campaign materials into a reviewable weekly brief