Agent App Service

This is a WebSocket-based AI agent service. Connect using a WebSocket client to interact with agents.

Authentication

All API and WebSocket endpoints require a JWT token. Generate one with:

npx tsx scripts/generate-token.ts --tenantId=my-tenant

Pass via Authorization: Bearer <token> header, or ?token=<jwt> query parameter for WebSocket connections.

Available Agents

Connect via WebSocket

WebSocket ws://<host>/ws/agents/theme?token=<jwt>&sessionId=<session>
WebSocket ws://<host>/ws/agents/flowchart?token=<jwt>&sessionId=<session>
WebSocket ws://<host>/ws/agents/flow_recommendation?token=<jwt>&sessionId=<session>

Query parameters: token (required, JWT) · sessionId (optional, auto-generated if omitted)

REST API Endpoints

GET /api/agents — List all available agents
GET /api/agents/:agentType — Get agent schema details
GET /health — Health check (no auth required)

Quick Start

// Generate a token first:
// npx tsx scripts/generate-token.ts --tenantId=my-tenant
const TOKEN = "<your-jwt-token>";

const ws = new WebSocket("ws://localhost:8787/ws/agents/theme?token=" + TOKEN + "&sessionId=my-session");

ws.onopen = () => {
  ws.send(JSON.stringify({
    id: crypto.randomUUID(),
    type: "user.message",
    timestamp: Date.now(),
    sessionId: "my-session",
    agentType: "theme",
    payload: { content: "Hello, agent!" }
  }));
};

ws.onmessage = (event) => {
  const frame = JSON.parse(event.data);
  console.log(frame.type, frame);
};