Webserver Api

Last updated: April 11, 2026

Assistant WebServer API

The assistant module hosts a multi-port web server infrastructure providing REST APIs, Server-Sent Events (SSE), and WebSockets for real-time interaction and system monitoring.

Core API Endpoints (Port 6573)

1. Synchronous Query (/api/query-sync)

  • Method: POST
  • Input: JSON containing query, agent, model, and chatID.
  • Response: A complete JSON object with the final answer and tool execution logs.
  • Best For: Programmatic clients and scripts.

2. Asynchronous Query with SSE (/api/query)

  • Method: GET / POST
  • Feature: Streams reasoning (Chain of Thought), tool calls, and final responses in real-time.
  • Output Format: Server-Sent Events (SSE) with event: thought, event: tool, event: result.
  • Best For: Interactive web UIs and mobile apps.

3. Voice Query (/api/voice/query)

  • Method: POST
  • Input: Multipart audio data.
  • Flow: Triggers the VoiceHandler pipeline (STT → Query → TTS).
  • Response: Audio stream (WAV/MP3).

Mission Control Dashboards (Port 9999)

  • Real-time Telemetry: SSE streams for infra stats and agent activity.
  • Log Vault: Searchable interface for session history.
  • The Office: Virtualized 2D visualizer for the Business Hive.

Wakeup and Event Ingress (Port 7142)

  • Wakeup (/api/wakeup): Programmatic agent activation.
  • Webhooks: Ingress for YouTube, Vonage, and Home Assistant events.

Mermaid Diagram: API Architecture

graph TD
    Client([Client: Web/Mobile/CLI]) --> Gateway[Nginx / Proxy]
    Gateway --> REST[REST API: Port 6573]
    Gateway --> SSE[SSE Stream: Port 6573]
    Gateway --> MC[Mission Control: Port 9999]
    Gateway --> WU[Wakeup API: Port 7142]
    
    subgraph "Internal Services"
        REST --> A[assistant.go]
        SSE --> MC_GO[missioncontrol.go]
        WU --> WAK[wakeup.go]
        A --> LLM[Multi-LLM Provider]
    end

Key Files & Functions

  • assistant/webserver.go: The main HTTP router and handler implementations.
  • assistant/missioncontrol.go: Logic for SSE broadcasting of reasoning and alerts.
  • assistant/wakeup.go: The ingress for external event signals.
  • assistant/middleware.go: Logging, RequestID, and Recovery middleware.

Guidance for AI Agents

  • Streaming Support: Always prefer the SSE-enabled /api/query for user-facing interactions to provide immediate feedback during long-running tasks.
  • API Security: Ensure all API requests include the appropriate authentication headers (where required by the environment).

Cross-References