Skip to content
Updated Jun 9, 2026

AI Triage

The triage service runs Olly's clinical triage agent: a member works through an NHS-111-style pathway in conversation and reaches a disposition. The same domain also holds the ai-chat assistant. Every tool call is traced to Langfuse.

Field reference: full columns, types and nullability live in the catalog: glossary terms Session, Turn, Recommendation, Judgement, User, Conversation, Message. This page is the narrative.

Session and Turn

  • Session is one triage interaction. It carries the patient demographics (sex, age), the chief_complaint, the current pathway position (pathway_id / current_state_id: text ids into the NHS pathway model, not modelled concepts), and the final disposition as a structured JSONB object. status is a real DB CHECK: active | completed | abandoned (lowercase).
  • Turn is one message in a session (role is a DB CHECK of user | assistant | tool), with the content and, for tool turns, tool_name / tool_args / tool_result (JSONB). Turns make the whole interaction replayable.

Recommendation

The terminal Recommendation is the disposition itself, realised as Session.disposition (there is no separate table). It carries an urgency in { emergency, urgent, non_urgent, self_care } plus advice. A disposition is what hands off to Care Pathways.

Evaluation

Judgement is an offline quality score produced by a judge LLM over a completed session (tone, PRD-compliance and safety against a rubric), stored to track model regression across prompt versions. It is part of the eval harness, not the live flow.

User: a triage credential, not a person

The triage User is the service's own API-credential record (username + hashed API key, with sex/age for pathway routing, both DB-CHECK'd). It is not the platform human identity (Keycloak) nor a Party.

AI-chat assistant

The ai-chat surface adds Conversation (scoped to an org via org_locator + a user_sub, with a persona) and Message (role DB CHECK user | assistant | system). Token usage and tool-call traces are in Langfuse, not the messages table.

Caveats

  • pathway_id / current_state_id / Turn.state_id are text identifiers into the NHS pathway content, not modelled concepts (there is no Pathway table).
  • The ai-chat Message role set (…/system) differs from the triage Turn role set (…/tool); don't conflate them.

Olly Health Insurance Platform