diff --git a/core/src/main/java/com/google/adk/agents/CallbackContext.java b/core/src/main/java/com/google/adk/agents/CallbackContext.java index d01f456b..e1a0d7eb 100644 --- a/core/src/main/java/com/google/adk/agents/CallbackContext.java +++ b/core/src/main/java/com/google/adk/agents/CallbackContext.java @@ -105,15 +105,16 @@ public void saveArtifact(String filename, Part artifact) { if (invocationContext.artifactService() == null) { throw new IllegalStateException("Artifact service is not initialized."); } - var unused = - invocationContext - .artifactService() - .saveArtifact( - invocationContext.appName(), - invocationContext.userId(), - invocationContext.session().id(), - filename, - artifact); - this.eventActions.artifactDelta().put(filename, artifact); + invocationContext + .artifactService() + .saveArtifact( + invocationContext.appName(), + invocationContext.userId(), + invocationContext.session().id(), + filename, + artifact) + .doOnSuccess(unusedVersion -> this.eventActions.artifactDelta().put(filename, artifact)) + .ignoreElement() + .blockingAwait(); } }