AAI SDK
    Preparing search index...

    Type Alias ServerOptions

    Configuration for createServer.

    type ServerOptions = {
        clientDir?: string;
        env?: Record<string, string>;
        greeting?: string;
        hostBaseAgent?: AgentDef;
        logger?: Logger;
        name?: string;
        request?: (
            req: http.IncomingMessage,
            res: http.ServerResponse,
            url: string,
            method: string,
        ) => boolean;
        runtime: SessionRuntime;
        upgrade?: (
            req: http.IncomingMessage,
            socket: Duplex,
            head: Buffer,
        ) => boolean;
    }
    Index
    clientDir?: string

    Directory of static client assets to serve at /.

    env?: Record<string, string>

    Environment for host-mode connections (a ?host=1 WebSocket whose first config frame supplies its own agent) and the source of secrets for the per-connection runtime.

    Supplying env does not by itself enable host mode: it is opt-in via AAI_ALLOW_HOST (see isHostAllowed). Omitting env disables host mode unconditionally — any ?host=1 connection is rejected.

    greeting?: string

    Agent greeting, included in the GET /client-config response.

    hostBaseAgent?: AgentDef

    The deployed agent. Host-mode sessions inherit its stt/llm/tts provider config so they run the operator's configured pipeline instead of the default S2S path. Only prompt/greeting/tools come from the client.

    logger?: Logger

    Structured logger. Defaults to the console logger.

    name?: string

    Display name served by GET /client-config. Defaults to "agent".

    request?: (
        req: http.IncomingMessage,
        res: http.ServerResponse,
        url: string,
        method: string,
    ) => boolean

    First look at every HTTP request (after /health). Return true to claim it — the server then leaves the response alone. The upgrade hook's HTTP twin: lets an embedder (the platform's guest harness) add its own HTTP surface — the studio coding agent's chat endpoint — without a second HTTP server.

    The runtime sessions are started on — see createRuntime.

    upgrade?: (req: http.IncomingMessage, socket: Duplex, head: Buffer) => boolean

    First look at every WebSocket upgrade. Return true to claim it (the server then leaves the socket alone); return false to fall through to the standard /websocket session handling. Lets an embedder (the platform's guest harness) add its own upgrade surface — its host control channel — without a second HTTP server.