Packages@downcity/agent

HTTP and RPC

Expose an Agent through the City host transport adapters.

City owns one HTTP transport and one RPC transport. Both route by agent_id to the same Agent collection and by workspace_id to a Workspace owned by City.

await city.listen({
  http: { host: "127.0.0.1", port: 5314 },
  rpc: { host: "127.0.0.1", port: 15314 },
});

await city.close(); // transports only; the creating host still disposes Agents

For separate lifecycle control, City can start either transport directly:

const http = await city.http({ host: "127.0.0.1", port: 5314 });
const rpc = await city.rpc({ host: "127.0.0.1", port: 15314 });

HTTP uses http://host:port/agents/<agent_id>/workspaces/<workspace_id> and RPC uses rpc://host:port/<agent_id>/<workspace_id>. There are no Agent-level transport constructors; external services belong to City.