Jetty Server
Installation
Section titled “Installation”<dependency> <groupId>com.google.genkit</groupId> <artifactId>genkit-plugin-jetty</artifactId> <version>1.0.0-SNAPSHOT</version></dependency>import com.google.genkit.plugins.jetty.JettyPlugin;import com.google.genkit.plugins.jetty.JettyPluginOptions;
JettyPlugin jetty = new JettyPlugin(JettyPluginOptions.builder() .port(8080) .build());
Genkit genkit = Genkit.builder() .plugin(jetty) .build();
// Define your flows here...
// Start the server (blocks until stopped)jetty.start();All defined flows are automatically exposed as HTTP endpoints.
Calling flows via HTTP
Section titled “Calling flows via HTTP”curl -X POST http://localhost:8080/api/flows/tellJoke \ -H "Content-Type: application/json" \ -d '{"data": "pirates"}'Serving agents
Section titled “Serving agents”Any agent defined with genkit.beta().defineAgent(...) / defineCustomAgent(...) is mounted automatically — just define it before calling jetty.start(). Agents are served at the root path (/<agentName>), separate from flows’ /api/flows/... base:
curl -X POST http://localhost:8080/echoAgent \ -H "Content-Type: application/json" \ -d '{"data":{"message":{"role":"user","content":[{"text":"Hello, agent!"}]}}}'For server-managed agents (those configured with a SessionStore), the companion endpoints POST /<agentName>/getSnapshot and POST /<agentName>/abort are mounted too. Streaming turns are available via Accept: text/event-stream or ?stream=true.
The same Java client (RemoteAgent / AgentChat) works against a Jetty or Spring server unchanged. See Serve over HTTP for the full request/response contract, calling a served agent from Java, and how request headers reach your agent — and Background Execution for detached (background) turns.