diff --git a/core/src/main/java/com/google/adk/agents/ActiveStreamingTool.java b/core/src/main/java/com/google/adk/agents/ActiveStreamingTool.java index 31b64e9c6..b0dff0c10 100644 --- a/core/src/main/java/com/google/adk/agents/ActiveStreamingTool.java +++ b/core/src/main/java/com/google/adk/agents/ActiveStreamingTool.java @@ -22,8 +22,8 @@ /** Manages streaming tool related resources during invocation. */ public class ActiveStreamingTool { - @Nullable private Disposable task; - @Nullable private LiveRequestQueue stream; + private @Nullable Disposable task; + private @Nullable LiveRequestQueue stream; public ActiveStreamingTool(Disposable task) { this(task, null); @@ -41,8 +41,7 @@ public ActiveStreamingTool(Disposable task, LiveRequestQueue stream) { public ActiveStreamingTool() {} /** Returns the active task of this streaming tool. */ - @Nullable - public Disposable task() { + public @Nullable Disposable task() { return task; } @@ -52,8 +51,7 @@ public void task(@Nullable Disposable task) { } /** Returns the active stream of this streaming tool. */ - @Nullable - public LiveRequestQueue stream() { + public @Nullable LiveRequestQueue stream() { return stream; } diff --git a/core/src/main/java/com/google/adk/agents/LlmAgent.java b/core/src/main/java/com/google/adk/agents/LlmAgent.java index c8199e8a2..98bba4606 100644 --- a/core/src/main/java/com/google/adk/agents/LlmAgent.java +++ b/core/src/main/java/com/google/adk/agents/LlmAgent.java @@ -129,10 +129,10 @@ protected LlmAgent(Builder builder) { requireNonNullElse(builder.globalInstruction, new Instruction.Static("")); this.generateContentConfig = Optional.ofNullable(builder.generateContentConfig); this.includeContents = requireNonNullElse(builder.includeContents, IncludeContents.DEFAULT); - this.planning = builder.planning != null && builder.planning; + this.planning = requireNonNullElse(builder.planning, false); this.maxSteps = Optional.ofNullable(builder.maxSteps); - this.disallowTransferToParent = builder.disallowTransferToParent; - this.disallowTransferToPeers = builder.disallowTransferToPeers; + this.disallowTransferToParent = requireNonNullElse(builder.disallowTransferToParent, false); + this.disallowTransferToPeers = requireNonNullElse(builder.disallowTransferToPeers, false); this.beforeModelCallback = requireNonNullElse(builder.beforeModelCallback, ImmutableList.of()); this.afterModelCallback = requireNonNullElse(builder.afterModelCallback, ImmutableList.of()); this.onModelErrorCallback = @@ -566,8 +566,7 @@ public Builder codeExecutor(BaseCodeExecutor codeExecutor) { return this; } - @Nullable - private static ImmutableList convertCallbacks( + private static @Nullable ImmutableList convertCallbacks( @Nullable List callbacks, Function converter, String callbackType) { return Optional.ofNullable(callbacks) .map( diff --git a/core/src/main/java/com/google/adk/apps/App.java b/core/src/main/java/com/google/adk/apps/App.java index 689e8c3b1..500c29253 100644 --- a/core/src/main/java/com/google/adk/apps/App.java +++ b/core/src/main/java/com/google/adk/apps/App.java @@ -40,8 +40,8 @@ public class App { private final String name; private final BaseAgent rootAgent; private final ImmutableList plugins; - @Nullable private final EventsCompactionConfig eventsCompactionConfig; - @Nullable private final ContextCacheConfig contextCacheConfig; + private final @Nullable EventsCompactionConfig eventsCompactionConfig; + private final @Nullable ContextCacheConfig contextCacheConfig; private App( String name, diff --git a/core/src/main/java/com/google/adk/events/Event.java b/core/src/main/java/com/google/adk/events/Event.java index 454cd591e..cde4e4452 100644 --- a/core/src/main/java/com/google/adk/events/Event.java +++ b/core/src/main/java/com/google/adk/events/Event.java @@ -348,7 +348,7 @@ public static class Builder { private String invocationId; private String author; private @Nullable Content content; - private EventActions actions; + private @Nullable EventActions actions; private @Nullable Set longRunningToolIds; private @Nullable Boolean partial; private @Nullable Boolean turnComplete; @@ -399,7 +399,7 @@ public Builder content(@Nullable Content value) { @CanIgnoreReturnValue @JsonProperty("actions") - public Builder actions(EventActions value) { + public Builder actions(@Nullable EventActions value) { this.actions = value; return this; } diff --git a/core/src/main/java/com/google/adk/events/EventActions.java b/core/src/main/java/com/google/adk/events/EventActions.java index 105300aa0..9c977240c 100644 --- a/core/src/main/java/com/google/adk/events/EventActions.java +++ b/core/src/main/java/com/google/adk/events/EventActions.java @@ -281,7 +281,7 @@ private Builder(EventActions eventActions) { @CanIgnoreReturnValue @JsonProperty("skipSummarization") - public Builder skipSummarization(boolean skipSummarization) { + public Builder skipSummarization(@Nullable Boolean skipSummarization) { this.skipSummarization = skipSummarization; return this; } @@ -324,7 +324,7 @@ public Builder transferToAgent(@Nullable String agentId) { @CanIgnoreReturnValue @JsonProperty("escalate") - public Builder escalate(boolean escalate) { + public Builder escalate(@Nullable Boolean escalate) { this.escalate = escalate; return this; }