Class ContractHttpServer
java.lang.Object
io.agentscope.extensions.aistio.transport.ContractHttpServer
- All Implemented Interfaces:
AutoCloseable
In-process HTTP server for the
/agentscope/* contract, letting the control plane pull
on demand and issue session commands.
Routes mirror the Go connector.ContractServer and the Python SDK one for one:
GET /agentscope/info
GET /agentscope/health
GET /agentscope/sessions
GET /agentscope/sessions/{id}/state
GET /agentscope/sessions/{id}/context
GET /agentscope/sessions/{id}/messages?offset=&limit=
GET /agentscope/sessions/{id}/tasks
GET /agentscope/subagents
GET /agentscope/workspaces
POST /agentscope/sessions/{id}/compress
POST /agentscope/sessions/{id}/terminate
POST /agentscope/sessions/{id}/abort
Built on the JDK's com.sun.net.httpserver so that instrumenting an agent never drags
in a web framework or collides with the application's own server.
-
Constructor Summary
ConstructorsConstructorDescriptionContractHttpServer(String host, int port, ContractProvider provider) ContractHttpServer(String host, int port, ContractProvider provider, String internalToken) -
Method Summary
-
Constructor Details
-
ContractHttpServer
- Throws:
IOException
-
ContractHttpServer
public ContractHttpServer(String host, int port, ContractProvider provider, String internalToken) throws IOException - Throws:
IOException
-
-
Method Details
-
getPort
public int getPort()Actual bound port, which matters when the configured port was 0. -
start
public void start() -
close
public void close()- Specified by:
closein interfaceAutoCloseable
-