Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
871d849
add : version file
Dec 19, 2025
a4fe90e
Merge remote-tracking branch 'upstream/main'
Jan 20, 2026
093480b
Merge remote-tracking branch 'upstream/main'
Jan 20, 2026
b0d8f0d
removed logs
Jan 27, 2026
4daa678
Merge remote-tracking branch 'upstream/main'
Jan 28, 2026
a2187f8
Merge remote-tracking branch 'upstream/main'
claude Jun 20, 2026
f0a6d52
feat: track token usage for live (BIDI) sessions via plugin callbacks
claude Jun 20, 2026
fb8b5fe
docs: add live BIDI token-tracking harness example
claude Jun 20, 2026
a5a74b6
test: extend live token harness to probe per-turn vs cumulative usage
claude Jun 20, 2026
6ef37cc
fix: sum per-turn token usage instead of keeping latest value
claude Jun 20, 2026
1159479
Merge branch 'claude/live-bidi-token-tracking' of https://github.com/…
alfredjimmy-redbus Jun 23, 2026
3d49867
token tracking for bidi
alfredjimmy-redbus Jun 23, 2026
1fa262e
Merge branch 'main' into token_tracking
alfredjimmy-redbus Jun 23, 2026
cfe33b9
added MapDB Support and Ollama basic integration basis https://github…
alfredjimmy-redbus Jun 23, 2026
f8110ec
Merge branch 'temp-br' into token_tracking
alfredjimmy-redbus Jun 23, 2026
35a42f0
Merge branch 'main' of https://github.com/alfredjimmy-redbus/adk-java
alfredjimmy-redbus Jun 23, 2026
797ab08
Merge branch 'main' into token_tracking
alfredjimmy-redbus Jun 23, 2026
3020499
Merge branch 'token_tracking' of https://github.com/alfredjimmy-redbu…
alfredjimmy-redbus Jun 23, 2026
172f747
Merge branch 'main' of https://github.com/alfredjimmy-redbus/adk-java
alfredjimmy-redbus Jun 23, 2026
46a96ea
Merge branch 'main' into token_tracking
alfredjimmy-redbus Jun 23, 2026
bcb703f
removed liveTokenTrackingPlugin since it was folded inside sdk
alfredjimmy-redbus Jun 24, 2026
628dbc2
removed appending events
alfredjimmy-redbus Jun 29, 2026
651e934
readded appending events
alfredjimmy-redbus Jun 29, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion contrib/sarvam-ai/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<groupId>com.google.adk</groupId>
<artifactId>google-adk-parent</artifactId>
<version>1.4.1-SNAPSHOT</version><!-- {x-version-update:google-adk:current} -->
<version>1.5.1-SNAPSHOT</version><!-- {x-version-update:google-adk:current} -->
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
10 changes: 10 additions & 0 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,16 @@
<version>4.12.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20180813</version>
</dependency>
<dependency>
<groupId>org.mapdb</groupId>
<artifactId>mapdb</artifactId>
<version>3.0.8</version>
</dependency>
</dependencies>
<build>
<resources>
Expand Down
15 changes: 15 additions & 0 deletions core/src/main/java/com/google/adk/models/GeminiLlmConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,21 @@ static Optional<LlmResponse> convertToServerResponse(LiveServerMessage message)
} else if (message.setupComplete().isPresent()) {
logger.debug("Received setup complete.");
return Optional.empty();
} else if (message.sessionResumptionUpdate().isPresent()) {
logger.debug(
"Received session resumption update: {}", message.sessionResumptionUpdate().get());
return Optional.empty();
} else if (message.goAway().isPresent()) {
logger.debug("Received go away: {}", message.goAway().get());
return Optional.empty();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we be really sending optional.empty on goAway or voiceactivity detectionSignal()?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, keeping them as Optional.empty() is the right approach for this specific layer (convertToServerResponse).

This method's job is to map server events into client-facing responses (like content, tools, and usage). Because goAway and voiceActivity are infrastructure/connection-level signals, they don't have a representation in the client response model.

If we don't return Optional.empty(), we'd have to map them to an error event, which we previously found was incorrect and causing issues.

} else if (message.voiceActivityDetectionSignal().isPresent()) {
logger.debug(
"Received voice activity detection signal: {}",
message.voiceActivityDetectionSignal().get());
return Optional.empty();
} else if (message.voiceActivity().isPresent()) {
logger.debug("Received voice activity: {}", message.voiceActivity().get());
return Optional.empty();
} else if (message.usageMetadata().isEmpty()) {
logger.warn("Received unknown or empty server message: {}", message.toJson());
builder
Expand Down
18 changes: 17 additions & 1 deletion core/src/main/java/com/google/adk/runner/Runner.java
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,23 @@ protected Flowable<Event> runLiveImpl(
updatedInvocationContext
.agent()
.runLive(updatedInvocationContext)
.doOnNext(event -> this.sessionService.appendEvent(session, event)))
.doOnNext(event -> this.sessionService.appendEvent(session, event))
.concatMapSingle(
event -> {
return updatedInvocationContext
.pluginManager()
.onEventCallback(updatedInvocationContext, event)
.defaultIfEmpty(event);
})
// Run afterRunCallback once the live run completes so plugins can flush
// or log aggregates (e.g. total token usage for the session).
.concatWith(
Completable.defer(
() -> {
return updatedInvocationContext
.pluginManager()
.afterRunCallback(updatedInvocationContext);
})))
.doOnError(
throwable -> {
Span span = Span.current();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,22 @@ public void convertToServerResponse_withSetupComplete_returnsEmpty() {
assertThat(result.isPresent()).isFalse();
}

@Test
public void convertToServerResponse_withSessionResumptionUpdate_returnsEmpty() {
LiveServerMessage message =
LiveServerMessage.builder()
.sessionResumptionUpdate(
com.google.genai.types.LiveServerSessionResumptionUpdate.builder()
.newHandle("handle-123")
.resumable(true)
.build())
.build();

Optional<LlmResponse> result = GeminiLlmConnection.convertToServerResponse(message);

assertThat(result.isPresent()).isFalse();
}

@Test
public void convertToServerResponse_withUnknownMessage_returnsErrorResponse() {
LiveServerMessage message = LiveServerMessage.builder().build();
Expand Down
Loading