Skip to content
Merged
Changes from all commits
Commits
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
18 changes: 18 additions & 0 deletions core/src/main/java/com/google/adk/agents/ReadonlyContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@

package com.google.adk.agents;

import com.google.adk.events.Event;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.genai.types.Content;
import java.util.List;
import java.util.Map;
import java.util.Optional;

Expand Down Expand Up @@ -50,6 +53,21 @@ public String agentName() {
return invocationContext.agent().name();
}

/** Returns the session ID. */
public String sessionId() {
return invocationContext.session().id();
}

/**
* Returns a read-only view of the events of the current session.
*
* <p>This is a shallow copy and if the underlying values of the list are modified, the read-only
* view will also be modified.
*/
public ImmutableList<Event> events() {
return ImmutableList.copyOf(invocationContext.session().events());
}

/**
* Returns a read-only view of the state of the current session.
*
Expand Down