Package com.google.genkit
Class ReflectionServerV2
java.lang.Object
com.google.genkit.ReflectionServerV2
ReflectionServerV2 implements the Reflection API V2 using WebSockets and JSON-RPC 2.0.
In V2, the connection direction is reversed compared to V1: the runtime acts as a WebSocket client, connecting outbound to the CLI's WebSocket server. Communication uses JSON-RPC 2.0 for bidirectional messaging.
This is activated when the GENKIT_REFLECTION_V2_SERVER environment variable is set
(e.g., ws://localhost:4100).
-
Constructor Summary
ConstructorsConstructorDescriptionReflectionServerV2(Registry registry, String serverUrl, String instanceName) Creates a new ReflectionServerV2. -
Method Summary
-
Constructor Details
-
ReflectionServerV2
Creates a new ReflectionServerV2.- Parameters:
registry- the Genkit registryserverUrl- the WebSocket server URL (e.g., ws://localhost:4100)instanceName- optional instance name for the runtime ID (may be null)
-
-
Method Details
-
getRuntimeId
Gets the runtime ID. -
start
Starts the V2 reflection client by connecting to the CLI WebSocket server.- Throws:
Exception- if the initial connection fails
-
stop
public void stop()Stops the V2 reflection client.
-