What HxNexus Is

HxNexus combines three information sources into every response: live case data from PostgreSQL (scoped to the requesting user's access group), process knowledge from HxGraph (the semantic graph of case types, stages, steps, forms, connectors, and their relationships), and conversational context from the current session. When you open HxNexus from within a case, it automatically pre-loads that case's full event history and field values into its context window — no copy-pasting required.

The AI model is configured via the AI_MODEL environment variable and served by case-service through the API gateway on port 8200. Prompt caching is enabled with a 5-minute TTL on repeated queries in the same session, dramatically reducing latency for iterative follow-up questions. Responses are structured: HxNexus returns prose summaries, formatted tables, and actionable recommendations depending on the query type — not raw database dumps.

Access group scoping: HxNexus never returns data outside the authenticated user's access group. The system prompt injects a WHERE clause equivalent for every case data query — even if a question is phrased to cross group boundaries, the response is silently limited to permitted records. This is enforced at the retrieval layer, not the prompt layer, so it cannot be bypassed via prompt injection.

Case Q&A — Ask the Case

Open any case and use the Ask tab to question everything on it in one place: case variables, the timeline, worker-customer messages, attached document content, verification results, and sealed session transcripts (only if you hold recording-view permission — otherwise that source is withheld and the answer says so). Answers cite their sources inline, are labelled assistive, and every ask is written to the case audit trail with the sources it used.

Capability Reference

HxNexus handles a broad range of question types. The table below shows the primary capability categories with representative example queries.

Capability Example Query Data Source
Case Lookup "What's the current status of case CASE-2041?" case_instances, case_event_log, case_instance_variables
Queue Summary "Summarize the open claims queue — what's the oldest case and the bottleneck stage?" cases, stages, SLA data
Trend Analysis "How has case volume changed over the past 30 days by case type?" cases aggregate, case_types
Process Guidance "What steps are required to complete the KYC Review stage in the Loan Application case type?" HxGraph: stages, steps, forms
Graph Query "What connectors does the Mortgage Origination case type depend on?" HxGraph: structural edges (contains / depends_on)
Anomaly Detection "Are there any cases that have been in the same stage for more than twice the normal duration?" cases, SLA engine, statistical baseline
Assignment Recommendation "Which agent in the Compliance team has the lightest current workload?" cases, users, access_groups
Explanation of Events "Walk me through what happened on case CASE-1887 between Monday and Wednesday." case_events, audit_logs, users

How to Access HxNexus

HxNexus is embedded throughout the Velaris platform. There are three entry points depending on your role and context:

🌙
Moon Button (All Portals)
The crescent moon icon in the bottom-right corner of every portal opens a floating HxNexus drawer. Available to customers, agents, and managers. Context-aware: if you're viewing a case, the drawer pre-loads that case.
🤖
Studio — HxNexus Tab
The dedicated HxNexus tab in Studio gives administrators a full-page interface with history, polyglot settings, and the ability to query the graph directly. Also shows prompt/response debug traces.
🌐
Customer Portal Chat
A pre-submission chat widget on the Customer Portal's landing page lets unauthenticated visitors ask questions about the application process. This instance has no case data access — it queries HxGraph and public process knowledge only.

How It Works Internally

Every HxNexus query follows this pipeline:

  1. Intent classification: case-service receives the raw query and classifies it into one of the capability categories (case lookup, trend, graph query, etc.) to determine which retrieval strategy to apply.

  2. Retrieval: Relevant case data is fetched from PostgreSQL using access-group-scoped SQL. If the query involves process structure (stages, steps, connectors), HxGraph is queried via /api/v1/graph/query or /api/v1/graph/path. Both results are passed to the context builder.

  3. Context assembly: A structured system prompt is assembled containing: (a) the user's role and access group, (b) the current case context if applicable, (c) the retrieved case data summary, (d) the relevant HxGraph subgraph, and (e) the conversation history for the session.

  4. AI API call: The assembled prompt is sent to the configured AI model via the configured AI backend. For streaming requests, the response is forwarded token-by-token via SSE. Prompt caching headers are set — the system prompt block is cached for 5 minutes, so follow-up questions in the same session skip re-encoding the full context.

  5. Structured response: The raw AI output is parsed into a structured response object (answer, sources, suggestions for follow-up questions) and returned to the frontend.

  User Query
      │
      ▼
  ┌───────────────────────────────────────────────────────────┐
  │                    case-service via gateway :8200                      │
  │                                                           │
  │  ┌─────────────┐    ┌──────────────┐    ┌─────────────┐  │
  │  │  Intent     │───▶│  Retrieval   │───▶│   Context   │  │
  │  │  Classifier │    │  Layer       │    │   Builder   │  │
  │  └─────────────┘    └──────┬───────┘    └──────┬──────┘  │
  │                            │                   │         │
  │                    ┌───────┴──────┐            │         │
  │                    │              │            │         │
  │              ┌─────▼──────┐ ┌────▼──────┐     │         │
  │              │  case-svc  │ │ HxGraph   │     │         │
  │              │  :8200     │ │  :8200    │     │         │
  │              │  SQL query │ │  /query   │     │         │
  │              └────────────┘ └───────────┘     │         │
  │                                               ▼         │
  │                              ┌────────────────────────┐  │
  │                              │  AI Backend             │  │
  │                              │  configured model      │  │
  │                              │  (prompt cache 5m TTL) │  │
  │                              └────────────┬───────────┘  │
  └───────────────────────────────────────────┼──────────────┘
                                              │
                                   Structured response
                                   or SSE token stream
                                              │
                                              ▼
                                         Frontend

Configuration

HxNexus requires two environment variables set for case-service and an optional Studio configuration for advanced settings.

Variable Default Description
ANTHROPIC_API_KEY Required API key for the configured AI provider (e.g. Anthropic). Set in the platform environment. Never commit to source.
AI_MODEL claude-sonnet-4-6 The AI model identifier to use for all HxNexus queries. Override to use a different model. For Ollama backends, use the local model name instead.
AI_MAX_TOKENS 4096 Maximum output tokens per response. Increase for complex trend analysis or multi-step explanations. Streaming responses are unaffected by this limit during generation.
AI_CACHE_TTL 300 System prompt cache TTL in seconds (AI prompt caching). Repeated queries within the window reuse the cached prompt encoding, reducing latency by ~40%.

Additional settings are available in Studio under Studio > HxNexus > Settings:

Polyglot Support

HxNexus responds in the language of the question — no configuration required for most deployments. If an agent asks in Spanish, the response comes back in Spanish. If a customer types in Arabic (including RTL layout handling in the chat widget), the response is in Arabic. This is handled entirely by the AI model's multilingual capability; Velaris does not maintain separate translation pipelines or language models.

Supported languages: All major world languages supported by the configured AI model, including English, Spanish, French, German, Portuguese, Arabic, Hindi, Japanese, Mandarin, Korean, Italian, Dutch, Russian, and Polish. Responses in languages Velaris's own UI strings are not translated into will still be correct for AI-generated content.

Streaming Responses

HxNexus supports streaming delivery via Server-Sent Events (SSE) on the /api/v1/nexus/stream endpoint. When streaming is active, the chat UI renders tokens progressively as the AI generates them — users see the answer forming word by word rather than waiting for the full response. This is the default mode for the chat drawer in Agent and Manager portals.

Each SSE event carries a data field containing either a partial token chunk (type: "delta"), a sources block (type: "sources"), or a terminal event (type: "done"). The frontend accumulates deltas and replaces the sources block when it arrives.

# Connect to the HxNexus streaming endpoint
curl -N -X POST http://localhost:8100/api/v1/nexus/stream \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <JWT_TOKEN>" \
  -d '{"question": "Summarize the top 3 SLA-breached cases this week"}'

# Sample SSE stream:
data: {"type":"delta","text":"Here are the top 3 "}
data: {"type":"delta","text":"SLA-breached cases this week:"}
data: {"type":"delta","text":"\n\n**1. CASE-2041** — Loan Application,"}
data: {"type":"sources","cases":["CASE-2041","CASE-1983","CASE-2015"]}
data: {"type":"done"}

API Reference

All HxNexus endpoints are served by case-service through the gateway on port 8200 under /api/v1/hxnexus/*. All endpoints require a valid Bearer JWT token unless otherwise noted.

Method Endpoint Description Auth Required
POST /api/v1/nexus/query Submit a natural language question. Returns a complete structured JSON response with answer, sources, and suggestions fields. Yes
POST /api/v1/nexus/stream Same as /query but returns an SSE stream. The connection stays open until the done event. Use text/event-stream content negotiation. Yes
POST /api/v1/embed Generate a pgvector embedding for arbitrary text. Returns a 1536-dimensional float array. Used internally by HxGraph sync; also available for custom integrations. Yes
GET /api/v1/similar Find semantically similar concepts given a query string. Query params: text (required), limit (default 10), threshold (cosine distance, default 0.3). Returns ranked list of matching graph nodes. Yes

Request & Response Shape — POST /api/v1/nexus/query

# Request body
{
  "question": "Which claims cases have been open for more than 14 days?",
  "case_id": "CASE-2041",   // optional — pre-loads case context
  "session_id": "sess_abc123"  // optional — maintain conversation history
}

# Response body
{
  "answer": "There are 7 open Claims cases older than 14 days. The oldest is CASE-1872 (Flood Claim, opened 2026-04-12, currently stalled in 'Assessment Review')...",
  "sources": [
    { "type": "case", "id": "CASE-1872", "label": "Flood Claim" },
    { "type": "case", "id": "CASE-1890", "label": "Property Claim" }
  ],
  "suggestions": [
    "Which of these cases has the nearest SLA breach?",
    "Reassign the top 3 oldest cases to the senior claims team?",
    "Why is CASE-1872 stalled in Assessment Review?"
  ],
  "model": "claude-sonnet-4-6",
  "cached": false,
  "latency_ms": 1240
}

cURL Example — Query HxNexus

curl -s -X POST http://localhost:8100/api/v1/nexus/query \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <JWT_TOKEN>" \
  -d '{
    "question": "What is the average resolution time for Loan Application cases in Q1 2026?"
  }' | python3 -m json.tool

Limitations

Best Practices

Getting the best answers: Be specific in your queries. Instead of "show me problem cases", ask "which cases in the Mortgage Application case type have been in the Underwriting stage for more than 5 business days?" Reference case IDs when asking about a specific case — HxNexus will load its full history. Use follow-up questions to drill down rather than combining everything into one complex query.
Session continuity: Pass a consistent session_id across follow-up questions. Without a session ID, each query is treated as standalone and HxNexus loses prior context — answers to follow-up questions may be less precise.