Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions docs/artifacts/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ Understanding artifacts involves grasping a few key components: the service that
* `Load Artifact`: Retrieves a specific version (or the latest) of an artifact.
* `List Artifact keys`: Lists the unique filenames of artifacts within a given scope.
* `Delete Artifact`: Removes an artifact (and potentially all its versions, depending on implementation).
* `List versions`: Lists all available version numbers for a specific artifact filename.
* `list_artifact_versions`: Lists all versions and their metadata for a specific artifact.
* `get_artifact_version`: Gets the metadata for a specific version of an artifact.

* **Configuration:** You provide an instance of an artifact service (e.g., `InMemoryArtifactService`, `GcsArtifactService`) when initializing the `Runner`. The `Runner` then makes this service available to agents and tools via the `InvocationContext`.

Expand Down Expand Up @@ -176,7 +177,7 @@ Understanding artifacts involves grasping a few key components: the service that

=== "Python"

```python
```py
import google.genai.types as types

# Example: Creating an artifact Part from raw bytes
Expand Down Expand Up @@ -227,7 +228,7 @@ Understanding artifacts involves grasping a few key components: the service that

=== "Python"

```python
```py
# Example illustrating namespace difference (conceptual)

# Session-specific artifact filename
Expand Down Expand Up @@ -279,7 +280,7 @@ Before you can use any artifact methods via the context objects, you **must** pr

In Python, you provide this instance when initializing your `Runner`.

```python
```py
from google.adk.runners import Runner
from google.adk.artifacts import InMemoryArtifactService # Or GcsArtifactService
from google.adk.agents import LlmAgent
Expand Down Expand Up @@ -344,7 +345,7 @@ The artifact interaction methods are available directly on instances of `Callbac

=== "Python"

```python
```py
import google.genai.types as types
from google.adk.agents.callback_context import CallbackContext # Or ToolContext

Expand Down Expand Up @@ -414,7 +415,7 @@ The artifact interaction methods are available directly on instances of `Callbac

=== "Python"

```python
```py
import google.genai.types as types
from google.adk.agents.callback_context import CallbackContext # Or ToolContext

Expand Down Expand Up @@ -544,7 +545,7 @@ The artifact interaction methods are available directly on instances of `Callbac

=== "Python"

```python
```py
from google.adk.tools.tool_context import ToolContext

def list_user_files_py(tool_context: ToolContext) -> str:
Expand Down Expand Up @@ -670,7 +671,7 @@ ADK provides concrete implementations of the `BaseArtifactService` interface, of

=== "Python"

```python
```py
from google.adk.artifacts import InMemoryArtifactService

# Simply instantiate the class
Expand Down Expand Up @@ -720,7 +721,7 @@ ADK provides concrete implementations of the `BaseArtifactService` interface, of

=== "Python"

```python
```py
from google.adk.artifacts import GcsArtifactService

# Specify the GCS bucket name
Expand Down Expand Up @@ -766,4 +767,4 @@ To use artifacts effectively and maintainably:
* **Cleanup Strategy:** For persistent storage like `GcsArtifactService`, artifacts remain until explicitly deleted. If artifacts represent temporary data or have a limited lifespan, implement a strategy for cleanup. This might involve:
* Using GCS lifecycle policies on the bucket.
* Building specific tools or administrative functions that utilize the `artifact_service.delete_artifact` method (note: delete is *not* exposed via context objects for safety).
* Carefully managing filenames to allow pattern-based deletion if needed.
* Carefully managing filenames to allow pattern-based deletion if needed.