google / google/adk-web

Artifact from Agent saved but not appearing in Web UI

Open
#64 3 comments 2 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
1k
Forks
267
Avg merge
1d 12h
Merged PRs (30d)
9

Description

My agent has an `after_model_callback=save_generated_report_py` [1] , it runs correctly and saves the artifact; but then is not displayed anywhere in the web UI.

In the event detail, I can see the artifact being generated and saved

```
[...]
actions:
stateDelta:
artifactDelta:
generated_report.html: 0
[...]
```

But then Artifacts tab is empty:

![Image](https://github.com/user-attachments/assets/c428b93c-c02d-4461-a70b-a89f98ccc63a)

[1]
```python
async def save_generated_report_py(callback_context: CallbackContext, llm_response: LlmResponse):
"""Saves generated PDF report bytes as an artifact."""
report_artifact = types.Part.from_bytes(
data=llm_response.content.parts[0].text.replace("```html", "").replace("```", "").replace("FOOBARBAZ", google_maps_api_key).encode('utf-8'),
mime_type="text/html"
)
filename = "generated_report.html"

try:
version = await callback_context.save_artifact(filename=filename, artifact=report_artifact)
print(f"Successfully saved Python artifact '{filename}' as version {version}.")
# The event generated after this callback will contain:
# event.actions.artifact_delta == {"generated_report.pdf": version}
except ValueError as e:
print(f"Error saving Python artifact: {e}. Is ArtifactService configured in Runner?")
except Exception as e:
# Handle potential storage errors (e.g., GCS permissions)
print(f"An unexpected error occurred during Python artifact save: {e}")

```
(This might be related to https://github.com/google/adk-web/issues/54 )

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.