Skip to content

Commit 3759169

Browse files
authored
Merge pull request #5 from ddobrin/main
Sync main into planner
2 parents 6496bd2 + 924fb71 commit 3759169

39 files changed

Lines changed: 338 additions & 900 deletions

File tree

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "0.7.0"
2+
".": "0.8.0"
33
}

CHANGELOG.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,49 @@
11
# Changelog
22

3+
## [0.8.0](https://github.com/google/adk-java/compare/v0.7.0...v0.8.0) (2026-03-06)
4+
5+
6+
### ⚠ BREAKING CHANGES
7+
8+
* remove methods with Optional params from LiveRequest.Builder
9+
* remove deprecated methods accepting Optional params in InvocationContext
10+
* remove deprecated BaseToolset.isToolSelected method
11+
* remove Optional parameters from LlmResponse.Builder's methods
12+
* remove support for legacy `transferToAgent`, superseded by `transfer_to_agent`
13+
14+
### Features
15+
16+
* add callbacks functionality to the agent executor ([7e8f9dc](https://github.com/google/adk-java/commit/7e8f9dcf82fe7e62aee625fbfaa8673d238ff184))
17+
* add example on how to expose agent via A2A protocol ([e3ea378](https://github.com/google/adk-java/commit/e3ea378051e5c4e5e5031657467145779e42db55))
18+
* Adding a Builder for EventsCompactionConfig ([05fbcfc](https://github.com/google/adk-java/commit/05fbcfc933923ae711cd12e7fc9e587fd8e2685c))
19+
* Adding a SessionKey for typeSafety ([d899f6f](https://github.com/google/adk-java/commit/d899f6f4ad52c84cb4ac8c90d0dc88c22487029c))
20+
* Adding plugin(Plugin... p) helper methods on App and Runner builders ([dc1a192](https://github.com/google/adk-java/commit/dc1a192a81a92870aa5a4af27a9dc90e81cdaf67))
21+
* implement partial event aggregation in RemoteA2AAgent ([e064067](https://github.com/google/adk-java/commit/e0640673d212b9849d312953f192f8da51fae85b))
22+
* remove deprecated BaseToolset.isToolSelected method ([d2f1145](https://github.com/google/adk-java/commit/d2f11456c3a99edd43b3dc0d04743ae7e9390ded))
23+
* remove deprecated methods accepting Optional params in InvocationContext ([88153c8](https://github.com/google/adk-java/commit/88153c833697a9b9c6ec735a69f48a92cbdfc54b))
24+
* remove methods with Optional params from LiveRequest.Builder ([84c62a4](https://github.com/google/adk-java/commit/84c62a48ef7b62641722824fe5ba1200606b7b17))
25+
* remove Optional parameters from LlmResponse.Builder's methods ([a3ac436](https://github.com/google/adk-java/commit/a3ac436bcfa241e90c07485e5da918ec8dbc2b4a))
26+
27+
28+
### Bug Fixes
29+
30+
* Allow injecting ObjectMapper in FunctionTool, default to ObjectMapper (re. [#473](https://github.com/google/adk-java/issues/473)) ([71b1070](https://github.com/google/adk-java/commit/71b10701e753bddaa96d5e6579b759d2b9bb3e92))
31+
* downgrade otel.version to 1.51.0 ([117fedf](https://github.com/google/adk-java/commit/117fedf672bb67c4b078ac75ee81a7710452c5b5))
32+
* Ensure Gemini 3.1 models have events correctly buffered ([acffdb9](https://github.com/google/adk-java/commit/acffdb96bcd8133af99cb0b9426665ba73a83bbc))
33+
* Exit from rearrangeEventsForLatestFunctionResponse if size of events is less than 2 ([5bc3ef8](https://github.com/google/adk-java/commit/5bc3ef89e62eb3f32ba7e45657c9e40c88c3a5e9))
34+
* Fixed issue where events were marked empty if the first part had an empty text; now checks all parts for meaningful content ([a0cba25](https://github.com/google/adk-java/commit/a0cba25d691f4be72bea22b0649ecf2d2c110736))
35+
* prepare JSON serialization for Jackson 2.20.2 and Spring Boot 4.0.2 upgrades ([8c6591b](https://github.com/google/adk-java/commit/8c6591bc4ad86c376cdd70e1bb64f359fbf22fe9))
36+
37+
38+
### Miscellaneous Chores
39+
40+
* revert: switch release please secret to use adk-java-releases-bot's token ([7eafd1b](https://github.com/google/adk-java/commit/7eafd1bd9b16e9ed83dfbc3d0983cfc415c0aaec))
41+
42+
43+
### Code Refactoring
44+
45+
* remove support for legacy `transferToAgent`, superseded by `transfer_to_agent` ([c1ccb2e](https://github.com/google/adk-java/commit/c1ccb2e9d375fedcd7dbb594300e66a1a0488a91))
46+
347
## [0.7.0](https://github.com/google/adk-java/compare/v0.6.0...v0.7.0) (2026-02-27)
448

549

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,13 @@ If you're using Maven, add the following to your dependencies:
5050
<dependency>
5151
<groupId>com.google.adk</groupId>
5252
<artifactId>google-adk</artifactId>
53-
<version>0.7.0</version>
53+
<version>0.8.0</version>
5454
</dependency>
5555
<!-- Dev UI -->
5656
<dependency>
5757
<groupId>com.google.adk</groupId>
5858
<artifactId>google-adk-dev</artifactId>
59-
<version>0.7.0</version>
59+
<version>0.8.0</version>
6060
</dependency>
6161
```
6262

a2a/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>com.google.adk</groupId>
77
<artifactId>google-adk-parent</artifactId>
8-
<version>0.7.1-SNAPSHOT</version><!-- {x-version-update:google-adk:current} -->
8+
<version>0.8.1-SNAPSHOT</version><!-- {x-version-update:google-adk:current} -->
99
</parent>
1010

1111
<artifactId>google-adk-a2a</artifactId>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package com.google.adk.a2a.common;
2+
3+
/** Exception thrown when the the genai class has an empty field. */
4+
public class GenAiFieldMissingException extends RuntimeException {
5+
public GenAiFieldMissingException(String message) {
6+
super(message);
7+
}
8+
9+
public GenAiFieldMissingException(String message, Throwable cause) {
10+
super(message, cause);
11+
}
12+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package com.google.adk.a2a.converters;
2+
3+
/** Enum for the type of A2A DataPart metadata. */
4+
public enum A2ADataPartMetadataType {
5+
FUNCTION_RESPONSE("function_response"),
6+
FUNCTION_CALL("function_call"),
7+
CODE_EXECUTION_RESULT("code_execution_result"),
8+
EXECUTABLE_CODE("executable_code");
9+
10+
private final String type;
11+
12+
private A2ADataPartMetadataType(String type) {
13+
this.type = type;
14+
}
15+
16+
public String getType() {
17+
return type;
18+
}
19+
}

a2a/src/main/java/com/google/adk/a2a/converters/ConversationPreprocessor.java

Lines changed: 0 additions & 108 deletions
This file was deleted.

a2a/src/main/java/com/google/adk/a2a/converters/EventConverter.java

Lines changed: 26 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,11 @@
33
import static com.google.common.collect.ImmutableList.toImmutableList;
44

55
import com.google.adk.agents.InvocationContext;
6-
import com.google.adk.events.Event;
76
import com.google.common.collect.ImmutableList;
87
import com.google.genai.types.Content;
9-
import com.google.genai.types.Part;
108
import io.a2a.spec.Message;
11-
import io.a2a.spec.TextPart;
12-
import java.util.ArrayList;
13-
import java.util.List;
9+
import io.a2a.spec.Part;
10+
import java.util.Collection;
1411
import java.util.Optional;
1512
import java.util.UUID;
1613
import org.slf4j.Logger;
@@ -28,47 +25,35 @@ public final class EventConverter {
2825
private EventConverter() {}
2926

3027
/**
31-
* Aggregation mode for converting events to A2A messages.
28+
* Converts an ADK InvocationContext to an A2A Message.
3229
*
33-
* <p>AS_IS: Parts are aggregated as-is.
30+
* <p>It combines all the events in the session, plus the user content, converted into A2A Parts,
31+
* into a single A2A Message.
3432
*
35-
* <p>EXTERNAL_HANDOFF: Parts are aggregated as-is, except for function responses, which are
36-
* converted to text parts with the function name and response map.
33+
* <p>If the context has no events, or no suitable content to build the message, an empty optional
34+
* is returned.
35+
*
36+
* @param context The ADK InvocationContext to convert.
37+
* @return The converted A2A Message.
3738
*/
38-
public enum AggregationMode {
39-
AS_IS,
40-
EXTERNAL_HANDOFF
41-
}
42-
43-
public static ImmutableList<io.a2a.spec.Part<?>> contentToParts(Optional<Content> content) {
44-
if (content.isPresent() && content.get().parts().isPresent()) {
45-
return content.get().parts().get().stream()
46-
.map(PartConverter::fromGenaiPart)
47-
.flatMap(Optional::stream)
48-
.collect(toImmutableList());
49-
}
50-
return ImmutableList.of();
51-
}
52-
5339
public static Optional<Message> convertEventsToA2AMessage(InvocationContext context) {
54-
return convertEventsToA2AMessage(context, AggregationMode.AS_IS);
55-
}
56-
57-
public static Optional<Message> convertEventsToA2AMessage(
58-
InvocationContext context, AggregationMode mode) {
5940
if (context.session().events().isEmpty()) {
6041
logger.warn("No events in session, cannot convert to A2A message.");
6142
return Optional.empty();
6243
}
6344

64-
List<io.a2a.spec.Part<?>> parts = new ArrayList<>();
65-
for (Event event : context.session().events()) {
66-
appendContentParts(event.content(), mode, parts);
67-
}
45+
ImmutableList.Builder<Part<?>> partsBuilder = ImmutableList.builder();
6846

6947
context
70-
.userContent()
71-
.ifPresent(content -> appendContentParts(Optional.of(content), mode, parts));
48+
.session()
49+
.events()
50+
.forEach(
51+
event ->
52+
partsBuilder.addAll(
53+
contentToParts(event.content(), event.partial().orElse(false))));
54+
partsBuilder.addAll(contentToParts(context.userContent(), false));
55+
56+
ImmutableList<Part<?>> parts = partsBuilder.build();
7257

7358
if (parts.isEmpty()) {
7459
logger.warn("No suitable content found to build A2A request message.");
@@ -83,37 +68,11 @@ public static Optional<Message> convertEventsToA2AMessage(
8368
.build());
8469
}
8570

86-
private static void appendContentParts(
87-
Optional<Content> contentOpt, AggregationMode mode, List<io.a2a.spec.Part<?>> target) {
88-
if (contentOpt.isEmpty() || contentOpt.get().parts().isEmpty()) {
89-
return;
90-
}
91-
92-
for (Part part : contentOpt.get().parts().get()) {
93-
if (part.text().isPresent()) {
94-
target.add(new TextPart(part.text().get()));
95-
continue;
96-
}
97-
98-
if (part.functionCall().isPresent()) {
99-
if (mode == AggregationMode.AS_IS) {
100-
PartConverter.convertGenaiPartToA2aPart(part).ifPresent(target::add);
101-
}
102-
continue;
103-
}
104-
105-
if (part.functionResponse().isPresent()) {
106-
if (mode == AggregationMode.AS_IS) {
107-
PartConverter.convertGenaiPartToA2aPart(part).ifPresent(target::add);
108-
} else {
109-
String name = part.functionResponse().get().name().orElse("");
110-
String mapStr = String.valueOf(part.functionResponse().get().response().orElse(null));
111-
target.add(new TextPart(String.format("%s response: %s", name, mapStr)));
112-
}
113-
continue;
114-
}
115-
116-
PartConverter.fromGenaiPart(part).ifPresent(target::add);
117-
}
71+
public static ImmutableList<Part<?>> contentToParts(
72+
Optional<Content> content, boolean isPartial) {
73+
return content.flatMap(Content::parts).stream()
74+
.flatMap(Collection::stream)
75+
.map(part -> PartConverter.fromGenaiPart(part, isPartial))
76+
.collect(toImmutableList());
11877
}
11978
}

0 commit comments

Comments
 (0)