From f0fb722cd6369e9179b6194f544d324e89ba9101 Mon Sep 17 00:00:00 2001 From: Damian Momot Date: Wed, 9 Sep 2026 05:57:12 -0700 Subject: [PATCH] feat: add opt-in ResumabilityConfig flag for plain-text continuation auto-resume Adds a deprecated, default-off ResumabilityConfig.plainTextContinuationAutoResume flag. Default behavior is unchanged. It is deprecated from introduction: callers should resume paused invocations explicitly with a function response to the paused call or Runner.runAsync with an invocation id. PiperOrigin-RevId: 978497716 --- .../google/adk/apps/ResumabilityConfig.java | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/com/google/adk/apps/ResumabilityConfig.java b/core/src/main/java/com/google/adk/apps/ResumabilityConfig.java index bb1c87f44..d6d0445d7 100644 --- a/core/src/main/java/com/google/adk/apps/ResumabilityConfig.java +++ b/core/src/main/java/com/google/adk/apps/ResumabilityConfig.java @@ -35,8 +35,24 @@ public abstract class ResumabilityConfig { /** Whether the app supports agent resumption. */ public abstract boolean isResumable(); + /** + * Whether a plain-text {@code runAsync} continuation -- a user message that is not a function + * response -- resumes the last unfinished invocation instead of starting a new one. Off by + * default, matching Python ADK, where a plain-text {@code runAsync} always starts a new + * invocation and a paused invocation is resumed explicitly. + * + * @deprecated Back-compat shim for callers that deliver a resume as a plain-text turn. Migrate to + * {@code Runner.runAsync(userId, sessionId, invocationId, message, runConfig, stateDelta)} + * (or send a function response to the paused call) and stop setting this flag; it will be + * removed. + */ + @Deprecated + public abstract boolean isPlainTextContinuationAutoResume(); + public static Builder builder() { - return new AutoValue_ResumabilityConfig.Builder().resumable(false); + return new AutoValue_ResumabilityConfig.Builder() + .resumable(false) + .plainTextContinuationAutoResume(false); } /** Builder for {@link ResumabilityConfig}. */ @@ -45,6 +61,15 @@ public abstract static class Builder { @CanIgnoreReturnValue public abstract Builder resumable(boolean isResumable); + /** + * @deprecated Back-compat shim only; migrate to {@code Runner.runAsync(...)} with an invocation + * id (or send a function response to the paused call). See {@link + * ResumabilityConfig#isPlainTextContinuationAutoResume()}. + */ + @Deprecated + @CanIgnoreReturnValue + public abstract Builder plainTextContinuationAutoResume(boolean value); + public abstract ResumabilityConfig build(); } }