Interface SessionServiceGrpc.AsyncService (0.19.0)

public static interface SessionServiceGrpc.AsyncService

Session service provides APIs for interacting with CES agents.

Methods

bidiRunSession(StreamObserver<BidiSessionServerMessage> responseObserver)

public default StreamObserver<BidiSessionClientMessage> bidiRunSession(StreamObserver<BidiSessionServerMessage> responseObserver)

Establishes a bidirectional streaming connection with the CES agent. The agent processes continuous multimodal inputs (e.g., text, audio) and generates real-time multimodal output streams. --- Client Request Stream --- The client streams requests in the following order:

  1. Initialization: The first message must contain SessionConfig. For audio sessions, this should also include InputAudioConfig and OutputAudioConfig to define audio processing and synthesis parameters.
  2. Interaction: Subsequent messages stream SessionInput containing real-time user input data.
  3. Termination: The client should half-close the stream when there is no more user input. It should also half-close upon receiving EndSession or GoAway from the agent. --- Server Response Stream --- For each interaction turn, the agent streams messages in the following sequence:
  4. Speech Recognition (First N messages): Contains RecognitionResult representing the concatenated user speech segments captured so far. This is only populated for audio sessions.
  5. Response (Next M messages): Contains SessionOutput delivering the agent's response in various modalities (e.g., text, audio).
  6. Turn Completion (Final message of the turn): Contains SessionOutput with turn_completed set to true. This signals the end of the current turn and includes DiagnosticInfo with execution details. --- Audio Best Practices ---
  7. Streaming: Stream audio data CONTINUOUSLY, even during silence. Recommended chunk size: 40-120ms (balances latency vs. efficiency).
  8. Playback & Interruption: Play audio responses upon receipt. Stop playback immediately if an InterruptionSignal is received (e.g., user barge-in or new agent response).
Parameter
Name Description
responseObserver io.grpc.stub.StreamObserver<BidiSessionServerMessage>
Returns
Type Description
io.grpc.stub.StreamObserver<BidiSessionClientMessage>

cancelAssistantTurn(CancelAssistantTurnRequest request, StreamObserver<CancelAssistantTurnResponse> responseObserver)

public default void cancelAssistantTurn(CancelAssistantTurnRequest request, StreamObserver<CancelAssistantTurnResponse> responseObserver)

Cancels the assistant session's in-flight turn, if any: the explicit user stop for a turn running detached from any stream. A cancel landing on a task that does not host the turn preempts it through the session turn epoch instead, ending it within one lease renewal.

Parameters
Name Description
request CancelAssistantTurnRequest
responseObserver io.grpc.stub.StreamObserver<CancelAssistantTurnResponse>

generateOnboardingSuggestions(GenerateOnboardingSuggestionsRequest request, StreamObserver<GenerateOnboardingSuggestionsResponse> responseObserver)

public default void generateOnboardingSuggestions(GenerateOnboardingSuggestionsRequest request, StreamObserver<GenerateOnboardingSuggestionsResponse> responseObserver)

Generates personalized onboarding suggestions for the Arc zero state: classifies the requesting user (new / exploring / returning) from their assistant-session history in the app and returns suggestion chips (resume a session, continue work, or start something new) to render before any message is sent.

Parameters
Name Description
request GenerateOnboardingSuggestionsRequest
responseObserver io.grpc.stub.StreamObserver<GenerateOnboardingSuggestionsResponse>

runSession(RunSessionRequest request, StreamObserver<RunSessionResponse> responseObserver)

public default void runSession(RunSessionRequest request, StreamObserver<RunSessionResponse> responseObserver)

Initiates a single-turn interaction with the CES agent within a session.

Parameters
Name Description
request RunSessionRequest
responseObserver io.grpc.stub.StreamObserver<RunSessionResponse>

streamChatAiAssistant(StreamChatAiAssistantRequest request, StreamObserver<StreamChatAiAssistantResponse> responseObserver)

public default void streamChatAiAssistant(StreamChatAiAssistantRequest request, StreamObserver<StreamChatAiAssistantResponse> responseObserver)

Runs Arc, the AI assistant, for the specified assistant session in a streaming fashion.

Parameters
Name Description
request StreamChatAiAssistantRequest
responseObserver io.grpc.stub.StreamObserver<StreamChatAiAssistantResponse>

streamRunSession(RunSessionRequest request, StreamObserver<RunSessionResponse> responseObserver)

public default void streamRunSession(RunSessionRequest request, StreamObserver<RunSessionResponse> responseObserver)

Initiates a single-turn interaction with the CES agent. Uses server-side streaming to deliver incremental results and partial responses as they are generated. By default, complete responses (e.g., messages from callbacks or full LLM responses) are sent to the client as soon as they are available. To enable streaming individual text chunks directly from the model, set enable_text_streaming to true.

Parameters
Name Description
request RunSessionRequest
responseObserver io.grpc.stub.StreamObserver<RunSessionResponse>