Class RuntimeServer
java.lang.Object
ai.singlr.runtime.RuntimeServer
- All Implemented Interfaces:
AutoCloseable
Programmatic Helidon SE
WebServer wrapping an AgentHttpService. Designed for
embedding in a service main, or in tests that want a real HTTP endpoint on a random port.
Typical use:
try (var server = RuntimeServer.builder()
.withRegistry(SessionRegistry.inMemory())
.withOptionsFactory(sessionId -> SessionOptions.newBuilder()
.withModel(myModel).withSessionId(sessionId).build())
.withPort(0) // random
.build()) {
var port = server.port();
// … drive over HTTP …
}
Thread-safety
The wrappedWebServer is thread-safe. close() is idempotent.-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic RuntimeServer.Builderbuilder()Start building a server.voidclose()Stop the server and close every registered session.intport()The port the server is bound to.registry()The registry of sessions the server is fronting.
-
Method Details
-
builder
-
port
The port the server is bound to. Useful when constructed with port 0 (auto-assigned).- Returns:
- the bound port
-
registry
The registry of sessions the server is fronting.- Returns:
- non-null registry
-
close
Stop the server and close every registered session. Idempotent.- Specified by:
closein interfaceAutoCloseable
-