Class RemoteAgent

java.lang.Object
com.google.genkit.client.RemoteAgent

public final class RemoteAgent extends Object
Factory for creating a remote agent chat client.

Use chat(RemoteAgentOptions) to connect to an agent served by the Jetty plugin (or any compatible server that speaks the Genkit agent wire format):


 AgentChat<Map<String,Object>> chat = RemoteAgent.<Map<String,Object>>chat(
     RemoteAgentOptions.builder()
         .url("http://localhost:8080/myAgent")
         .build());
 AgentResponse<Map<String,Object>> resp = chat.send("hello");
 
  • Method Details

    • chat

      public static <S> AgentChat<S> chat(RemoteAgentOptions opts)
      Creates a new AgentChat backed by an HttpAgentTransport that speaks to the agent at opts.url().
      Type Parameters:
      S - the type of custom session state
      Parameters:
      opts - the remote agent options (URL, headers, serverManaged flag)
      Returns:
      a fresh AgentChat ready to send turns