KYCIS SDK Docs
Event System

Event Flow

End-to-end event flow to assistant outcome

Standard KYC Flow

1. User lands on screen

2. SDK emits screen context

3. User interacts with components

4. SDK emits component_input / validation_failed

5. Backend evaluates trigger policy

6. Assistant starts with current context

7. Voice conversation

8. Session ends, reengagement decision

Step 1: Screen Entry

User navigates to KYC screen:

// In Activity.onResume or navigation callback
AI.setKycStep("pan_entry")

Events emitted:

  • screen_schema (if schema registered)
  • screen_schema_lazy (if no schema)

Backend:

  • Updates session screen
  • Stores schema if provided
  • Available for context building

Step 2: User Input

User types in field:

// On text change (debounced)
AI.reportComponentInput(
  componentId = "pan_field",
  hint = "ABCDE****F",
  masked = true
)

Event: component_input

Backend:

  • Stores redacted hint
  • Available for voice context
  • Not treated as verified data

Step 3: Validation Failure

User submits invalid input:

AI.trackValidationFailure(
  failureReasonCode = "pan_invalid",
  componentId = "pan_field",
  hint = "ABCDE****F",
  masked = true
)

Event: validation_failed

Backend:

  • Sets last_validation_failure
  • May trigger assistant offer
  • Provides recovery hints to voice agent

Step 4: Trigger Evaluation

SDK evaluates trigger:

Passive Timer / Error

POST /v1/assistant/trigger/evaluate

Backend Rules:
- time_spent > 20s → trigger
- errors >= 2 → trigger
- idle > 12s on critical step → trigger

Returns: trigger, action, reason, intervention_mode

Activity: kind: "trigger"

Step 5: Assistant Start

If trigger allowed:

SDK receives trigger decision

Applies TriggerStartMode:
- CONFIRM_UI → Show dialog
- IMMEDIATE → Start directly
- COOLDOWN → Wait if needed

User confirms (or immediate)

POST /v1/assistant/session/start

Backend:
- Creates LiveKit room
- Dispatches agent
- Returns credentials

VoiceSessionListener invoked

App connects to LiveKit

Activity: kind: "session_start"

Step 6: Voice Context

Voice agent fetches context:

Agent joins room

GET /v1/assistant/context/{session_id}

Backend builds context:
- Session state (screen, errors)
- Screen schema (if available)
- Component hints (redacted)
- KYC knowledge base

Returns system prompt for LLM

Synthetic event: voice_agent_context_fetch

Step 7: Conversation

During call:

User speaks

STT → Agent receives transcript

Agent fetches updated context (optional)

LLM generates response

TTS → User hears reply

Event: voice_conversation_turn

Step 8: Session End

User ends call:

User clicks end / AI.stopAssistant()

POST /v1/assistant/session/stop

Backend:
- Marks session inactive
- Evaluates reengagement
- Emits activity

Activities:

  • kind: "session_stop"
  • kind: "reengagement" (if voice was active)

Flow Variations

Manual Start (No Trigger)

User taps help button

AI.startAssistant()

Skip trigger evaluation

Direct to session start

Error-Driven Trigger

Validation fails

AI.trackValidationFailure()

Immediate trigger evaluation

May offer assistance

Passive Time-Based

User on screen 20+ seconds

Passive evaluation fires

Trigger evaluates

May offer assistance

Activity Stream Order

Typical sequence in /api/activity:

  1. eventidentity
  2. eventscreen_schema or screen_schema_lazy
  3. eventcomponent_input (multiple)
  4. eventvalidation_failed (if errors)
  5. trigger — trigger evaluation
  6. session_start — voice begins
  7. eventvoice_conversation_turn (multiple)
  8. eventvoice_agent_context_fetch
  9. session_stop — voice ends
  10. reengagement — follow-up decision

On this page