# Class SessionServiceGrpc.SessionServiceBlockingV2Stub (0.9.0)

0.9.0 (latest) 0.7.0 0.4.0 0.3.0 0.1.0

    public static final class SessionServiceGrpc.SessionServiceBlockingV2Stub extends AbstractBlockingStub<SessionServiceGrpc.SessionServiceBlockingV2Stub>

A stub to allow clients to do synchronous rpc calls to service SessionService.

Session service provides APIs for interacting with CES agents.

## Inheritance

[java.lang.Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \> io.grpc.stub.AbstractStub \> io.grpc.stub.AbstractBlockingStub \> SessionServiceGrpc.SessionServiceBlockingV2Stub

## Inherited Members

io.grpc.stub.AbstractBlockingStub.\<T\>newStub(io.grpc.stub.AbstractStub.StubFactory\<T\>,io.grpc.Channel) io.grpc.stub.AbstractBlockingStub.\<T\>newStub(io.grpc.stub.AbstractStub.StubFactory\<T\>,io.grpc.Channel,io.grpc.CallOptions) io.grpc.stub.AbstractStub.\<T\>withOption(io.grpc.CallOptions.Key\<T\>,T) io.grpc.stub.AbstractStub.build(io.grpc.Channel,io.grpc.CallOptions) io.grpc.stub.AbstractStub.getCallOptions() io.grpc.stub.AbstractStub.getChannel() io.grpc.stub.AbstractStub.withCallCredentials(io.grpc.CallCredentials) io.grpc.stub.AbstractStub.withChannel(io.grpc.Channel) io.grpc.stub.AbstractStub.withCompression(java.lang.String) io.grpc.stub.AbstractStub.withDeadline(io.grpc.Deadline) io.grpc.stub.AbstractStub.withDeadlineAfter(java.time.Duration) io.grpc.stub.AbstractStub.withDeadlineAfter(long,java.util.concurrent.TimeUnit) io.grpc.stub.AbstractStub.withExecutor(java.util.concurrent.Executor) io.grpc.stub.AbstractStub.withInterceptors(io.grpc.ClientInterceptor...) io.grpc.stub.AbstractStub.withMaxInboundMessageSize(int) io.grpc.stub.AbstractStub.withMaxOutboundMessageSize(int) io.grpc.stub.AbstractStub.withOnReadyThreshold(int) io.grpc.stub.AbstractStub.withWaitForReady() [Object.clone()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--) [Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-) [Object.finalize()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--) [Object.getClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--) [Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--) [Object.notify()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--) [Object.notifyAll()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--) [Object.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--) [Object.wait()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--) [Object.wait(long)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-) [Object.wait(long,int)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-)

## Methods

### bidiRunSession()

    public BlockingClientCall<BidiSessionClientMessage,BidiSessionServerMessage> bidiRunSession()

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).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `io.grpc.stub.BlockingClientCall<https://docs.cloud.google.com/java/docs/reference/google-cloud-ces/latest/com.google.cloud.ces.v1beta.BidiSessionClientMessage,https://docs.cloud.google.com/java/docs/reference/google-cloud-ces/latest/com.google.cloud.ces.v1beta.BidiSessionServerMessage>` |   |

### build(Channel channel, CallOptions callOptions)

    protected SessionServiceGrpc.SessionServiceBlockingV2Stub build(Channel channel, CallOptions callOptions)

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `channel` | `io.grpc.Channel` |
| `callOptions` | `io.grpc.CallOptions` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-ces/latest/com.google.cloud.ces.v1beta.SessionServiceGrpc.SessionServiceBlockingV2Stub` |   |

**Overrides** io.grpc.stub.AbstractStub.build(io.grpc.Channel,io.grpc.CallOptions)

### runSession(RunSessionRequest request)

    public RunSessionResponse runSession(RunSessionRequest request)

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

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-ces/latest/com.google.cloud.ces.v1beta.RunSessionRequest` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-ces/latest/com.google.cloud.ces.v1beta.RunSessionResponse` |   |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `io.grpc.StatusException` |   |

### streamRunSession(RunSessionRequest request)

    public BlockingClientCall<?,RunSessionResponse> streamRunSession(RunSessionRequest request)

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.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-ces/latest/com.google.cloud.ces.v1beta.RunSessionRequest` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `io.grpc.stub.BlockingClientCall<?,https://docs.cloud.google.com/java/docs/reference/google-cloud-ces/latest/com.google.cloud.ces.v1beta.RunSessionResponse>` |   |